天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

78 lines
2.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel.Activation;
using System.ServiceModel;
using System.Text;
using QMFrameWork.ServiceInterface;
using QMFrameWork.ServiceLibrary;
using QMAPP.Entity.Sys;
using QMAPP.BLL.Sys;
namespace QMFrameWork.WebServiceHost
{
/// <summary>
/// 登录服务
/// </summary>
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class LoginService : ILoginService
{
/// <summary>
/// 用户登录验(用户名和密码登录)
/// </summary>
/// <param name="login">登录信息</param>
/// <param name="c">登录凭据</param>
/// <returns>登录信息</returns>
public LoginInfo IsLogin(LoginInfo login, CredentialInfo c)
{
try
{
login = new LoginBLL().IsLogin(login);
if (login == null)
{
return login;
}
c.UserName = login.UserName;
if (c.CredentialID != null)
{
SessionManager.Add(c.CredentialID, new ServiceSession { SessionID = c.CredentialID, UserCredential = c, UserLogin = login }, new TimeSpan(0, 60, 0));
}
return login;
}
catch (Exception ex)
{
QMFrameWork.Log.LogManager.LogHelper.Error(
new QMFrameWork.Log.LogInfo { ClientIP = "localhost", UserName = "admin", Info = "执行服务异常", ErrorInfo = ex });
throw new FaultException(ex.Message);
}
}
/// <summary>
/// 获取登录信息
/// </summary>
/// <param name="c">登录凭据</param>
/// <returns>登录信息</returns>
public LoginInfo GetLoginInfo(CredentialInfo c)
{
try
{
ServiceSession session = SessionManager.GetSession(c.CredentialID);
if (session != null)
{
return session.UserLogin;
}
else
{
return null;
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}