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(); }
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(); } } }
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; } }
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+ "\"}"); } }