Exemple #1
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     context.Response.Buffer = true;
     context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
     context.Response.AddHeader("pragma", "no-cache");
     context.Response.AddHeader("cache-control", "");
     context.Response.CacheControl = "no-cache";
     string Action = context.Request["action"].Trim();               //提交动作
     string txt_Search = context.Request["txt_Search"];
     string Searchwhere = context.Request["Searchwhere"];
     string UserGroup_ID = context.Request["UserGroup_ID"];//用户组主键
     string User_ID = context.Request["User_ID"];//用户主键
     RM_UserInfo_IDAO user_idao = new RM_UserInfo_Dal();
     switch (Action)
     {
         case "UserList"://用户信息数据源 返回JSON
             StringBuilder SqlWhere = new StringBuilder();
             IList<SqlParam> IList_param = new List<SqlParam>();
             if (!string.IsNullOrEmpty(txt_Search))
             {
                 SqlWhere.Append(" AND " + Searchwhere.Trim() + " like @obj ");
                 IList_param.Add(new SqlParam("@obj", '%' + txt_Search.Trim() + '%'));
             }
             SqlWhere.Append(" AND USER_ID NOT IN(SELECT USER_ID FROM Base_UserInfoUserGroup WHERE UserGroup_ID = @UserGroup_ID)");
             IList_param.Add(new SqlParam("@UserGroup_ID", UserGroup_ID));
             context.Response.Write(JsonHelper.DataTableToJson(user_idao.GetUserInfoInfo(SqlWhere, IList_param), "UserGroupList"));
             context.Response.End();
             break;
         case "UserGroupInfo"://用户组  返回HTML
             context.Response.Write(InitUserGroupInfo(user_idao.Load_UserInfoUserGroupList(UserGroup_ID)));
             context.Response.End();
             break;
         case "UserGroupaddMember"://用户组新增成员
             bool IsOk = user_idao.AddUserGroupMenber(User_ID.Split(','), UserGroup_ID);
             if (IsOk)
             {
                 context.Response.Write(1);
                 context.Response.End();
             }
             else
             {
                 context.Response.Write(-1);
                 context.Response.End();
             }
             break;
         default:
             break;
     }
 }
Exemple #2
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     context.Response.Buffer = true;
     context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
     context.Response.AddHeader("pragma", "no-cache");
     context.Response.AddHeader("cache-control", "");
     context.Response.CacheControl = "no-cache";
     string Action = context.Request["action"];                      //提交动作
     string user_Account = context.Request["user_Account"];          //账户
     string userPwd = context.Request["userPwd"];                    //密码
     string code = context.Request["code"];                          //验证码
     RM_UserInfo_IDAO user_idao = new RM_UserInfo_Dal();
     RM_System_IDAO sys_idao = new RM_System_Dal();
     IPScanerHelper objScan = new IPScanerHelper();
     switch (Action)
     {
         case "login":
             if (code.ToLower() != context.Session["dt_session_code"].ToString().ToLower())
             {
                 context.Response.Write("1");//验证码输入不正确!
                 context.Response.End();
             }
             DataTable dtlogin = user_idao.UserLogin(user_Account.Trim(), userPwd.Trim());
             if (dtlogin != null)
             {
                 objScan.DataPath = context.Server.MapPath("/Themes/IPScaner/QQWry.Dat");
                 objScan.IP = RequestHelper.GetIP();
                 string OWNER_address = objScan.IPLocation();
                 if (dtlogin.Rows.Count != 0)
                 {
                     user_idao.SysLoginLog(user_Account, "1", OWNER_address);
                     if (dtlogin.Rows[0]["DeleteMark"].ToString() == "1")
                     {
                         if (Islogin(context, user_Account))
                         {
                             SessionUser user = new SessionUser();
                             user.UserId = dtlogin.Rows[0]["User_ID"].ToString();
                             user.UserAccount = dtlogin.Rows[0]["User_Account"].ToString();
                             user.UserName = dtlogin.Rows[0]["User_Name"].ToString() + "(" + dtlogin.Rows[0]["User_Account"].ToString() + ")";
                             user.UserPwd = dtlogin.Rows[0]["User_Pwd"].ToString();
                             RequestSession.AddSessionUser(user);
                             context.Response.Write("3");//验证成功
                             context.Response.End();
                         }
                         else
                         {
                             context.Response.Write("6");//该用户已经登录,不允许重复登录
                             context.Response.End();
                         }
                     }
                     else
                     {
                         user_idao.SysLoginLog(user_Account, "2", OWNER_address);//账户被锁,联系管理员!
                         context.Response.Write("2");
                         context.Response.End();
                     }
                 }
                 else
                 {
                     user_idao.SysLoginLog(user_Account, "0", OWNER_address);
                     context.Response.Write("4");//账户或者密码有错误!
                     context.Response.End();
                 }
             }
             else
             {
                 context.Response.Write("5");//服务连接不上!
                 context.Response.End();
             }
             break;
         case "Menu":
             string UserId = RequestSession.GetSessionUser().UserId.ToString();//用户ID
             string strMenus = JsonHelper.DataTableToJson(sys_idao.GetMenuHtml(UserId), "MENU");
             context.Response.Write(strMenus);
             context.Response.End();
             break;
         default:
             break;
     }
 }