Example #1
0
        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
                    {
                    }
                }
            }
        }
Example #2
0
        protected void CustomersGridView_SelectedIndexChanged1(object sender, EventArgs e)
        {
            Guid           row      = (Guid)this.CustomersGridView.SelectedDataKey.Value;
            HelpClassUsers TempUser = Enumerable.Single <HelpClassUsers>((IEnumerable <HelpClassUsers>) this.Application["ListUsersPermissions"], (Func <HelpClassUsers, bool>)(p => p.ID == row));

            this.Application["TempUser"] = (object)TempUser;
            this.PanelNewUser.CssClass   = "content-box column-left closed-box";
            this.FillUser(TempUser);
        }
Example #3
0
 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"]));
     }
 }
Example #4
0
        protected void IGridView_SelectedIndexChanged(object sender, EventArgs e)
        {
            Guid           row            = (Guid)this.IGridView.SelectedDataKey.Value;
            HelpClassUsers helpClassUsers = Enumerable.Single <HelpClassUsers>((IEnumerable <HelpClassUsers>) this.Application["ListUsersPermissionsPerm"], (Func <HelpClassUsers, bool>)(p => p.ID == row));

            this.Application["UserPermission"] = (object)helpClassUsers;
            this.Application["SelectedUser"]   = (object)row;
            List <WEBSERVICE> list1 = new List <WEBSERVICE>();

            new InstitutionsDAL().GetByID(helpClassUsers.IDInstitution);
            List <WEBSERVICE> list2 = (List <WEBSERVICE>) this.Application["ListWebServices"];

            this.CheckBoxListUser.DataSource = (object)list2;
            this.CheckBoxListUser.DataBind();
            this.Session["ListWSAll"] = (object)list2;
            foreach (PERMISSION permission in helpClassUsers.PermissionList)
            {
                for (int index = 0; index < this.CheckBoxListUser.Items.Count; ++index)
                {
                    if (this.CheckBoxListUser.Items[index].Value == permission.WEBSERVICE.ID.ToString())
                    {
                        this.CheckBoxListUser.Items[index].Selected = true;
                        break;
                    }
                }
            }
            foreach (PERMISSION permission in new PermissionsDAL().GetPermisionsByUser(new UsersDAL().GetByID(helpClassUsers.ID)))
            {
                if (permission.Active)
                {
                    list1.Add(permission.WEBSERVICE);
                }
            }
            this.Session["ListWSUser"] = (object)list1;
            this.lblName.Text          = helpClassUsers.NameSurname;
            this.lblDescr.Text         = helpClassUsers.InstitutionName;
            this.lblstatus.Text        = !helpClassUsers.Active ? "Неактивен" : "Активен";
            this.DisableTxtBox();
            this.ClearStylePermbmeni();
            this.lblinfo.Text = "";
            if (this.CheckBoxListUser.Visible)
            {
                this.ClearStylePermbmeni();
            }
            this.btnUsage.CssClass     = "default-tab current";
            this.PanelInfoInst.Visible = true;
            this.Gridview1.DataSource  = (object)list2;
            this.Gridview1.DataBind();
            this.Gridview1.Visible = true;
        }
Example #5
0
 public void FillUser(HelpClassUsers TempUser)
 {
     this.txtPName.Text     = TempUser.Name;
     this.txtPSurname.Text  = TempUser.Surname;
     this.txtPmail.Text     = TempUser.Email;
     this.txtIP.Text        = TempUser.ip;
     this.txtPusername.Text = TempUser.user;
     this.DropDownListPCert.Items.Add(new ListItem()
     {
         Value = TempUser.ID_Cert.ToString(),
         Text  = new CertificatesDAL().GetByUser(new UsersDAL().GetByID(TempUser.ID)).Subject
     });
     try
     {
         string str = new Crypto().DecryptStringAES(TempUser.pass, ConfigurationManager.AppSettings["PssCrypto"]);
         this.txtPpassword.Attributes["value"]        = str;
         this.txtConfirmPPassword.Attributes["value"] = str;
     }
     catch
     {
     }
     if (TempUser.InstitutionName != null)
     {
         this.txtInstP.Text = TempUser.InstitutionName.ToString();
     }
     if (TempUser.Active)
     {
         this.CheckBoxPTrue.Checked  = true;
         this.CheckBoxPFalse.Checked = false;
     }
     else
     {
         this.CheckBoxPFalse.Checked = true;
         this.CheckBoxPTrue.Checked  = false;
     }
     if (TempUser.Type != 2)
     {
         if (new PermissionsDAL().GetPermisionsByUser((interop.USER) this.Session["user"])[0].INSTITUTION.ID == TempUser.IDInstitution)
         {
             this.LinkButton3.Enabled = true;
         }
     }
     else
     {
         this.LinkButton3.Enabled = false;
     }
     this.CheckBoxListWS.Visible = false;
     this.PanelEditUser.CssClass = "content-box column-right";
 }
Example #6
0
        protected void IGridView_SelectedIndexChanged(object sender, EventArgs e)
        {
            Guid           row            = (Guid)this.IGridView.SelectedDataKey.Value;
            HelpClassUsers helpClassUsers = Enumerable.First <HelpClassUsers>((IEnumerable <HelpClassUsers>) this.Application["ListUsersPermissionsPerm"], (Func <HelpClassUsers, bool>)(p => p.ID == row));

            this.Application["UserPermission"] = (object)helpClassUsers;
            this.Application["SelectedUser"]   = (object)row;
            List <WEBSERVICE> list1                = new List <WEBSERVICE>();
            List <WEBSERVICE> list2                = new List <WEBSERVICE>();
            INSTITUTION       byId                 = new InstitutionsDAL().GetByID(helpClassUsers.IDInstitution);
            List <WEBSERVICE> otherWebServices     = new WebservicesDAL().GetAllOtherWebServices(byId);
            List <WEBSERVICE> servicesByIstitution = new WebservicesDAL().GetServicesByIstitution(byId);

            this.Session["ListAllWSInst"]     = (object)servicesByIstitution;
            this.Session["ListAllWS"]         = (object)otherWebServices;
            this.CheckBoxListOwner.DataSource = (object)servicesByIstitution;
            this.CheckBoxListOwner.DataBind();
            this.CheckBoxListUser.DataSource = (object)otherWebServices;
            this.CheckBoxListUser.DataBind();
            foreach (PERMISSION permission in Enumerable.Where <PERMISSION>((IEnumerable <PERMISSION>)helpClassUsers.PermissionList, (Func <PERMISSION, bool>)(p => p.Usage == 1 && p.Active)))
            {
                list1.Add(permission.WEBSERVICE);
                for (int index = 0; index < this.CheckBoxListOwner.Items.Count; ++index)
                {
                    if (this.CheckBoxListOwner.Items[index].Value == permission.WEBSERVICE.ID.ToString())
                    {
                        this.CheckBoxListOwner.Items[index].Selected = true;
                        this.CheckBoxListOwner.Items[index].Attributes.Add("Style", "color: red;");
                        break;
                    }
                }
            }
            foreach (PERMISSION permission in Enumerable.Where <PERMISSION>((IEnumerable <PERMISSION>)helpClassUsers.PermissionList, (Func <PERMISSION, bool>)(p => p.Usage == 2 && p.Active)))
            {
                for (int index = 0; index < this.CheckBoxListUser.Items.Count; ++index)
                {
                    if (this.CheckBoxListUser.Items[index].Value == permission.WEBSERVICE.ID.ToString())
                    {
                        this.CheckBoxListUser.Items[index].Selected = true;
                        break;
                    }
                }
            }
            foreach (PERMISSION permission in new PermissionsDAL().GetPermisionsByUser(new UsersDAL().GetByID(helpClassUsers.ID)))
            {
                if (permission.Active)
                {
                    list2.Add(permission.WEBSERVICE);
                }
            }
            this.Application["ListWSOwner"] = (object)list1;
            this.Application["ListWSUser"]  = (object)list2;
            this.lblName.Text   = helpClassUsers.NameSurname;
            this.lblDescr.Text  = helpClassUsers.InstitutionName;
            this.lblstatus.Text = !helpClassUsers.Active ? "Неактивен" : "Активен";
            this.DisableTxtBox();
            this.ClearStylePermbmeni();
            this.lblinfo.Text = "";
            if (this.CheckBoxListUser.Visible)
            {
                this.ClearStylePermbmeni();
                this.btnUsage.CssClass = "default-tab current";
            }
            else if (this.CheckBoxListOwner.Visible)
            {
                this.ClearStylePermbmeni();
                this.btnOwner.CssClass = "default-tab current";
            }
            this.PanelInfoInst.Visible = true;
            this.btnOwner.CssClass     = "default-tab current";
            this.Gridview2.DataSource  = (object)otherWebServices;
            this.Gridview2.DataBind();
            this.Gridview1.DataSource = (object)servicesByIstitution;
            this.Gridview1.DataBind();
            this.Gridview1.Visible = true;
            this.Gridview2.Visible = false;
        }
Example #7
0
        protected void btn_promeni_Click(object sender, EventArgs e)
        {
            HelpClassUsers helpClassUsers1 = (HelpClassUsers)this.Application["TempUser"];
            bool           flag            = false;

            if (this.CheckBoxPTrue.Checked)
            {
                flag = true;
            }
            string text = this.txtConfirmPPassword.Text;
            string pass = !(this.txtConfirmPPassword.Text != string.Empty) ? this.txtPpassword.Text : new Crypto().EncryptStringAES(this.txtPpassword.Text, ConfigurationManager.AppSettings["PssCrypto"]);

            new UsersDAL().Update(this.txtPName.Text, this.txtPSurname.Text, new long?(), this.txtPmail.Text, new bool?(flag), new DateTime?(), this.txtPusername.Text, pass, new int?(), this.txtPip.Text, helpClassUsers1.ID);
            string old    = helpClassUsers1.Name + ";" + helpClassUsers1.Surname + ";" + helpClassUsers1.Email + ";" + helpClassUsers1.user + ";" + helpClassUsers1.pass + ";" + helpClassUsers1.Active.ToString();
            string newone = this.txtPName.Text + ";" + this.txtPSurname.Text + ";" + this.txtPmail.Text + ";" + this.txtPusername.Text + ";" + this.txtPpassword.Text + ";" + flag.ToString();

            new LOGDAL().Insert(Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)WebApplicationInterop.InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "USERS")).Key, (interop.USER) this.Session["user"], helpClassUsers1.ID.ToString(), 2, DateTime.Now, old, newone);
            this.Application["ListUsersPermissions"] = (object)new UsersDAL().GetUsersPermissionsByInstitution(true, new PermissionsDAL().GetPermisionsByUser((interop.USER) this.Session["user"])[0].INSTITUTION);
            List <HelpClassUsers> list1 = (List <HelpClassUsers>) this.Application["ListUsersPermissions"];
            List <HelpClassUsers> list2 = new List <HelpClassUsers>();

            string[] ImePrezime = this.TextBox1.Text.Split(' ');
            if (Enumerable.Count <string>((IEnumerable <string>)ImePrezime) == 2)
            {
                IEnumerable <HelpClassUsers> source = Enumerable.Where <HelpClassUsers>((IEnumerable <HelpClassUsers>)list1, (Func <HelpClassUsers, bool>)(p => p.Name.ToUpper().Contains(ImePrezime[0].ToUpper()) && p.Surname.ToUpper().Contains(ImePrezime[1].ToUpper())));
                if (Enumerable.Count <HelpClassUsers>(source) != 0)
                {
                    list2.Clear();
                    foreach (HelpClassUsers helpClassUsers2 in source)
                    {
                        list2.Add(helpClassUsers2);
                    }
                }
                if (list2.Count == 0)
                {
                    list2.AddRange((IEnumerable <HelpClassUsers>)list1);
                }
                this.Application["ListUsersPermissions"] = (object)list2;
                this.CustomersGridView.DataSource        = (object)list2;
                this.CustomersGridView.DataBind();
            }
            else
            {
                IEnumerable <HelpClassUsers> source = Enumerable.Where <HelpClassUsers>((IEnumerable <HelpClassUsers>)list1, (Func <HelpClassUsers, bool>)(p => p.Name.ToUpper().Contains(this.TextBox1.Text.ToUpper()) || p.Surname.ToUpper().Contains(this.TextBox1.Text.ToUpper()) || p.Email.ToUpper().Contains(this.TextBox1.Text.ToUpper())));
                if (Enumerable.Count <HelpClassUsers>(source) != 0)
                {
                    list2.Clear();
                    foreach (HelpClassUsers helpClassUsers2 in source)
                    {
                        list2.Add(helpClassUsers2);
                    }
                }
                if (list2.Count == 0)
                {
                    list2.AddRange((IEnumerable <HelpClassUsers>)list1);
                }
                this.Application["ListUsersPermissions"] = (object)list2;
                this.CustomersGridView.DataSource        = (object)list2;
                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";
        }
Example #8
0
        public void PageLoadStaf()
        {
            List <HelpClassUsers> list1 = (List <HelpClassUsers>) this.Application["ListUsersPermissions"];
            List <HelpClassUsers> list2 = new List <HelpClassUsers>();

            string[] ImePrezime = this.TextBox1.Text.Split(' ');
            if (Enumerable.Count <string>((IEnumerable <string>)ImePrezime) == 2)
            {
                IEnumerable <HelpClassUsers> source = Enumerable.Where <HelpClassUsers>((IEnumerable <HelpClassUsers>)list1, (Func <HelpClassUsers, bool>)(p => p.Name.ToUpper().Contains(ImePrezime[0].ToUpper()) && p.Surname.ToUpper().Contains(ImePrezime[1].ToUpper())));
                if (Enumerable.Count <HelpClassUsers>(source) != 0)
                {
                    list2.Clear();
                    foreach (HelpClassUsers helpClassUsers in source)
                    {
                        list2.Add(helpClassUsers);
                    }
                }
                if (list2.Count == 0)
                {
                    list2.AddRange((IEnumerable <HelpClassUsers>)list1);
                }
                this.Application["ListUsersPermissions"] = (object)list2;
                this.CustomersGridView.DataSource        = (object)list2;
                this.CustomersGridView.DataBind();
            }
            else
            {
                IEnumerable <HelpClassUsers> source = Enumerable.Where <HelpClassUsers>((IEnumerable <HelpClassUsers>)list1, (Func <HelpClassUsers, bool>)(p => p.Name.ToUpper().Contains(this.TextBox1.Text.ToUpper()) || p.Surname.ToUpper().Contains(this.TextBox1.Text.ToUpper()) || p.Email.ToUpper().Contains(this.TextBox1.Text.ToUpper())));
                if (Enumerable.Count <HelpClassUsers>(source) != 0)
                {
                    list2.Clear();
                    foreach (HelpClassUsers helpClassUsers in source)
                    {
                        list2.Add(helpClassUsers);
                    }
                }
                if (list2.Count == 0)
                {
                    list2.AddRange((IEnumerable <HelpClassUsers>)list1);
                }
                this.Application["ListUsersPermissions"] = (object)list2;
                this.CustomersGridView.DataSource        = (object)list2;
                this.CustomersGridView.DataBind();
            }
            List <interop.INSTITUTION> list3 = new List <interop.INSTITUTION>();

            foreach (interop.INSTITUTION institution in (List <interop.INSTITUTION>) this.Application["DropDownInstitutions"])
            {
                if (institution.Active)
                {
                    list3.Add(institution);
                }
            }
            this.DropDownInst.DataSource = (object)Enumerable.Distinct <interop.INSTITUTION>((IEnumerable <interop.INSTITUTION>)list3);
            this.DropDownInst.DataBind();
            this.DropDownInst.SelectedIndex = 0;
            this.DropDownListCert.Items.Add(new ListItem()
            {
                Value = ((interop.USER) this.Session["user"]).ID_CERT.ToString(),
                Text  = new CertificatesDAL().GetByUser((interop.USER) this.Session["user"]).Subject
            });
            if ((HelpClassUsers)this.Session["LocalSelectedUser"] != null)
            {
                HelpClassUsers TempUser = (HelpClassUsers)this.Session["LocalSelectedUser"];
                this.Application["TempUser"]      = (object)TempUser;
                this.Session["LocalSelectedUser"] = (object)null;
                this.FillUser(TempUser);
            }
            this.Gridview1.DataSource = (object)(List <interop.WEBSERVICE>) this.Session["ListWSAllInst"];
            this.Gridview1.DataBind();
            this.CheckBoxListWS.Visible = false;
        }