Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string userid = string.Empty;
            if (!IsPostBack)
            {
                sys_title.InnerHtml = "长清公安分局运维综合管理系统";
                if (Session["UserName"] == null)
                {

                }
                else
                {
                    PersonInfo pr = new PersonInfo();
                    PersonInfoManager prMgr = new PersonInfoManager();
                    WhereClip where = PersonInfo._.UserName == Session["UserName"].ToString();
                    pr = prMgr.GetItemById(where);
                    if (pr != null)
                    {
                        userid = pr.ID.ToString();
                        uid.Value = pr.ID.ToString();
                    }
                    LabelUser.Text = "您好," + Session["UserName"].ToString();
                    GenarateNavigator();
                }
            }
        }
Exemple #2
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         context.Response.ContentType = "text/plain";
         string p1 = context.Request.Form["p1"].ToString();//获取id值
         string p2 = context.Request.Form["p2"].ToString();//获取id值
         string p3 = context.Request.Form["p3"].ToString();//获取id值
         string userName = context.Session["UserName"].ToString();
         PersonInfo pr = new PersonInfo();
         PersonInfoManager prMgr = new PersonInfoManager();
         if (!prMgr.checkUserIndentity(p1, userName))
         {
             context.Response.Write("原密码不正确!");
             return;
         }
         else
         {
             prMgr.UpdatePwd(userName, p2);
             context.Response.Write("");
         }
     }
     catch (Exception ex)
     {
         context.Response.Write(ex.Message);
     }
     //prMgr.GetItemById(
 }
Exemple #3
0
 /// <summary>
 /// 是否存在相同编号
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool ExitCodeAndName(PersonInfo entity)
 {
     return Dal.Exists<PersonInfo>(PersonInfo._.ID != entity.ID && PersonInfo._.UserName == entity.UserName);
 }
Exemple #4
0
        public bool UpdatePwd(string username, string pwd)
        {
            try
            {
                WhereClip where = PersonInfo._.UserName == username;
                //wr.
                PersonInfo pr = new PersonInfo();
                pr.RecordStatus = StatusType.update;
                pr.Pwd = pwd;

                Dal.Update(where, pr);//这里没成功 不知道是什么原因
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #5
0
        /// <summary>
        /// 根据ID获取员工信息表实体
        /// </summary>
        /// <param name="guid">主键ID</param>
        /// <returns>返回员工信息表实体</returns> 
        public PersonInfo GetItemById(Guid guid)
        {
            PersonInfo tem = new PersonInfo();
            tem = Dal.Find<PersonInfo>(PersonInfo._.ID == guid);

            return tem;
        }
Exemple #6
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                context.Response.ContentType = "text/plain";
                HttpRequest rp = context.Request;

                string login_user = rp["login_user"].ToString();
                string login_pwd = rp["login_pwd"].ToString();
                string rand_rs = rp["rand_rs"].ToString();
                //if (context.Session["Very_Code"] == null)
                //{
                //    context.Response.Write("{\"result\":\"ERROR\",\"errmsg\":\"请刷新验证码!\"}");
                //}
                //else
                //{
                    //if (rand_rs != context.Session["Very_Code"].ToString())
                    //{
                    //    context.Response.Write("{\"result\":\"ERROR\",\"errmsg\":\"验证码错误!\"}");
                    //    return;

                    //}
                    PersonInfo pr = new PersonInfo();
                    PersonInfoManager prManger = new PersonInfoManager();
                    if (prManger.checkUserIndentity(login_pwd, login_user))
                    {
                        //登陆成功
                        context.Session["UserName"] = login_user; //缓存用户名
                        WhereClip where = PersonInfo._.UserName == login_user;
                        pr = prManger.GetItemById(where);
                        if (pr == null)
                        {

                            context.Session["UserID"] = "root"; //缓存用户名
                            context.Session["RealName"] = "管理员";
                            context.Session["DepartID"] = "root";
                            context.Session["DepartName"] = "总部";
                        }
                        else
                        {
                            context.Session["UserID"] = pr.ID; //缓存用户名
                            context.Session["RealName"] = pr.RealName;
                            //缓存部门
                            AdministrativeRegions ar = prManger.GetDefaultDepartInfo(pr.ID);
                            if (ar != null)
                            {
                                context.Session["DepartID"] = ar.ID;
                                context.Session["DepartName"] = ar.Name;
                            }
                            //缓存所有部门
                            List<AdministrativeRegions> list = prManger.GetAllDepart(pr.ID);
                            context.Session["AllDepart"] = list;
                        }
                        string url = "main.aspx";
                        if (context.Request.UrlReferrer != null && !string.IsNullOrEmpty(context.Request.UrlReferrer.Query))
                        {
                            string refurl = context.Request.UrlReferrer.Query;
                            if (refurl.StartsWith("?ref=/"))
                            {
                                url = refurl.Substring(refurl.LastIndexOf('/')+1);

                            }

                        }
                        context.Response.Write("{\"result\":\"OK\",\"forward\":\"" + url + "\"}");

                    }
                    else
                    {
                        context.Response.Write("{\"result\":\"ERROR\",\"errmsg\":\"用户名或密码错误!\"}");
                    }
                //}

            }
            catch (Exception ex)
            {
                context.Response.Write("{\"result\":\"ERROR\",\"errmsg\":\"" + ex.Message +ex.Source+ex.StackTrace+ "\"}");
            }
        }