public bool AddOrg(b01 org, b01Expansion orge) { CQGJPassportEntities CQGJ = new CQGJPassportEntities(); orge.b01 = org; if (org.b0111 == orge.b01.b0111) { try { CQGJ.AddTob01(org); CQGJ.AddTob01Expansion(orge); CQGJ.SaveChanges(); return true; } catch { } } return false; }
/// <summary> /// 添加用户-负责数据库保存 /// </summary> /// <param name="id"></param> public ActionResult CreateUser(string id) { CQGJUserViewData viewData = new CQGJUserViewData(); User user = new User(); //user.UserID = Request.Form["UserID"].ToString(); user.Username = Request.Form["UserName"].ToString(); user.Remark = Request.Form["AdminRemark"].ToString(); try { user.Status = int.Parse(Request.Form["AdminStatus"].ToString()); } catch { } user.Birthday = DateTime.Parse(Request.Form["Birthday"].ToString()); user.Cellphone = Request.Form["Cellphone"].ToString(); //user.COUPost = Request.Form["COUPost"].ToString(); //user.Degree = Request.Form["Degree"].ToString(); //user.Description = Request.Form["Description"].ToString(); //user.Edu = Request.Form["Edu"].ToString(); //user.Email = Request.Form["Email"].ToString(); user.Gender = Request.Form["Gender"].ToString(); user.IDCard = Request.Form["IDCard"].ToString(); if (HttpContext.Session["Photo"] != null && HttpContext.Session["PhotoType"] != null) { user.PhotoType = HttpContext.Session["PhotoType"].ToString(); user.Photo = (byte[])HttpContext.Session["Photo"]; } user.Password = Security.MD5Encrypt(Request.Form["userPassword"].ToString()); try { user.JoinWorkDate = DateTime.Parse(Request.Form["JoinWorkDate"].ToString()); } catch { } user.Nation = Request.Form["Nation"].ToString(); //user.OtherLink = Request.Form["OtherLink"].ToString(); //user.Password = Request.Form["OtherLink"].ToString(); user.Politics = Request.Form["Politics"].ToString(); user.Position = Request.Form["Position"].ToString(); user.WorkTel = Request.Form["WorkTel"].ToString(); user.RelationsName = Request.Form["OrgName"].ToString(); user.RelationsCode = Request.Form["OrgCode"].ToString(); try { user.Class = (Request.Form["Level"].ToString()); } catch { } CQGJ.AddToUser(user); CQGJ.SaveChanges(true); viewData.User = user; viewData.ActionSuccess = true; viewData.JavaScriptPage = "添加人员:" + user.Username; //调用webservers CQGJAP.CQGJWebServices ap = new CQGJ.Passport.CQGJAP.CQGJWebServices(); ap.AddUser(user.UserID); var querry = from b in CQGJ.b01 where b.b0111 == id select b; b01 Org = new b01(); try { Org = querry.First(); } catch { //错误 } UsersInOrgs userinorg = new UsersInOrgs(); userinorg.User = viewData.User; userinorg.b0111 = Org.b0111; CQGJ.AddToUsersInOrgs(userinorg); CQGJ.SaveChanges(true); viewData.HtmlPage = user.Username + "添加功,请添加" + Org.b0104 + "中的职务信息"; viewData.JavaScriptPage = "/admin/OrgUserAdd/" + user.UserID + "/" + Org.b0111; return View("MessagePage", viewData); }
public ActionResult CreateOrg() { CQGJUserViewData viewData = new CQGJUserViewData(); b01 Org = new b01(); b01Expansion OrgE = new b01Expansion(); int orgType = int.Parse(GetString("OrgType")); Org.b0101 = GetString("b0101"); Org.b0104 = GetString("b0104"); Org.b0107 = GetString("b0107"); //Org.b0111 = GetString("b0111"); Org.b0111_1 = GetString("b0111_1"); Org.b0111_3 = GetString("b0111_3"); Org.b0114 = GetString("b0114"); Org.b0117 = GetString("b0117"); Org.b01224 = GetString("b01224"); Org.b0127 = GetString("b0127"); Org.b0131 = GetString("b0131"); Org.b0134 = GetString("b0134"); Org.b0137 = GetString("b0137"); Org.b0144_1 = GetString("b0144_1"); Org.b0144_2 = GetString("b0144_2"); Org.b0151_1 = GetString("b0151_1"); Org.b0151_2 = GetString("b0151_2"); Org.b0154_1 = GetString("b0154_1"); Org.b0154_2 = GetString("b0154_2"); Org.b0157_1 = GetString("b0157_1"); Org.b0157_2 = GetString("b0157_2"); Org.b0161 = GetString("b0161"); Org.b0164 = GetDate("b0164"); Org.b0167 = GetString("b0167"); Org.b0171_1 = GetString("b0171_1"); Org.b0171_2 = GetString("b0171_2"); Org.b0174 = GetString("b0174"); Org.b0177 = GetString("b0177"); Org.b0181 = GetDate("b0181"); Org.b0184 = GetString("b0184"); Org.b0187_1 = GetString("b0187_1"); Org.b0187_2 = GetString("b0187_2"); Org.b0191 = GetString("b0191"); Org.b0194 = GetString("b0194"); Org.b0197 = GetString("b0197"); Org.b0199 = GetString("b0199"); if (orgType != 0) { Org.b0111 = GetString("b0111"); } else { //Org.b0111 = GetString("b0111"); } CQGJ.AddTob01(Org); CQGJ.SaveChanges(true); OrgE.b01 = Org; OrgE.Password = Security.MD5Encrypt("123456"); OrgE.OrgType = orgType; CQGJ.AddTob01Expansion(OrgE); CQGJ.SaveChanges(true); viewData.ActionSuccess = true; viewData.HtmlPage = "单位:" + Org.b0104 + "添加成功。"; viewData.JavaScriptPage = "/admin/OrgInfo/" + Org.b0111; //调用webservers CQGJAP.CQGJWebServices ap = new CQGJ.Passport.CQGJAP.CQGJWebServices(); ap.AddOrg(Org.b0111); return View("MessagePage", viewData); }
public bool IsUpOrg(b01 b, string orgCode) { try { CQGJPassportEntities CQGJ = new CQGJPassportEntities(); b01 Org = (from o in CQGJ.b01 where o.b0111 == orgCode select o).First(); if ((b.b0111.Length == 14 && b.b0111 == orgCode.Substring(0, 14)) || (Org.b0111_3 == b.b0111)) { return true; } } catch { return false; } return false; }
public bool IsOwnerOrg(b01 b, string orgCode) { try { if ((b.b0111.Length > 14 && b.b0111.Substring(0, 14) == orgCode) || b.b0111_3 == orgCode) { return true; } } catch { return false; } return false; }
public void CreateAllOwnedOrgHtml(ref string OrgHtml, string orgCode, string urlPath) { try { CQGJPassportEntities CQGJ = new CQGJPassportEntities(); List<b01> OrgListTemp = new List<b01>(); List<Area> AreaList = new List<Area>(); b01 Org = new b01(); Area area = new Area(); if (orgCode == "") { //重庆市直属单位 OrgListTemp = (from b in CQGJ.b01 where b.b0111.Length == 14 where (b.b0111_3 == null || b.b0111_3 == "") where b.b0117 == "50000000" select b).ToList(); //重庆市各辖区 AreaList = (from a in CQGJ.Area where a.AreaType == 2 select a).ToList(); //Org = (from b in CQGJ.b01 // where b.b0111 == "50000000100016" // select b).First(); } else if (orgCode.Length == 8) { //构造某一辖区下一级单位 OrgListTemp = (from b in CQGJ.b01 where b.b0117 == orgCode where b.b0111.Length == 14 where (b.b0111_3 == null || b.b0111_3 == "") select b).ToList(); //Org = (from b in CQGJ.b01 // where b.b0111 == "50010100100001" // select b).First(); area = (from a in CQGJ.Area where a.AreaCode == orgCode select a).FirstOrDefault(); } else { OrgListTemp = (from b in CQGJ.b01 where (b.b0111.Length == 16 && b.b0111.Substring(0, 14) == orgCode) || (b.b0111_3 == orgCode) select b).ToList(); Org = (from b in CQGJ.b01 where b.b0111 == orgCode select b).First(); } if (OrgListTemp.Count == 0) { OrgHtml += "<li><span class='file'><a target='passportmainFrame' href='/admin/" + urlPath + "/" + Org.b0111 + "' >" + Org.b0104 + "</a></span></li>"; return; } else { //普通单位 if (orgCode.Length == 14) { string htmlTemp = ""; OrgHtml += "<li><span class='folder'><a target='passportmainFrame' href='/admin/" + urlPath + "/" + Org.b0111 + "' >" + Org.b0104 + "</a></span>"; if (OrgHtml != "") { //iCount ++; //OrgHtml += "<ul id='folder2" + iCount.ToString() + ">"; OrgHtml += "<ul>"; htmlTemp = "</ul>"; } for (int i = 0; i < OrgListTemp.Count; ++i) { CreateAllOwnedOrgHtml(ref OrgHtml, OrgListTemp[i].b0111, urlPath); } OrgHtml += htmlTemp; OrgHtml += "</li>"; } //市辖区 else if (orgCode.Length == 8) { string htmlTemp = ""; OrgHtml += "<li><span class='folder'>" + area.AreaName + "</span>"; if (OrgHtml != "") { OrgHtml += "<ul>"; htmlTemp = "</ul>"; } for (int i = 0; i < OrgListTemp.Count; ++i) { CreateAllOwnedOrgHtml(ref OrgHtml, OrgListTemp[i].b0111, urlPath); } OrgHtml += htmlTemp; OrgHtml += "</li>"; } //重庆市 else if (orgCode.Length == 0) { for (int i = 0; i < OrgListTemp.Count; ++i) { CreateAllOwnedOrgHtml(ref OrgHtml, OrgListTemp[i].b0111, urlPath); } } } //生成各辖区节点代码 if (AreaList.Count != 0) { string htmlTemp = ""; OrgHtml += "<li><span class='folder'>市辖区</a></span>"; if (OrgHtml != "") { //iCount ++; //OrgHtml += "<ul id='folder2" + iCount.ToString() + ">"; OrgHtml += "<ul>"; htmlTemp = "</ul>"; } for (int i = 0; i < AreaList.Count; ++i) { CreateAllOwnedOrgHtml(ref OrgHtml, AreaList[i].AreaCode, urlPath); } OrgHtml += htmlTemp; OrgHtml += "</li>"; } } catch { } }
public string ValidateOrg(string orgname, string password) { CQGJPassportEntities CQGJ = new CQGJPassportEntities(); b01 Querry = new b01(); string strResult = ""; try { Querry = (from b in CQGJ.b01 where (b.b0101 == orgname || b.b0104 == orgname) select b).First(); strResult = Querry.b0111; } catch { strResult = ""; } if (strResult.Equals("")) { return strResult; } else { b01Expansion OrgOtherInfo = new b01Expansion(); try { OrgOtherInfo = (from i in CQGJ.b01Expansion where i.b01.b0111 == strResult && i.Password == password select i).First(); } catch { strResult = ""; } } return strResult; }
public bool SaveOrgChange(b01 Org, b01Expansion OrgEx) { OrgEx.b01 = Org; CQGJPassportEntities CQGJ = new CQGJPassportEntities(); b01 newOrg = (from c in CQGJ.b01 where c.b0111 == Org.b0111 select c).First(); b01Expansion newOrgEx = (from d in CQGJ.b01Expansion where d.ID == OrgEx.ID select d).First(); newOrg.b0101 = Org.b0101; newOrgEx.Mail = OrgEx.Mail; newOrgEx.Mobile = OrgEx.Mobile; newOrgEx.Tel = OrgEx.Tel; if (newOrgEx.b01==newOrg) { int i= CQGJ.SaveChanges(); return true; } return false; }
public b01 GetUpOrgOneLevel(string orgCode) { b01 org = new b01(); Global globa = new Global(); org = globa.GetUpOrgOnelevel(orgCode); return org; }