using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Reflection;
|
using System.Text;
|
using System.Web;
|
using Terra.YaoGan.Common;
|
using Terra.YaoGan.Model;
|
using Terra.YaoGan.Service;
|
|
|
namespace Terra.YaoGan.Web.Ashx
|
{
|
/// <summary>
|
/// LoginInfo 的摘要说明
|
/// </summary>
|
public class LoginInfo : IHttpHandler
|
{
|
|
public void ProcessRequest(HttpContext context)
|
{
|
string Action = context.Request["Action"];
|
|
MethodInfo mif = this.GetType().GetMethod(Action);
|
if (mif != null)
|
{
|
mif.Invoke(this, new object[] { context });
|
}
|
}
|
|
|
|
public void UserInfo(HttpContext context)
|
{
|
string UserName = context.Request["userName"];
|
string PassWord = context.Request["passWord"];
|
UserInfoService uis = new UserInfoService();
|
UserInfoModel info=uis.GetInfo(UserName, PassWord);
|
context.Response.Write(InfoToJson(info));
|
}
|
|
|
public string InfoToJson(UserInfoModel Um)
|
{
|
StringBuilder sb = new StringBuilder();
|
|
if (Um == null)
|
{
|
sb.Append("{\"Msg\":\"failed\",\"Data\":{},\"Errmsg\":\"请检查用户名或者密码,如果没有账号,请联系管理员添加!\"}");
|
}else
|
{
|
string DeName = MD5EnDe.MD5Encrypt(Um.UserName);
|
string DePassWord = MD5EnDe.MD5Encrypt(Um.PassWord);
|
sb.Append("{\"Msg\":\"Success\",\"Data\":[{\"UserName\":\""+ DeName + "\",\"PassWord\":\""+ DePassWord + "\",\"State\":\""+Um.State+"\"}],\"Errmsg\":\"\"}");
|
}
|
return sb.ToString();
|
}
|
|
|
|
|
|
|
|
|
|
|
public bool IsReusable
|
{
|
get
|
{
|
return false;
|
}
|
}
|
}
|
}
|