/// <summary> /// 根据PCode获得人员真实名字 /// </summary> /// <param name="PCode"></param> /// <returns></returns> public string GetRealNameByPCode(string PCode) { string str = "Staff_Code='" + PCode + "'"; LabMS.BLL.Staff Bt = new LabMS.BLL.Staff(); List<LabMS.Model.Staff> listT = new List<LabMS.Model.Staff>(); listT = Bt.GetModelList(str); if (listT.Count <= 0) { return ""; } else { return listT[0].Staff_Name; } }
//��ȡStaffID protected int GetStaffIDCodeByUserID(int ID) { LabMS.BLL.UserTable usertable = new LabMS.BLL.UserTable(); LabMS.Model.UserTable usertableModel = new LabMS.Model.UserTable(); LabMS.BLL.Staff staff = new LabMS.BLL.Staff(); List<LabMS.Model.Staff> staffModelList = new List<LabMS.Model.Staff>(); usertableModel = usertable.GetModel(ID); staffModelList = staff.GetModelList("Staff_Code='" + usertableModel.PCode + "'"); if (staffModelList.Count > 0) { return staffModelList[0].ID; } else return 0; }
protected override void OnPreInit(EventArgs e) { if (PrivilegeManager.GetCurrentUserInfo()) { bool bwrong = false; try { UserName = System.Web.HttpContext.Current.Session["UserName"].ToString(); UserID = System.Web.HttpContext.Current.Session["UserID"].ToString(); UserCode = System.Web.HttpContext.Current.Session["UserCode"].ToString(); UserType = System.Web.HttpContext.Current.Session["UserType"].ToString(); if (UserType == "mana") { listFunction = System.Web.HttpContext.Current.Session["UserPrivilege"] as List<LabMS.Model.Function>; if (UserName == "admin") { listModule = bModule.GetModelList(""); listPlate = bPlate.GetModelList(""); } else { if (System.Web.HttpContext.Current.Session["UserModule"] != null) { listModule = System.Web.HttpContext.Current.Session["UserModule"] as List<LabMS.Model.Module>; } else { listModule = ExtendBLL.Privilege.GetManaModuleByUserID(UserID); System.Web.HttpContext.Current.Session["UserModule"] = listModule; } if (System.Web.HttpContext.Current.Session["UserPlate"] != null) { listPlate = System.Web.HttpContext.Current.Session["UserPlate"] as List<LabMS.Model.Plate>; } else { listPlate = ExtendBLL.Privilege.GetManaPlateByUserID(UserID); LabMS.Model.Plate mp = new LabMS.Model.Plate(); bool bhas = false; foreach (LabMS.Model.Plate p in listPlate) { if (p.Name == "日常办公") { bhas = true; break; } } if (!bhas) { mp.Name = "日常办公"; mp.PageAddress = "Structure/DailyOffice.aspx"; listPlate.Add(mp); } System.Web.HttpContext.Current.Session["UserPlate"] = listPlate; } } } UserRealName = UserName; if (System.Web.HttpContext.Current.Session["UserType"].ToString().Equals("mana")) { if (UserCode == "") { UserRealName = UserName; } else { if (System.Web.HttpContext.Current.Session["UserRealName"] != null) { UserRealName = System.Web.HttpContext.Current.Session["UserRealName"].ToString(); } else { LabMS.BLL.Staff bstaff = new LabMS.BLL.Staff(); List<LabMS.Model.Staff> listStaff = new List<LabMS.Model.Staff>(); listStaff = bstaff.GetModelList(" Staff_Code = '" + UserCode + "'"); if (listStaff.Count > 0) { UserRealName = listStaff[0].Staff_Name; } System.Web.HttpContext.Current.Session["UserRealName"] = UserRealName; } } } } catch { bwrong = true; } if (bwrong) { Response.Redirect("~/login.aspx"); } } else { Response.Redirect("~/login.aspx"); } base.OnPreInit(e); }
/// <summary> /// 根据用户表里面的PCode获得人员表里面的人员名称 /// </summary> /// <param name="PCode"></param> /// <returns></returns> public string SerachRealName(string PCode) { string str="Staff_Code='"+PCode+"'"; LabMS.BLL.Staff bStaff = new LabMS.BLL.Staff(); List<LabMS.Model.Staff> list = new List<LabMS.Model.Staff>(); list = bStaff.GetModelList(str); if (list.Count <= 0) { return ""; } else { return list[0].Staff_Name; } }