string id = String.Empty; // 对象id protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); // 用户编辑操作 id = RequestData.Get <string>("id"); SysUser ent = null; if (IsAsyncRequest) { switch (RequestAction) { case RequestActionEnum.Query: case RequestActionEnum.Read: case RequestActionEnum.Default: break; case RequestActionEnum.Create: ent = this.GetPostedData <SysUser>(); ent.DoCreate(); break; case RequestActionEnum.Update: ent = this.GetMergedData <SysUser>(); ent.DoUpdate(); break; case RequestActionEnum.Delete: ent = this.GetTargetData <SysUser>(); ent.DoDelete(); break; case RequestActionEnum.Custom: if (RequestActionString == "chgpwd") { this.ChgPwd(FormData["LoginName"].ToString(), FormData["OrgPassword"].ToString(), FormData["Password"].ToString()); } break; } } else { if (op != "c") { if (!String.IsNullOrEmpty(id)) { ent = SysUser.Find(id); } } } this.SetFormData(ent); }
protected void Page_Load(object sender, EventArgs e) { try { Aim.Portal.Web.WebPortalService.CheckLogon(); } catch { Response.Write("<script> window.location.href = '/Login.aspx';</script>"); Response.End(); } string action = Request["action"]; UserId = Request["UserId"]; switch (action) { case "Create": obj = Request["json"]; ent = JsonHelper.GetObject <SysUser>(obj); MD5Encrypt encrypt = new MD5Encrypt(); ent.Server_IAGUID = "267"; ent.Server_Seed = "江西瑞林工程咨询有限公司"; ent.LoginName = ent.IDNumber; ent.Status = 1; ent.Password = encrypt.GetMD5FromString(ent.LoginName); ent.DoCreate(); break; case "Update": obj = Request["json"]; ent = JsonHelper.GetObject <SysUser>(obj); SysUser ori_Ent = SysUser.Find(ent.UserID); EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(obj); ent = DataHelper.MergeData <SysUser>(ori_Ent, ent, dic.Keys); ent.DoUpdate(); break; case "SelectEdit": SelectEdit(); break; case "check": Check(); break; } }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.Files.Count > 0) { string guid = Guid.NewGuid().ToString(); string filePath = "//WorkTime//InputExcelFiles//" + Guid.NewGuid().ToString() + System.IO.Path.GetExtension(Request.Files[0].FileName); this.Request.Files[0].SaveAs(Server.MapPath(filePath)); ExcelProcessor ep = ExcelService.GetProcessor(Server.MapPath(filePath)); DataSet ds = ep.GetDataSet(); InputDatas(ds.Tables[0]); Response.Write("{success:true}"); Response.End(); } id = RequestData.Get <string>("id", String.Empty); type = RequestData.Get <string>("type", String.Empty); SearchCriterion.AutoOrder = false; SearchCriterion.SetOrder(SysUser.Prop_WorkNo); users = SysUserRule.FindAll(SearchCriterion); this.PageState.Add("UsrList", users); SysUser usr = null; switch (this.RequestAction) { case RequestActionEnum.Create: usr = this.GetPostedData <SysUser>(); usr.DoCreate(); this.SetMessage("新建成功!"); break; case RequestActionEnum.Update: usr = this.GetMergedData <SysUser>(); usr.DoUpdate(); this.SetMessage("保存成功!"); break; case RequestActionEnum.Delete: usr = this.GetTargetData <SysUser>(); usr.DoDelete(); this.SetMessage("删除成功!"); break; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SysUser suEnt = SysUser.Find(UserInfo.UserID); string action = Request["action"] + ""; switch (action) { case "upload": string fileId = Request["fileId"]; if (!string.IsNullOrEmpty(suEnt.Ext2)) { fiEnt = FileItem.Find(suEnt.Ext2); fiEnt.DoDelete(); //如果存在旧的图像将旧的图像文件删除 FileInfo fi = new FileInfo(@"D:\RW\Files\AppFiles\Portal\Default\" + fiEnt.Id + "_" + fiEnt.Name); if (fi.Exists) { fi.Delete(); } } suEnt.Ext2 = fileId; suEnt.DoUpdate(); Response.Write(fileId); Response.End(); break; default: if (!string.IsNullOrEmpty(suEnt.Ext2)) { fiEnt = FileItem.Find(suEnt.Ext2); this.userimage.Src = @"/Document/" + fiEnt.Id + "_" + fiEnt.Name; } break; } IniPersonalCenter(); IniWeather(); IniNotice(); IniNews(); IniMyLink(); IniTaskWebPart(); //PromptWin(); } }
private void DoBatchSave() { IList <string> entStrList = RequestData.GetList <string>("data"); if (entStrList != null && entStrList.Count > 0) { SysUser user = null; Dictionary <string, object> dic = null; foreach (string str in entStrList) { dic = FromJson(str) as Dictionary <string, object>; if (dic != null) { user = SysUser.FindAllByPrimaryKeys(dic["UserID"]).FirstOrDefault <SysUser>(); if (user != null && user.Wage + "" != dic["Wage"] + "") { user.Wage = dic["Wage"] == null ? null : (decimal?)Convert.ToDecimal(dic["Wage"]); user.DoUpdate(); } } } } }
protected void Page_Load(object sender, EventArgs e) { try { Aim.Portal.Web.WebPortalService.CheckLogon(); } catch { Response.Write("<script> window.location.href = '/Login.aspx';</script>"); Response.End(); } string action = Request["action"]; UserId = Request["UserId"]; MD5Encrypt encrypt = new MD5Encrypt(); switch (action) { case "loadgroupdata": string Id = Request["id"]; sql = "select GroupID,replace(Name,'江西瑞林建设监理有限公司','') as Name from SysGroup where ParentId='" + Id + "' order by Code asc"; IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); string result = "["; int i = 0; foreach (EasyDictionary dic_temp in dics) { if (i != dics.Count - 1) { result += "{id:'" + dic_temp.Get <string>("GroupID") + "',text:'" + dic_temp.Get <string>("Name") + "',leaf:true},"; } else { result += "{id:'" + dic_temp.Get <string>("GroupID") + "',text:'" + dic_temp.Get <string>("Name") + "',leaf:true}"; } i++; } result += "]"; Response.Write(result); Response.End(); break; case "Create": obj = Request["json"]; ent = JsonHelper.GetObject <SysUser>(obj); ent.Server_Seed = (ent.Server_Seed.IndexOf("江西瑞林建设监理有限公司") < 0 ? "江西瑞林建设监理有限公司" : "") + ent.Server_Seed; ent.LoginName = ent.IDNumber; ent.Password = encrypt.GetMD5FromString(ent.LoginName); ent.DoCreate(); Response.Write("{success:true}"); Response.End(); break; case "Update": obj = Request["json"]; ent = JsonHelper.GetObject <SysUser>(obj); SysUser ori_Ent = SysUser.Find(ent.UserID); EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(obj); ent = DataHelper.MergeData <SysUser>(ori_Ent, ent, dic.Keys); ent.Password = encrypt.GetMD5FromString(ent.LoginName); ent.Server_Seed = (ent.Server_Seed.IndexOf("江西瑞林建设监理有限公司") < 0 ? "江西瑞林建设监理有限公司" : "") + ent.Server_Seed; ent.DoUpdate(); Response.Write("{success:true}"); Response.End(); break; case "SelectEdit": SelectEdit(); break; case "check": Check(); break; } }
protected void Page_Load(object sender, EventArgs e) { try { Aim.Portal.Web.WebPortalService.CheckLogon(); } catch { Response.Write("<script> window.parent.location.href = '/Login.aspx';</script>"); Response.End(); } string action = Request["action"]; SysGroup sgEnt = null; SysUser suEnt = null; IList <SysUser> suEnts = null; string sql = ""; DataTable dt = null; string where = ""; MD5Encrypt encrypt = new MD5Encrypt(); switch (action) { case "sync": string connstr = ConfigurationManager.ConnectionStrings["NimsConn"].ToString(); OracleConnection conn = new OracleConnection(connstr); sql = "select * from apps.cux_hr_org_structrue_v where ORG_ID_CHILD='228' or org_id_parent='228'"; OracleCommand com = new OracleCommand(sql, conn); OracleDataAdapter da = new OracleDataAdapter(com); DataSet ds = new DataSet(); da.Fill(ds); //首先同步部门信息 foreach (DataRow dr in ds.Tables[0].Rows) { sgEnt = SysGroup.TryFind(dr["ORG_ID_CHILD"] + ""); if (sgEnt == null) //如果不存在该部门 { //此处将PATH字段用来存储父部门的名称 sql = "insert into SysGroup (GroupID,Name,Code,ParentID,Path,Status) values('{0}','{1}','{2}','{3}','{4}',1)"; sql = string.Format(sql, dr["ORG_ID_CHILD"], dr["ORG_NAME_CHILD"], dr["ORG_CODE_CHILD"], dr["ORG_ID_PARENT"], dr["ORG_NAME_PARENT"]); DataHelper.ExecSql(sql); } else { sql = "update SysGroup set Name='{0}',Code='{1}',ParentID='{2}',Path='{3}' where GroupID='{4}'"; sql = string.Format(sql, dr["ORG_NAME_CHILD"], dr["ORG_CODE_CHILD"], dr["ORG_ID_PARENT"], dr["ORG_NAME_PARENT"], dr["ORG_ID_CHILD"]); DataHelper.ExecSql(sql); } } //同步人员信息 sql = @"select * from apps.cux_hr_employee_v where ORG_ID in (select ORG_ID_CHILD from apps.cux_hr_org_structrue_v where ORG_ID_CHILD='228' or org_id_parent='228') and primary_flag='Y'"; com = new OracleCommand(sql, conn); da = new OracleDataAdapter(com); ds = new DataSet(); da.Fill(ds); SqlConnection conn_sql = new SqlConnection(); conn_sql.ConnectionString = ConfigurationManager.AppSettings["Con_Portal"]; conn_sql.Open(); foreach (DataRow dr in ds.Tables[0].Rows) { suEnts = SysUser.FindAllByProperty(SysUser.Prop_IDNumber, dr["NATIONAL_IDENTIFIER"]); //通过身份证就行匹配 if (suEnts.Count == 0) { sql = @"insert into SysUser (UserID,LoginName,Name,Password,Email,Phone,HomePhone,Sex,IDNumber,Server_IAGUID,Server_Seed,Status,CreateDate) values(@UserID,@LoginName,@Name,@Password,@Email,@Phone,@HomePhone,@Sex,@IDNumber,@Server_IAGUID,@Server_Seed,@Status,@CreateDate)"; SqlParameter[] sparray = new SqlParameter[13]; sparray[0] = new SqlParameter("@UserID", dr["PERSON_ID"]); sparray[1] = new SqlParameter("@LoginName", dr["EMP_NUM"]);//NIMS数据库工号是不能为空的 即进入的NIMS系统的员工工号是肯定有的 sparray[2] = new SqlParameter("@Name", dr["LAST_NAME"]); sparray[3] = new SqlParameter("@Password", encrypt.GetMD5FromString(dr["SYS_ACCOUNT"].ToString())); sparray[4] = new SqlParameter("@Email", dr["EMAIL_ADDRESS"]); sparray[5] = new SqlParameter("@Phone", dr["MOBILE_PHONE_NUMBER"]); sparray[6] = new SqlParameter("@HomePhone", dr["OFFICE_PHONE_NUMBER"]); sparray[7] = new SqlParameter("@Sex", dr["SEX"]); sparray[8] = new SqlParameter("@IDNumber", dr["NATIONAL_IDENTIFIER"]); sparray[9] = new SqlParameter("@Server_IAGUID", dr["ORG_ID"]); sparray[10] = new SqlParameter("@Server_Seed", dr["ORG_NAME"]); sparray[11] = new SqlParameter("@Status", SqlDbType.TinyInt); sparray[11].Value = 1; sparray[12] = new SqlParameter("@CreateDate", dr["HIRE_DATE"]); SqlCommand com_sql = new SqlCommand(sql, conn_sql); com_sql.Parameters.AddRange(sparray); com_sql.ExecuteNonQuery(); } else { sql = @"update SysUser set LoginName=@LoginName,Name=@Name,Email=@Email,Phone=@Phone,HomePhone=@HomePhone, Sex=@Sex,Server_IAGUID=@Server_IAGUID,Server_Seed=@Server_Seed,CreateDate=@CreateDate where IDNumber=@IDNumber"; SqlParameter[] sparray = new SqlParameter[10]; sparray[0] = new SqlParameter("@LoginName", dr["EMP_NUM"]); sparray[1] = new SqlParameter("@Name", dr["LAST_NAME"]); sparray[2] = new SqlParameter("@Email", dr["EMAIL_ADDRESS"]); sparray[3] = new SqlParameter("@Phone", dr["MOBILE_PHONE_NUMBER"]); sparray[4] = new SqlParameter("@HomePhone", dr["OFFICE_PHONE_NUMBER"]); sparray[5] = new SqlParameter("@Sex", dr["SEX"]); sparray[6] = new SqlParameter("@Server_IAGUID", dr["ORG_ID"]); sparray[7] = new SqlParameter("@Server_Seed", dr["ORG_NAME"]); sparray[8] = new SqlParameter("@CreateDate", dr["HIRE_DATE"]); sparray[9] = new SqlParameter("@IDNumber", dr["NATIONAL_IDENTIFIER"]); SqlCommand com_sql = new SqlCommand(sql, conn_sql); com_sql.Parameters.AddRange(sparray); com_sql.ExecuteNonQuery(); } } conn_sql.Close(); Response.Write("{success:true}"); Response.End(); break; case "inipsd": suEnt = SysUser.Find(Request["UserId"]); suEnt.Password = encrypt.GetMD5FromString(suEnt.LoginName); suEnt.DoUpdate(); Response.Write("{success:true}"); Response.End(); break; case "loadtreedata": string id = Request["id"]; sql = "select GroupID as id,replace(Name,'江西瑞林建设监理有限公司','') as name,1 as leaf from SysGroup where ParentId='" + id + "' order by Code asc"; dt = DataHelper.QueryDataTable(sql); Response.Write(JsonHelper.GetJsonStringFromDataTable(dt)); Response.End(); break; case "loaduser": string groupid = Request["groupid"]; if (!string.IsNullOrEmpty(Request["name_workno"])) { where += " and (LoginName like '%" + Request["name_workno"] + "%' or Name like '%" + Request["name_workno"] + "%')"; } if (!string.IsNullOrEmpty(Request["UserType"])) { where += " and UserType='" + Request["UserType"] + "'"; } if (!string.IsNullOrEmpty(Request["Status"])) { where += " and Status='" + Request["Status"] + "'"; } if (string.IsNullOrEmpty(groupid) || groupid == "228") { sql = @"select UserID as UserId,Name,LoginName,Sex,Phone,Replace(Server_Seed,'江西瑞林建设监理有限公司','') as Server_Seed, HomePhone,IDNumber,CreateDate from SysUser where (Server_Seed like '%江西瑞林建设监理有限公司%' ) " + where; } else { sql = @"select UserID as UserId,Name,LoginName,Sex,Phone,Replace(Server_Seed,'江西瑞林建设监理有限公司','') as Server_Seed, HomePhone,IDNumber,CreateDate from SysUser where Server_Seed like '%江西瑞林建设监理有限公司%' and Server_IAGUID='" + groupid + "'" + where; } dt = DataHelper.QueryDataTable(sql); Response.Write("{'rows':" + JsonHelper.GetJsonStringFromDataTable(dt) + ",total:'" + totalProperty + "'}"); Response.End(); break; } }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.Files.Count > 0) { string guid = Guid.NewGuid().ToString(); string filePath = "//WorkTime//InputExcelFiles//" + Guid.NewGuid().ToString() + System.IO.Path.GetExtension(Request.Files[0].FileName); this.Request.Files[0].SaveAs(Server.MapPath(filePath)); ExcelProcessor ep = ExcelService.GetProcessor(Server.MapPath(filePath)); DataSet ds = ep.GetDataSet(); InputDatas(ds.Tables[0]); Response.Write("{success:true}"); Response.End(); } id = RequestData.Get <string>("id", String.Empty); type = RequestData.Get <string>("type", String.Empty); SysUser usr = null; switch (this.RequestAction) { case RequestActionEnum.Create: usr = this.GetPostedData <SysUser>(); usr.DoCreate(); this.SetMessage("新建成功!"); break; case RequestActionEnum.Update: usr = this.GetMergedData <SysUser>(); usr.DoUpdate(); this.SetMessage("保存成功!"); break; case RequestActionEnum.Delete: usr = this.GetTargetData <SysUser>(); usr.DoDelete(); this.SetMessage("删除成功!"); break; default: if (RequestActionString == "clearpass") { usr = SysUser.Find(this.RequestData.Get <string>("UserId")); usr.Password = ""; usr.Remark = ""; usr.Save(); } else if (RequestActionString == "setpass") { MD5Encrypt encrypt = new MD5Encrypt(); SysUser[] users = SysUser.FindAll(); foreach (SysUser user in users) { Random rnd = new Random(); int rndNum = rnd.Next(10000000, 99999999); string encryPassword = encrypt.GetMD5FromString(rndNum.ToString()); user.Password = encryPassword; user.Remark = rndNum.ToString(); user.Save(); } } else if (RequestActionString == "checkkey") { if (SysUser.FindAllByProperties("Server_IAGUID", this.RequestData.Get <string>("usbguid")).Length > 0) { this.PageState.Add("UserName", SysUser.FindAllByProperties("Server_IAGUID", this.RequestData.Get <string>("usbguid"))[0].Name); } else { this.PageState.Add("UserName", ""); } } else if (RequestActionString == "setkey") { SysUser user = SysUser.Find(this.RequestData.Get <string>("userid")); user.Server_IAGUID = this.RequestData.Get <string>("usbguid"); user.Server_Seed = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"; user.ThreeDESKEY = "ABCDEFGhijklmn0123456789"; user.Save(); } else if (RequestActionString == "sendmail") { IList <object> idList = RequestData.GetList <object>("IdList"); SysUser[] tents = SysUser.FindAll(Expression.In("UserID", idList.ToArray())); foreach (SysUser user in tents) { string body = SysParameter.FindAllByProperties("Code", "MailText")[0].Description + "<br>"; body += "您的登录用户名:" + user.LoginName + ";密码:" + user.Remark; string mailAccount = SysParameter.FindAllByProperties("Code", "MailAccount")[0].Value; string mailPass = SysParameter.FindAllByProperties("Code", "MailPassword")[0].Value; string mailServer = SysParameter.FindAllByProperties("Code", "MailSmtpServer")[0].Value; string mailSenderAddress = SysParameter.FindAllByProperties("Code", "MailSenderAddress")[0].Value; MailHelper.SendMail(mailSenderAddress, user.Email, "工时分配系统邮件", body, mailAccount, mailPass, mailServer); } } else { SearchCriterion.AutoOrder = false; SearchCriterion.SetOrder(SysUser.Prop_WorkNo); string dName = SearchCriterion.GetSearchValue <string>("Name"); string workNo = SearchCriterion.GetSearchValue <string>("WorkNo"); SearchCriterion.SetOrder(SysUser.Prop_WorkNo); if (dName != null && dName.Trim() != "") { string where = "select * from SysUser where " + GetPinyinWhereString("Name", dName); where += " and WorkNo like '%" + workNo + "%'"; this.PageState.Add("UsrList", DataHelper.QueryDictList(where)); } else { users = SysUserRule.FindAll(SearchCriterion); this.PageState.Add("UsrList", users); } } break; } }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.Files.Count > 0) { string guid = Guid.NewGuid().ToString(); string filePath = "//WorkTime//InputExcelFiles//" + Guid.NewGuid().ToString() + System.IO.Path.GetExtension(Request.Files[0].FileName); this.Request.Files[0].SaveAs(Server.MapPath(filePath)); ExcelProcessor ep = ExcelService.GetProcessor(Server.MapPath(filePath)); DataSet ds = ep.GetDataSet(); string exMessage = ""; workNumbers = ""; try { InputDatasV2(ds.Tables[0]); } catch (Exception ex) { exMessage = ex.Message; } if (workNumbers != "") { Response.Write("{success:false,message:'" + workNumbers + "'}"); Response.End(); } else { Response.Write("{success:true}"); Response.End(); } } id = RequestData.Get <string>("id", String.Empty); type = RequestData.Get <string>("type", String.Empty); SysUser usr = null; switch (this.RequestAction) { case RequestActionEnum.Create: usr = this.GetPostedData <SysUser>(); usr.DoCreate(); this.SetMessage("新建成功!"); break; case RequestActionEnum.Update: usr = this.GetMergedData <SysUser>(); usr.DoUpdate(); this.SetMessage("保存成功!"); break; case RequestActionEnum.Delete: usr = this.GetTargetData <SysUser>(); usr.DoDelete(); this.SetMessage("删除成功!"); break; default: if (RequestActionString == "clearpass") { usr = SysUser.Find(this.RequestData.Get <string>("UserId")); usr.Password = ""; usr.Save(); } else { SearchCriterion.AutoOrder = false; SearchCriterion.SetOrder(SysUser.Prop_WorkNo); string dName = SearchCriterion.GetSearchValue <string>("Name"); if (dName != null && dName.Trim() != "") { string where = "select * from SysUser where " + GetPinyinWhereString("Name", dName); this.PageState.Add("UsrList", DataHelper.QueryDictList(where)); } else { users = SysUserRule.FindAll(SearchCriterion); this.PageState.Add("UsrList", users); } } break; } }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); switch (RequestActionString) { case "update": ent = GetMergedData <IntegratedConfig>(); ent.DoUpdate(); break; case "create": ent = GetPostedData <IntegratedConfig>(); ent.DoCreate(); break; case "AddLeader": IList <string> userIds = RequestData.GetList <string>("UserIds"); IList <InstituteLeader> ilEnts = new List <InstituteLeader>(); foreach (string userId in userIds) { ilEnt = new InstituteLeader(); ilEnt.UserId = userId; ilEnt.UserName = SysUser.Find(userId).Name; string sql = @"select top 1 case [Type] when 3 then ParentDeptName when 2 then ChildDeptName end as DeptName, case [Type] when 3 then ParentId when 2 then DeptId end as DeptId from View_SysUserGroup where UserId='{0}'"; sql = string.Format(sql, userId); IList <EasyDictionary> deptDics = DataHelper.QueryDictList(sql); if (deptDics.Count > 0) { ilEnt.DeptId = deptDics[0].Get <string>("DeptId"); ilEnt.DeptName = deptDics[0].Get <string>("DeptName"); } ilEnt.DoCreate(); ilEnts.Add(ilEnt); } PageState.Add("ilEnts", ilEnts); break; case "UpdateSortIndex": ilEnt = InstituteLeader.Find(RequestData.Get <string>("InstituteLeaderId")); ilEnt.SortIndex = RequestData.Get <int>("SortIndex"); ilEnt.DoUpdate(); break; case "UpdateUser": suEnt = SysUser.Find(RequestData.Get <string>("UserId")); suEnt.Email = RequestData.Get <string>("Email"); suEnt.Phone = RequestData.Get <string>("Phone"); suEnt.DoUpdate(); break; case "delete": IList <string> instituteLeaderIds = RequestData.GetList <string>("InstituteLeaderIds"); foreach (string instituteLeaderId in instituteLeaderIds) { ilEnt = InstituteLeader.Find(instituteLeaderId); ilEnt.DoDelete(); } break; default: DoSelect(); break; } }