Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 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(
 }
Ejemplo n.º 3
0
 private void LoadData(string ID)
 {
     PersonInfoManager manager = new PersonInfoManager();
     PersonInfo code = manager.GetItemById(new Guid(ID));
     txtID.Value = code.ID.ToString();
     txtUserName.Value = code.UserName;
     txtEmail.Value = code.Email;
     txtRealName.Value = code.RealName;
     txtLocation.Value = code.Location;
     txtDetailedAddress.Value = code.DetailedAddress;
     txtSex.SelectedValue = code.Sex.ToString();
     txtTelphone.Value = code.Telphone;
     txtIDCardNumber.Value = code.IDCardNumber;
     hidBirthday.Value = code.Birthday.HasValue ? code.Birthday.Value.ToString("yyyy/MM/dd") : "";
     txtMarryStatus.SelectedValue = code.MarryStatus.HasValue ? code.MarryStatus.ToString() : "";
     txtNote.Value = code.Note;
     //获取默认部门
      DepartAndPerson dp=   manager.GetDefaultDepart(code.ID);
      if (dp!=null)
      {
      AdministrativeRegions ar = new AdministrativeRegionsManager().GetItemById(dp.DepartID);
      txtDepartID.Value = ar.ID.ToString();
      txtSocrceDepart.Value = ar.Name;
      }
 }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            NameValueCollection rp = context.Request.Form;
            Guid rwid = new Guid(rp["rwid"]);
            List<BaseEntity> list = new List<BaseEntity>();
            string msg = string.Empty;
            PersonInfo curentperson = null;
            string zprenstr = rp["zpren[]"];
            try
            {
                PersonInfoManager plogic = new PersonInfoManager();

                string[] zpren = zprenstr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < zpren.Length; i++)
                {
                    if (i == 0)
                    {
                        curentperson = plogic.GetItemById(new Guid(zpren[i]));
                    }
                    WorkHandLog log = new WorkHandLog();
                    log.ID = Guid.NewGuid();
                    log.WorkID = rwid;
                    log.CurrentStaus = "处理中";
                    log.ChuliYj = "工作指派";
                    if (!string.IsNullOrEmpty(context.Session["UserName"] as string))
                    {
                        log.Uper = new Guid(context.Session["UserID"].ToString());
                        log.UpName = context.Session["RealName"] as string;
                    }
                    log.DownEr = new Guid(zpren[i]);
                    log.DownName = plogic.GetItemById(log.DownEr.Value).RealName;
                    log.HandDate = DateTime.Now;
                    log.HandResult = "已指派";
                    log.HandSequence = 1;
                    list.Add(log);
                }
                WorkInfo work = new WorkInfo();
                work.ID = rwid;
                work.RecordStatus = Sharp.Common.StatusType.update;
                work.Status = "处理中";
                work.CurrentUser = curentperson.RealName;
                list.Add(work);
                int result = new WorkInfoManager().Save(list);
                context.Response.Write("{\"success\":\"true\"}");
            }
            catch (Exception ex)
            {
                msg = ex.Message;

            }
            if (!string.IsNullOrEmpty(msg))
            {
                byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>"));
                string encode = Convert.ToBase64String(bytes);
                context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}");
            }
            context.Response.End();
        }
Ejemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            HttpRequest rp = context.Request;
            context.Response.ContentType = "text/plain";
            PersonInfoManager manager = new PersonInfoManager();
            int currentPage = int.Parse(rp["pagenum"]);
            int pageSize = int.Parse(rp["pagesize"]) ;
            int count = 0, recordCount = 0;
            string filter = context.Request["filtervalue0"];
            WhereClip where = null;
            if (!string.IsNullOrEmpty(filter))
            {
                filter = filter.Trim();

                where = (PersonInfo._.UserName.Contains(filter) || PersonInfo._.RealName.Contains(filter));
            }
            DataTable dt = manager.GetDataTable(currentPage + 1, pageSize, where, PersonInfo._.UserName.Asc, ref count, ref recordCount);
            string result = JsonConvert.Convert2Json(dt);
            context.Response.Write("{ \"totalRecords\":\"" + recordCount + "\",\"rows\":" + result + "}");
            context.Response.End();
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (context.Session["UserID"] != null)
            {
                string userid = context.Session["UserID"].ToString();
                PersonInfo p = new PersonInfoManager().GetItemById(new Guid(userid));
                if (!p.MarryStatus.HasValue || p.MarryStatus.Value != 3)
                {
                    context.Response.Write("{\"total\":\"0\",\"rows\": 没有考勤数据}");
                    context.Response.End();
                    return;
                }
            }

            YuanGongKaoQinManager manager = new YuanGongKaoQinManager();
            int pageNum = int.Parse(context.Request.QueryString.Get("pagenum"));
            int pagesize = int.Parse(context.Request.QueryString.Get("pagesize"));
            int recordCount = 0;
            WhereClip where = new WhereClip();
            if (!string.IsNullOrEmpty(context.Request["USER"]))
            {
                where = YuanGongKaoQin._.UserName.Contains(context.Request["USER"]);

            }

            if (!string.IsNullOrEmpty(context.Request["begindate"]))
            {

                string begin = context.Request["begindate"];
                if (!string.IsNullOrEmpty(begin))
                {
                    where = where && YuanGongKaoQin._.KQRQ >= begin;

                }
            }
            if (!string.IsNullOrEmpty(context.Request["enddate"]))
            {

                string enddate = context.Request["enddate"];
                if (!string.IsNullOrEmpty(enddate))
                {
                    where = where && YuanGongKaoQin._.KQRQ <= enddate;

                }
            }
            if (!string.IsNullOrEmpty(context.Request["swstatus"]))
            {
                where = YuanGongKaoQin._.SWStatus == context.Request["swstatus"];

            }

            if (!string.IsNullOrEmpty(context.Request["status"]))
            {
                where = YuanGongKaoQin._.Status == context.Request["status"];

            }

            if (!string.IsNullOrEmpty(context.Request["KQRQ"]))
            {
                string[] datestr = context.Request["KQRQ"].ToString().Split('@');
                string begin = datestr[0];
                if (!string.IsNullOrEmpty(begin))
                {
                    where.And(YuanGongKaoQin._.KQRQ >= begin);
                }
                string end = datestr[1];
                if (!string.IsNullOrEmpty(end))
                {
                    where.And(YuanGongKaoQin._.KQRQ <= end);
                }
            }
            string or = "UserName";
            if (!string.IsNullOrEmpty(context.Request["sortdatafield"]))
            {
                if (!string.IsNullOrEmpty(context.Request["sortorder"]) && context.Request["sortorder"] == "desc")
                {
                    or = context.Request["sortdatafield"] + " desc";
                }
                else
                {
                    or = context.Request["sortdatafield"];
                }

            }
            DataTable dt = manager.GetDataTable(pageNum + 1, pagesize, where, or, ref pagesize, ref recordCount);
            //manager.GetDataTable();
            string result = JsonConvert.Convert2Json(dt);
            context.Response.Write("{\"total\":\"" + recordCount.ToString() + "\",\"rows\":" + result + "}");
            context.Response.End();
        }
Ejemplo n.º 7
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            HttpRequest rp = context.Request;
            string msg = string.Empty;
            try
            {
                if (string.IsNullOrEmpty(rp["txtID"]))
                {
                    entity.ID = Guid.NewGuid();
                }
                else
                {
                    entity.ID = new Guid(rp["txtID"]);
                    entity.RecordStatus = StatusType.update;
                }
                List<BaseEntity> list = new List<BaseEntity>();
                PersonInfoManager manager = new PersonInfoManager();
                if (!string.IsNullOrEmpty(rp["txtDepartID"]))
                {
                    if (entity.RecordStatus == StatusType.update)
                    {
                        //先获取其默认部门
                        DepartAndPerson dp = manager.GetDefaultDepart(entity.ID);
                        if (dp == null)
                        {
                            AddDefault(rp, list);
                        }
                        else

                            if (dp.DepartID.ToString() != rp["txtDepartID"])
                            {
                                dp.IsDefault = false;
                                list.Add(dp);
                                //将单位单位设为默认ID
                                DepartAndPerson dpold = manager.GetOldDepart(entity.ID, rp["txtDepartID"]);
                                if (dpold == null)
                                {
                                    AddDefault(rp, list);
                                }
                                else
                                {
                                    dpold.IsDefault = true;
                                    list.Add(dpold);

                                }

                            }
                    }
                    else
                    {
                        //新增默认部门
                        AddDefault(rp, list);
                    }

                }

                entity.UserName = rp["txtUserName"];
                if (entity.RecordStatus == StatusType.add)
                {
                    entity.Pwd = entity.UserName;
                    entity.CreateDate = DateTime.Now;
                }

                entity.Email = rp["txtEmail"];

                entity.RealName = rp["txtRealName"];

                entity.Location = rp["txtLocation"];
                entity.DetailedAddress = rp["txtDetailedAddress"];
                entity.Sex = int.Parse(rp["txtSex"]);
                entity.Telphone = rp["txtTelphone"];
                entity.IDCardNumber = rp["txtIDCardNumber"];

                if (!string.IsNullOrEmpty(rp["txtBirthday"]))
                {
                    entity.Birthday = DateTime.Parse(rp["txtBirthday"]);
                }
                entity.MarryStatus = int.Parse(rp["txtMarryStatus"]);
                entity.UpdateDATE = DateTime.Now;
                entity.Note = rp["txtNote"];

                bool IsExit = manager.ExitCodeAndName(entity);//重复校验参考
                if (IsExit)
                {
                    msg = "已存在相同账户!";
                }
                else
                {
                    list.Add(entity);
                    manager.Save(list);
                    context.Response.Write("{\"success\":\"true\",\"ID\":\"" + entity.ID + "\"}");
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            if (!string.IsNullOrEmpty(msg))
            {
                byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>"));
                string encode = Convert.ToBase64String(bytes);
                context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}");
            }
            context.Response.End();
        }
Ejemplo n.º 8
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+ "\"}");
            }
        }