public AdminBLL() { rd = new RoleDAL(); pd = new PermissionsDAL(); ad = new AdminDAL(); dd = new DealerBLL(); sd = new StoreBLL(); }
protected void LinkButtonPromeni_Click(object sender, EventArgs e) { bool flag = false; for (int index = 0; index < this.CheckBoxListUser.Items.Count; ++index) { if (this.CheckBoxListUser.Items[index].Selected) { flag = true; break; } } if (!flag) { return; } List <WEBSERVICE> list = (List <WEBSERVICE>) this.Session["ListWSUser"]; HelpClassUsers helpClassUsers = (HelpClassUsers)this.Application["UserPermission"]; INSTITUTION byId1 = new InstitutionsDAL().GetByID(helpClassUsers.IDInstitution); USER byId2 = new UsersDAL().GetByID(helpClassUsers.ID); KeyValuePair <int, string> keyValuePair; for (int i = 0; i < this.CheckBoxListUser.Items.Count; ++i) { if (this.CheckBoxListUser.Items[i].Selected) { try { Enumerable.Single <WEBSERVICE>((IEnumerable <WEBSERVICE>)list, (Func <WEBSERVICE, bool>)(p => p.ID == Convert.ToInt64(this.CheckBoxListUser.Items[i].Value))); } catch { WEBSERVICE byId3 = new WebservicesDAL().GetByID(Convert.ToInt64(this.CheckBoxListUser.Items[i].Value)); long num = new PermissionsDAL().Insert(byId1, byId2, byId3, 2, true, DateTime.Now); string old = ""; string newone = ""; keyValuePair = Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "PERMISSIONS")); new LOGDAL().Insert(keyValuePair.Key, (USER)this.Session["user"], num.ToString(), 1, DateTime.Now, old, newone); } } else { try { WEBSERVICE ws = Enumerable.Single <WEBSERVICE>((IEnumerable <WEBSERVICE>)list, (Func <WEBSERVICE, bool>)(p => p.ID == Convert.ToInt64(this.CheckBoxListUser.Items[i].Value))); PERMISSION permission = Enumerable.Single <PERMISSION>((IEnumerable <PERMISSION>)helpClassUsers.PermissionList, (Func <PERMISSION, bool>)(p => p.ID_WS == ws.ID && p.Usage == 2)); new PermissionsDAL().Update((INSTITUTION)null, (USER)null, (WEBSERVICE)null, new int?(), new bool?(false), new DateTime?(), permission.ID); string old = ""; string newone = ""; keyValuePair = Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "PERMISSIONS")); new LOGDAL().Insert(keyValuePair.Key, (USER)this.Session["user"], permission.ID.ToString(), 2, DateTime.Now, old, newone); } catch { } } } }
protected void PanelUsers_Load(object sender, EventArgs e) { INSTITUTION objectInstitution = (INSTITUTION)this.Session["LocalSelectedInstitution"]; List <PERMISSION> permisionsByUser = new PermissionsDAL().GetPermisionsByUser((USER)this.Session["user"]); if (objectInstitution.ID != permisionsByUser[0].INSTITUTION.ID) { return; } this.FillPanelUsers(objectInstitution); }
protected void Gridview2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteWS") { long num = Convert.ToInt64(((WebControl)e.CommandSource).Attributes["1"]); List <WEBSERVICE> list = (List <WEBSERVICE>) this.Application["ListWSUser"]; using (List <WEBSERVICE> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { WEBSERVICE c = enumerator.Current; if (c.ID == num) { HelpClassUsers helpClassUsers = (HelpClassUsers)this.Application["UserPermission"]; if (helpClassUsers.PermissionList.Count > 1) { list.Remove(c); PERMISSION permission = Enumerable.First <PERMISSION>((IEnumerable <PERMISSION>)helpClassUsers.PermissionList, (Func <PERMISSION, bool>)(p => p.ID_WS == c.ID && p.Usage == 2 && p.Active)); new PermissionsDAL().Update((INSTITUTION)null, (USER)null, (WEBSERVICE)null, new int?(), new bool?(false), new DateTime?(), permission.ID); string old = ""; string newone = ""; new LOGDAL().Insert(Enumerable.First <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "PERMISSIONS")).Key, (USER)this.Session["user"], permission.ID.ToString(), 2, DateTime.Now, old, newone); this.Application["ListUsersPermissionsPerm"] = (object)new UsersDAL().GetUsersInstitutionsPermissions(2, true); this.Application["UserPermission"] = (object)Enumerable.First <HelpClassUsers>((IEnumerable <HelpClassUsers>) this.Application["ListUsersPermissionsPerm"], (Func <HelpClassUsers, bool>)(p => p.ID == (Guid)this.Application["SelectedUser"])); break; } break; } } } this.Application["ListWSUser"] = (object)list; this.Gridview2.DataBind(); } else { if (!(e.CommandName == "InsertWS")) { return; } WEBSERVICE byId = new WebservicesDAL().GetByID(Convert.ToInt64(((WebControl)e.CommandSource).Attributes["1"])); List <WEBSERVICE> list = (List <WEBSERVICE>) this.Application["ListWSUser"]; list.Add(byId); this.Application["ListWSUser"] = (object)list; this.Gridview2.DataBind(); HelpClassUsers helpClassUsers = (HelpClassUsers)this.Application["UserPermission"]; long num = new PermissionsDAL().Insert(new InstitutionsDAL().GetByID(helpClassUsers.IDInstitution), new UsersDAL().GetByID(helpClassUsers.ID), byId, 2, true, DateTime.Now); string old = ""; string newone = ""; new LOGDAL().Insert(Enumerable.First <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "PERMISSIONS")).Key, (USER)this.Session["user"], num.ToString(), 1, DateTime.Now, old, newone); this.Application["ListUsersPermissionsPerm"] = (object)new UsersDAL().GetUsersInstitutionsPermissions(2, true); this.Application["UserPermission"] = (object)Enumerable.First <HelpClassUsers>((IEnumerable <HelpClassUsers>) this.Application["ListUsersPermissionsPerm"], (Func <HelpClassUsers, bool>)(p => p.ID == (Guid)this.Application["SelectedUser"])); } }
protected void LinkButton3_Click(object sender, EventArgs e) { List <interop.PERMISSION> permisionsByUser = new PermissionsDAL().GetPermisionsByUser((interop.USER) this.Session["user"]); List <HelpClassUsers> permissionsByInstitution = new UsersDAL().GetUsersPermissionsByInstitution(true, permisionsByUser[0].INSTITUTION); permissionsByInstitution.AddRange((IEnumerable <HelpClassUsers>) new UsersDAL().GetUsersPermissionsByInstitution(false, permisionsByUser[0].INSTITUTION)); this.Application["ListUsersPermissions"] = (object)permissionsByInstitution; this.CustomersGridView.DataSource = (object)permissionsByInstitution; this.CustomersGridView.DataBind(); this.ClearStyleSubmeni(); this.LinkButton3.CssClass = "subselected"; }
protected void LinkInst_Click(object sender, EventArgs e) { INSTITUTION byId = new InstitutionsDAL().GetByID(Convert.ToInt64(((Control)sender).ID.Remove(0, 8))); this.Session["LocalSelectedInstitution"] = (object)byId; List <PERMISSION> permisionsByUser = new PermissionsDAL().GetPermisionsByUser((USER)this.Session["user"]); if (byId.ID == permisionsByUser[0].INSTITUTION.ID) { this.FillPanelUsers(byId); } this.FillPanelServices(byId); }
protected void btn_vnesi_Click(object sender, EventArgs e) { try { if (this.DropDownList2.SelectedValue != "0") { bool active = true; long id = new WebservicesDAL().Insert(this.txtPName.Text, this.txtPDescription.Text, this.txtPNote.Text, this.txtPURL.Text, active, DateTime.Now); string old1 = this.txtPName.Text + ";" + this.txtPDescription.Text + ";" + this.txtPNote.Text + ";" + this.txtPURL.Text + ";" + active.ToString(); string newone1 = ""; new LOGDAL().Insert(Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "WEBSERVICES")).Key, (USER)this.Session["user"], id.ToString(), 1, DateTime.Now, old1, newone1); USER user = (USER)this.Session["user"]; INSTITUTION byId1 = new InstitutionsDAL().GetByID((long)Convert.ToInt32(this.DropDownList2.SelectedValue)); WEBSERVICE byId2 = new WebservicesDAL().GetByID(id); long num1 = new PermissionsDAL().Insert(byId1, user, byId2, 1, true, DateTime.Now); string old2 = ""; string newone2 = ""; new LOGDAL().Insert(Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "PERMISSIONS")).Key, (USER)this.Session["user"], num1.ToString(), 1, DateTime.Now, old2, newone2); List <PARAM> list = (List <PARAM>) this.Application["Params"]; KeyValuePair <int, string> keyValuePair = Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "PARAMS")); foreach (PARAM obj in list) { long num2 = new ParamsDAL().Insert(obj.Tittle, obj.Description, obj.MaxLength, obj.Type, byId2, true); string old3 = obj.Tittle + (object)";" + obj.Description + ";" + (string)(object)obj.MaxLength + ";" + (string)(object)obj.Type + ";" + true.ToString(); string newone3 = ""; new LOGDAL().Insert(keyValuePair.Key, (USER)this.Session["user"], num2.ToString(), 1, DateTime.Now, old3, newone3); } foreach (BASIS basis in (List <BASIS>) this.Session["ListOsnoviSelected"]) { Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "WEBSERVICESBASIS")); } this.ClearTxtBoxChange(); this.Application["Params"] = (object)null; this.Application["ListWebServices"] = (object)new WebservicesDAL().GetWebServicesInstitutionsPermissions(true); this.WSGridView.DataSource = (object)(List <HelpClassWebServices>) this.Application["ListWebServices"]; this.WSGridView.DataBind(); this.DropDownList3.SelectedIndex = -1; } this.PanelNewUser.CssClass = "content-box column-left closed-box"; this.PanelEditUser.CssClass = "content-box column-right closed-box"; } catch { } }
protected void btnPotvrdi_Click(object sender, EventArgs e) { HelpClassWebServices classWebServices = (HelpClassWebServices)this.Application["TempWebService"]; List <HelpClassUsers> webServiceAndUsage = new UsersDAL().GetUsersByWebServiceAndUsage(classWebServices.ID, 1); bool flag1 = false; if (webServiceAndUsage.Count != 0) { foreach (HelpClassUsers helpClassUsers in webServiceAndUsage) { USER user = new UsersDAL().CheckUser(this.txtLadminUserName.Text, new Crypto().EncryptStringAES(this.txtLadminPass.Text, ConfigurationManager.AppSettings["PssCrypto"])); List <PERMISSION> permisionsByUser = new PermissionsDAL().GetPermisionsByUser(user); bool flag2 = false; foreach (PERMISSION permission in permisionsByUser) { if (permission.ID_WS == classWebServices.ID && permission.Usage == 1) { flag2 = true; } } string str = new Crypto().EncryptStringAES(this.txtAdminPass.Text, ConfigurationManager.AppSettings["PssCrypto"]); if (helpClassUsers.user == this.txtAdminUserName.Text && helpClassUsers.pass == str && (helpClassUsers.Type == 1 && user != null) && (user.Type == 2 && flag2) && this.txtAdminUserName.Text != this.txtLadminUserName.Text) { flag1 = true; break; } } } if (flag1) { bool flag2 = false; new WebservicesDAL().Update(this.txtName.Text, this.txtDescription.Text, this.txtNote.Text, this.txtURL.Text, new bool?(flag2), new DateTime?(), classWebServices.ID); string old = classWebServices.Tittle + ";" + classWebServices.Description + ";" + classWebServices.Note + ";" + classWebServices.URL + ";" + classWebServices.Active.ToString(); string newone = this.txtName.Text + ";" + this.txtDescription.Text + ";" + this.txtNote.Text + ";" + this.txtURL.Text + ";" + flag2.ToString(); new LOGDAL().Insert(Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "WEBSERVICES")).Key, (USER)this.Session["user"], classWebServices.ID.ToString(), 2, DateTime.Now, old, newone); this.Application["ListWebServices"] = (object)new WebservicesDAL().GetWebServicesInstitutionsPermissions(true); this.WSGridView.DataSource = (object)(List <HelpClassWebServices>) this.Application["ListWebServices"]; this.WSGridView.DataBind(); this.DropDownList3.SelectedIndex = -1; this.PanelServiceDeactive.Visible = false; } this.PanelNewUser.CssClass = "content-box column-left closed-box"; this.PanelEditUser.CssClass = "content-box column-right"; }
protected void btn_vnesi_Click(object sender, EventArgs e) { if (this.lblUserExist.Visible) { return; } bool flag = false; if (((List <interop.WEBSERVICE>) this.Session["ListWSInst"]).Count != 0) { flag = true; } if (flag) { bool active = true; string pass = new Crypto().EncryptStringAES(this.txtPassword.Text, ConfigurationManager.AppSettings["PssCrypto"]); Guid id = new UsersDAL().Insert(this.txtName.Text, this.txtSurname.Text, ((interop.USER) this.Session["user"]).ID_CERT, this.txtemail.Text, active, DateTime.Now, this.txtUsername.Text, pass, 3, this.txtIP.Text); string old1 = this.txtName.Text + ";" + this.txtSurname.Text + ";" + this.txtemail.Text + ";" + this.txtUsername.Text + ";" + this.txtPassword.Text + ";" + active.ToString(); string newone1 = ""; KeyValuePair <int, string> keyValuePair = Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)WebApplicationInterop.InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "USERS")); new LOGDAL().Insert(keyValuePair.Key, (interop.USER) this.Session["user"], id.ToString(), 1, DateTime.Now, old1, newone1); interop.USER byId1 = new UsersDAL().GetByID(id); interop.INSTITUTION byId2 = new InstitutionsDAL().GetByID((long)Convert.ToInt32(this.DropDownInst.SelectedValue)); foreach (interop.WEBSERVICE ws in (List <interop.WEBSERVICE>) this.Session["ListWSInst"]) { long num = new PermissionsDAL().Insert(byId2, byId1, ws, 2, true, DateTime.Now); string old2 = ""; string newone2 = ""; keyValuePair = Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)WebApplicationInterop.InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "PERMISSIONS")); new LOGDAL().Insert(keyValuePair.Key, (interop.USER) this.Session["user"], num.ToString(), 1, DateTime.Now, old2, newone2); } this.ClearTxtBox(); List <HelpClassUsers> permissionsByInstitution = new UsersDAL().GetUsersPermissionsByInstitution(true, new PermissionsDAL().GetPermisionsByUser((interop.USER) this.Session["user"])[0].INSTITUTION); this.Application["ListUsersPermissions"] = (object)permissionsByInstitution; this.Application["ListUsersPermissionsPerm"] = (object)permissionsByInstitution; this.CustomersGridView.DataSource = (object)(List <HelpClassUsers>) this.Application["ListUsersPermissions"]; this.CustomersGridView.DataBind(); this.DropDownList3.SelectedIndex = -1; this.PanelEditUser.CssClass = "content-box column-right closed-box"; this.PanelNewUser.CssClass = "content-box column-left closed-box"; } }
protected void TextBox1_TextChanged(object sender, EventArgs e) { USER user = (USER)this.Session["user"]; List <PERMISSION> permisionsByUser = new PermissionsDAL().GetPermisionsByUser(user); List <HelpClassWebServices> servicesPermissions = new WebservicesDAL().GetUsersWebServicesPermissions(true, user, permisionsByUser[0].INSTITUTION); List <HelpClassWebServices> list = new List <HelpClassWebServices>(); IEnumerable <HelpClassWebServices> source = Enumerable.Where <HelpClassWebServices>((IEnumerable <HelpClassWebServices>)servicesPermissions, (Func <HelpClassWebServices, bool>)(p => p.Tittle.ToUpper().Contains(this.TextBox1.Text.ToUpper()))); if (Enumerable.Count <HelpClassWebServices>(source) != 0) { list.Clear(); foreach (HelpClassWebServices classWebServices in source) { list.Add(classWebServices); } } if (list.Count == 0) { list.AddRange((IEnumerable <HelpClassWebServices>)servicesPermissions); } this.Application["ListUserWebServices"] = (object)list; this.WSGridView.DataSource = (object)list; this.WSGridView.DataBind(); }
/// <summary> /// 得到用户列表 /// </summary> /// <param name="PageIndex"></param> /// <param name="PageNum"></param> /// <param name="where"></param> /// <param name="Count"></param> /// <returns></returns> public List <AdminModel> GetAdminList(int PageIndex, int PageNum, string where, out int Count) { List <AdminModel> olist = new List <AdminModel>(); Count = 0; SqlConnection sqlConnection = new SqlConnection(Config.ConnectionString); SqlCommand sqlcommand = new SqlCommand("sp_AdminList", sqlConnection); sqlcommand.CommandType = CommandType.StoredProcedure; SqlParameter _PageIndex = new SqlParameter("@PageIndex", PageIndex); _PageIndex.Direction = ParameterDirection.Input; sqlcommand.Parameters.Add(_PageIndex); SqlParameter _PageNum = new SqlParameter("@PageNum", PageNum); _PageNum.Direction = ParameterDirection.Input; sqlcommand.Parameters.Add(_PageNum); SqlParameter _where = new SqlParameter("@where", where); _where.Direction = ParameterDirection.Input; sqlcommand.Parameters.Add(_where); SqlParameter _Count = new SqlParameter("@Count", SqlDbType.Int); _Count.Direction = ParameterDirection.Output; sqlcommand.Parameters.Add(_Count); try { sqlConnection.Open(); using (IDataReader idr = sqlcommand.ExecuteReader()) { DealerDAL dd = new DealerDAL(); StoreDAL sd = new StoreDAL(); PermissionsDAL pDal = new PermissionsDAL(); while (idr.Read()) { AdminModel oCModel = new AdminModel(); if (idr["AdminId"] != DBNull.Value) { oCModel.AdminId = (int)idr["AdminId"]; } if (idr["AdminName"] != DBNull.Value) { oCModel.AdminName = (string)idr["AdminName"]; } if (idr["AdminPassword"] != DBNull.Value) { oCModel.AdminPassword = (string)idr["AdminPassword"]; } if (idr["Type"] != DBNull.Value) { oCModel.Type = (AdminType)idr["Type"]; } if (idr["RoleId"] != DBNull.Value) { oCModel.RoleId = (int)idr["RoleId"]; } if (idr["Status"] != DBNull.Value) { oCModel.Status = (bool)idr["Status"]; } if (idr["CreateTime"] != DBNull.Value) { oCModel.CreateTime = (DateTime)idr["CreateTime"]; } if (idr["CreatorId"] != DBNull.Value) { oCModel.CreatorId = (int)idr["CreatorId"]; } int Totoal = 0; List <DealerModel> dModel = dd.GetDealerModelList(1, 1, "DealerInfo.AdminId=" + oCModel.AdminId, out Totoal); if (dModel != null & dModel.Count > 0) { oCModel.Dealer = dModel[0]; } List <StoreModel> oSMoel = sd.GetStoreModelList(1, 1, "StoreInfo.AdminId=" + oCModel.AdminId, out Totoal); if (oSMoel != null & oSMoel.Count > 0) { oCModel.Store = oSMoel[0]; } RoleModel role = new RoleModel(); if (idr["RoleId"] != DBNull.Value) { role.RoleId = (int)idr["RoleId"]; } if (idr["RoleId"] != DBNull.Value) { role.RoleName = (string)idr["RoleName"]; } if (idr["RoleId"] != DBNull.Value) { role.Permissions = pDal.GetRoleModulePermission(role.RoleId); } oCModel.Role = role; olist.Add(oCModel); } } Count = int.Parse(_Count.Value.ToString()); } catch (Exception ex) { throw ex; } finally { sqlConnection.Close(); } return(olist); }
protected void Page_Load(object sender, EventArgs e) { this.Session["HelpMenu3"] = (object)"Help/korisnik/Help_pocetna_obicen.aspx"; this.Session["HelpMenu2"] = (object)"Help/admin/Help_Pocetna_Admin.aspx"; this.Session["HelpMenu1"] = (object)"Help/superadmin/Help_pocetna_super.aspx"; HttpBrowserCapabilities browser = this.Request.Browser; if (browser.Browser == "IE" && browser.MajorVersion <= 6) { HtmlHead header = this.Page.Header; HtmlLink htmlLink = new HtmlLink(); htmlLink.Attributes.Add("href", this.Page.ResolveClientUrl("~/rerources/css/IE6Style.css")); htmlLink.Attributes.Add("type", "text/css"); htmlLink.Attributes.Add("rel", "stylesheet"); header.Controls.Add((Control)htmlLink); } if (browser.Browser == "IE" && browser.MajorVersion == 7) { HtmlHead header = this.Page.Header; HtmlLink htmlLink = new HtmlLink(); htmlLink.Attributes.Add("href", this.Page.ResolveClientUrl("~/rerources/css/IEStyle.css")); htmlLink.Attributes.Add("type", "text/css"); htmlLink.Attributes.Add("rel", "stylesheet"); header.Controls.Add((Control)htmlLink); } if (browser.Browser == "IE" && browser.MajorVersion == 9) { HtmlHead header = this.Page.Header; HtmlLink htmlLink = new HtmlLink(); htmlLink.Attributes.Add("href", this.Page.ResolveClientUrl("~/rerources/css/IEStyle.css")); htmlLink.Attributes.Add("type", "text/css"); htmlLink.Attributes.Add("rel", "stylesheet"); header.Controls.Add((Control)htmlLink); } if (browser.Browser == "IE" && browser.MajorVersion == 8) { this.ControlInstitutions.Width = (Unit)150; this.ControlServices.Width = (Unit)150; HtmlHead header = this.Page.Header; HtmlLink htmlLink = new HtmlLink(); htmlLink.Attributes.Add("href", this.Page.ResolveClientUrl("~/rerources/css/IE8Style.css")); htmlLink.Attributes.Add("type", "text/css"); htmlLink.Attributes.Add("rel", "stylesheet"); header.Controls.Add((Control)htmlLink); } else if (browser.Browser != "IE") { this.ControlInstitutions.Width = (Unit)150; this.ControlServices.Width = (Unit)150; HtmlHead header = this.Page.Header; HtmlLink htmlLink = new HtmlLink(); htmlLink.Attributes.Add("href", this.Page.ResolveClientUrl("~/rerources/css/Style.css")); htmlLink.Attributes.Add("type", "text/css"); htmlLink.Attributes.Add("rel", "stylesheet"); header.Controls.Add((Control)htmlLink); } List <Opstini> list1 = new List <Opstini>(); List <KatOpstini> list2 = new List <KatOpstini>(); List <KatOpstini> list3 = new List <KatOpstini>(); InteropDAL interopDal = new InteropDAL(); this.Session["Grad"] = (object)list1; this.Session["Opstini"] = (object)list2; list3.AddRange((IEnumerable <KatOpstini>)list2); this.Session["OpstiniFilter"] = (object)list3; if (this.Session["user"] != null && this.Session["CertificateName"] != null) { USER user = (USER)this.Session["user"]; if (this.Session["Login_" + (object)user.ID] == this.Application.Get("Login_" + (object)user.ID)) { if (user.Type == 1) { this.SysSettings.Visible = true; if (!this.IsPostBack) { List <INSTITUTION> allActiveDeleted = new InstitutionsDAL().GetAllActiveDeleted(true); allActiveDeleted.AddRange((IEnumerable <INSTITUTION>) new InstitutionsDAL().GetAllActiveDeleted(false)); this.Application["DropDownInstitutions"] = (object)allActiveDeleted; if (user.Type == 1) { this.Application["ListInstitutions"] = (object)new InstitutionsDAL().GetAllActiveDeleted(true); this.Application["ListWebServices"] = (object)new WebservicesDAL().GetWebServicesInstitutionsPermissions(true); this.Application["ListUsersPermissions"] = (object)new UsersDAL().GetUsersInstitutionsPermissions(2, true); this.Application["ListUsersPermissionsPerm"] = (object)new UsersDAL().GetUsersInstitutionsPermissions(2, true); this.Application["ListBasis"] = (object)new BasisDAL().GetAllByStatus(true); } } this.AdminPanelMenu.Visible = true; if (this.ctr1ID.Text != "") { this.fillControl1("AdminPanel/" + this.ctr1ID.Text + ".ascx", (LinkButton)this.FindControl("btn_" + this.ctr1ID.Text)); } else if (this.Session["AdminInstitution"] != null) { this.fillControl1("AdminPanel/institutions.ascx", this.btn_ws); } else if (this.Session["AdminWS"] != null) { this.fillControl1("AdminPanel/ws.ascx", this.btn_ws); } else if (this.Session["AdminUser"] != null) { this.fillControl1("AdminPanel/users.ascx", this.btn_ws); } else if (this.Session["AdminPermisions"] != null) { this.fillControl1("AdminPanel/permissions.ascx", this.btn_ws); } else if (this.Session["AdminValidate"] != null) { this.fillControl1("AdminPanel/validatea.ascx", this.btn_ws); } else if ((INSTITUTION)this.Session["AdminSelectedInstitution"] != null) { this.fillControl1("AdminPanel/instinfoa.ascx", this.btn_ws); } else if ((HelpClassWebServices)this.Session["AdminSelectedWS"] != null) { this.fillControl1("AdminPanel/wsusagea.ascx", this.btn_ws); } else if ((HelpClassUsers)this.Session["AdminSelectedUser"] != null) { this.fillControl1("AdminPanel/users.ascx", this.btn_users); } else { this.fillControl1("AdminPanel/indexa.ascx", this.btn_users); } } if (user.Type == 2) { if (!this.IsPostBack && user.Type == 2) { List <PERMISSION> permisionsByUser = new PermissionsDAL().GetPermisionsByUser(user); this.Application["DropDownInstitutions"] = (object)new List <INSTITUTION>() { permisionsByUser[0].INSTITUTION }; List <WEBSERVICE> list4 = new List <WEBSERVICE>(); foreach (PERMISSION permission in permisionsByUser) { if (permission.Active) { list4.Add(permission.WEBSERVICE); } } this.Application["ListWebServices"] = (object)list4; this.Application["ListUserWebServices"] = (object)new WebservicesDAL().GetUsersWebServicesPermissions(true, user, permisionsByUser[0].INSTITUTION); this.Application["ListUsersPermissions"] = (object)new UsersDAL().GetUsersPermissionsByInstitution(true, permisionsByUser[0].INSTITUTION); this.Application["ListUsersPermissionsPerm"] = (object)new UsersDAL().GetUsersPermissionsByInstitution(true, permisionsByUser[0].INSTITUTION); } this.LocalAdminPanelMenu.Visible = true; this.lblInstIfoUs.Text = user.PERMISSIONs[0].INSTITUTION.Tittle; this.Session["UserInstitution"] = (object)user.PERMISSIONs[0].INSTITUTION; if (this.ctr1ID.Text != "") { this.fillControl1("LocalAdminPanel/" + this.ctr1ID.Text + ".ascx", (LinkButton)this.FindControl("btn_" + this.ctr1ID.Text)); } else if (this.Session["LocalUser"] != null) { List <HelpClassWebServices> servicesPermissions = new WebservicesDAL().GetUsersWebServicesPermissions(true, (USER)this.Session["user"]); List <WEBSERVICE> list4 = new List <WEBSERVICE>(); foreach (HelpClassWebServices classWebServices in servicesPermissions) { list4.Add(classWebServices.WSObj); } List <WEBSERVICE> list5 = new List <WEBSERVICE>(); list5.AddRange((IEnumerable <WEBSERVICE>)list4); this.Session["ListWSAllInst"] = (object)list4; this.Session["ListWSInst"] = (object)list5; this.fillControl1("LocalAdminPanel/usersl.ascx", this.btn_ws); } else if (this.Session["LocalPermisions"] != null) { this.fillControl1("LocalAdminPanel/permissionsl.ascx", this.btn_ws); } else if ((INSTITUTION)this.Session["LocalSelectedInstitution"] != null) { this.fillControl1("LocalAdminPanel/instinfol.ascx", this.btn_ws); } else if ((HelpClassWebServices)this.Session["LocalSelectedWS"] != null) { this.fillControl1("LocalAdminPanel/wsusagel.ascx", this.btn_ws); } else if ((HelpClassUsers)this.Session["LocalSelectedUser"] != null) { this.fillControl1("LocalAdminPanel/usersl.ascx", this.btn_usersl); } else { this.fillControl1("LocalAdminPanel/indexl.ascx", this.btn_usersl); } } if (user.Type == 3) { this.UserPanelMenu.Visible = true; if (user.Type == 3) { List <PERMISSION> permisionsByUser = new PermissionsDAL().GetPermisionsByUser(user); List <WEBSERVICE> list4 = new List <WEBSERVICE>(); foreach (PERMISSION permission in permisionsByUser) { if (permission.Active) { list4.Add(permission.WEBSERVICE); } } this.Application["ListWebServices"] = (object)list4; this.Application["ListUserWebServices"] = (object)new WebservicesDAL().GetUsersWebServicesPermissions(true, user); } this.lblInstIfoUs.Text = user.PERMISSIONs[0].INSTITUTION.Tittle; this.Session["UserInstitution"] = (object)user.PERMISSIONs[0].INSTITUTION; if (this.ctr1ID.Text != "") { this.fillControl1("UserPanel/" + this.ctr1ID.Text + ".ascx", (LinkButton)this.FindControl("btn_" + this.ctr1ID.Text)); } else if ((HelpClassWebServices)this.Session["SelectedWS"] != null) { this.fillControl1("UserPanel/wsusage.ascx", this.btn_ws); } else if ((INSTITUTION)this.Session["SelectedInstitution"] != null) { this.fillControl1("UserPanel/instinfo.ascx", this.btn_ws); } else { this.fillControl1("UserPanel/indexu.ascx", this.btn_wsus); } } this.lbluserinfo.Text = user.Name + " " + user.Surname; this.LinkButton1.Visible = true; } else { this.Session["user"] = (object)null; this.Response.Redirect("Login.aspx"); } } else { this.Session["user"] = (object)null; this.Response.Redirect("Login.aspx"); } if (!new InteropDAL().GetSetting().CanCopyPrintScreen.Value) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "setClipBoardData", "" + "function setClipBoardData(){" + "setInterval(\"window.clipboardData.setData('text','')\",20);" + "}" + "function blockError(){" + "window.location.reload(true);" + "return true;}", true); } else { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "setClipBoardData", "" + "function setClipBoardData(){" + "}", true); } }
/// <summary> ///得到角色列表 /// </summary> /// <returns></returns> public List <RoleModel> GetRoleList(int?RoleId) { List <RoleModel> oLRModel = new List <RoleModel>(); SqlConnection sqlConnection = new SqlConnection(Config.ConnectionString); SqlCommand sqlcommand = new SqlCommand("sp_RoleInfo", sqlConnection); sqlcommand.CommandType = CommandType.StoredProcedure; SqlParameter _op = new SqlParameter("@op", "Get"); _op.Direction = ParameterDirection.Input; sqlcommand.Parameters.Add(_op); SqlParameter _RoleId = new SqlParameter("@RoleId", RoleId == null?(Object)DBNull.Value:RoleId.Value); _RoleId.Direction = ParameterDirection.Input; sqlcommand.Parameters.Add(_RoleId); SqlParameter _RoleName = new SqlParameter("@RoleName", (Object)DBNull.Value); _RoleName.Direction = ParameterDirection.Input; sqlcommand.Parameters.Add(_RoleName); SqlParameter _CreatorId = new SqlParameter("@CreatorId", (Object)DBNull.Value); _CreatorId.Direction = ParameterDirection.Input; sqlcommand.Parameters.Add(_CreatorId); SqlParameter result = new SqlParameter("@result", SqlDbType.VarChar, 10); result.Direction = ParameterDirection.Output; sqlcommand.Parameters.Add(result); try { sqlConnection.Open(); using (IDataReader idr = sqlcommand.ExecuteReader()) { PermissionsDAL pDal = new PermissionsDAL(); while (idr.Read()) { RoleModel oRoleModel = new RoleModel(); oRoleModel.RoleId = (int)idr["RoleId"]; oRoleModel.RoleName = (string)idr["RoleName"]; oRoleModel.CreatorId = (int)idr["CreatorId"]; if (idr["AdminName"] != DBNull.Value) { oRoleModel.Creator = (string)idr["AdminName"]; } ; oRoleModel.CreateTime = (DateTime)idr["CreateTime"]; oRoleModel.Permissions = pDal.GetRoleModulePermission(oRoleModel.RoleId); oLRModel.Add(oRoleModel); } } } catch (Exception ex) { throw ex; } finally { sqlConnection.Close(); } return(oLRModel); }