13693261870
2024-04-02 2a1b873b4b78b508d5d53c57992e734c56619df8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Text;
using System.Web;
using System.Web.SessionState;
using Terra.YaoGan.Common;
using Terra.YaoGan.Model;
using Terra.YaoGan.Service;
 
namespace Terra.YaoGan.Web.Ashx
{
    /// <summary>
    /// Index 的摘要说明
    /// </summary>
    public class Index : IHttpHandler, IRequiresSessionState
    {
        RootCatlogService rct = new RootCatlogService();
        public void ProcessRequest(HttpContext context)
        {
            string method = context.Request["Action"].ToString();
 
            MethodInfo mif = this.GetType().GetMethod(method);
            if (mif != null)
            {
                mif.Invoke(this, new object[] { context });
            }
        }
 
 
        public void GetRootName(HttpContext context)
        {
            DataTable dt = rct.GetTable();
            string jsonStr = DataTableToJson.DtToJson(dt);
            context.Response.Write(jsonStr);
        }
 
 
        public void  GetUserInfo(HttpContext context)
        {
            //获取登录信息
            string userName = context.Request["userName"];
            string passWord = context.Request["passWord"];
            UserInfoService US = new UserInfoService();
            StringBuilder sb = new StringBuilder();
            try
            {
                UserInfoModel us = US.CheckuserInfo(userName, passWord);
                if (us == null)
                {
                    sb.Append("{\"Msg\":\"failed\",\"Data\":{},\"Errmsg\":\"请检查用户名或者密码,如果没有账号,请联系管理员添加!\"}");
                    context.Response.Write(sb.ToString());
                }
                else
                {
                    context.Session["UserInfo"] = us;
                    sb.Append("{\"Msg\":\"Success\",\"Data\":[{\"UserName\":\"" + us.UserName + "\",\"PassWord\":\"" + us.PassWord + "\",\"State\":\"" + us.State + "\"}],\"Errmsg\":\"\"}");
                }
            }
            catch (Exception e)
            {
                sb.Append("{\"Msg\":\"failed\",\"Data\":{},\"Errmsg\":\"请检查用户名或者密码,如果没有账号,请联系管理员添加!\"}");
                context.Response.Write(sb.ToString());
            }
 
        }
 
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}