/// <summary> /// ��������б� /// </summary> public List<LabMS.Model.Plate> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List<LabMS.Model.Plate> modelList = new List<LabMS.Model.Plate>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { LabMS.Model.Plate model; for (int n = 0; n < rowsCount; n++) { model = new LabMS.Model.Plate(); if(ds.Tables[0].Rows[n]["ID"].ToString()!="") { model.ID=int.Parse(ds.Tables[0].Rows[n]["ID"].ToString()); } model.Code=ds.Tables[0].Rows[n]["Code"].ToString(); model.Name=ds.Tables[0].Rows[n]["Name"].ToString(); model.PageAddress=ds.Tables[0].Rows[n]["PageAddress"].ToString(); modelList.Add(model); } } return modelList; }
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); }