Ejemplo n.º 1
0
 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
     {
     }
 }
Ejemplo n.º 2
0
        protected void LinkButtonPromeni_Click(object sender, EventArgs e)
        {
            bool flag = false;

            for (int index = 0; index < this.CheckBoxListOwner.Items.Count; ++index)
            {
                if (this.CheckBoxListOwner.Items[index].Selected)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                return;
            }
            List <WEBSERVICE> list1          = (List <WEBSERVICE>) this.Application["ListWSOwner"];
            List <WEBSERVICE> list2          = (List <WEBSERVICE>) this.Application["ListWSUser"];
            HelpClassUsers    helpClassUsers = (HelpClassUsers)this.Application["UserPermission"];
            INSTITUTION       byId1          = new InstitutionsDAL().GetByID(helpClassUsers.IDInstitution);
            USER       byId2 = new UsersDAL().GetByID(helpClassUsers.ID);
            WEBSERVICE webservice;
            KeyValuePair <int, string> keyValuePair;

            for (int i = 0; i < this.CheckBoxListOwner.Items.Count; ++i)
            {
                if (this.CheckBoxListOwner.Items[i].Selected)
                {
                    try
                    {
                        webservice = Enumerable.First <WEBSERVICE>((IEnumerable <WEBSERVICE>)list1, (Func <WEBSERVICE, bool>)(p => p.ID == Convert.ToInt64(this.CheckBoxListOwner.Items[i].Value)));
                    }
                    catch
                    {
                        WEBSERVICE byId3  = new WebservicesDAL().GetByID(Convert.ToInt64(this.CheckBoxListOwner.Items[i].Value));
                        long       num    = new PermissionsDAL().Insert(byId1, byId2, byId3, 1, true, DateTime.Now);
                        string     old    = "";
                        string     newone = "";
                        keyValuePair = Enumerable.First <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.First <WEBSERVICE>((IEnumerable <WEBSERVICE>)list1, (Func <WEBSERVICE, bool>)(p => p.ID == Convert.ToInt64(this.CheckBoxListOwner.Items[i].Value)));
                        PERMISSION permission = Enumerable.First <PERMISSION>((IEnumerable <PERMISSION>)helpClassUsers.PermissionList, (Func <PERMISSION, bool>)(p => p.ID_WS == ws.ID && p.Usage == 1));
                        new PermissionsDAL().Update((INSTITUTION)null, (USER)null, (WEBSERVICE)null, new int?(), new bool?(false), new DateTime?(), permission.ID);
                        string old    = "";
                        string newone = "";
                        keyValuePair = Enumerable.First <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
                    {
                    }
                }
            }
            for (int i = 0; i < this.CheckBoxListUser.Items.Count; ++i)
            {
                if (this.CheckBoxListUser.Items[i].Selected)
                {
                    try
                    {
                        webservice = Enumerable.First <WEBSERVICE>((IEnumerable <WEBSERVICE>)list2, (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.First <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.First <WEBSERVICE>((IEnumerable <WEBSERVICE>)list2, (Func <WEBSERVICE, bool>)(p => p.ID == Convert.ToInt64(this.CheckBoxListUser.Items[i].Value)));
                        PERMISSION permission = Enumerable.First <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.First <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
                    {
                    }
                }
            }
        }
Ejemplo n.º 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"]));
     }
 }
Ejemplo n.º 4
0
        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";
            }
        }