예제 #1
0
        private Dictionary <string, string> GetRestrictedServersFromGrid()
        {
            string separator = "###$$$###";
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            for (int i = 0; i < SpecificServersNotVisibleGridView.VisibleRowCount; i++)
            {
                if (SpecificServersNotVisibleGridView.GetRowValues(i, "ServerName") != null)
                {
                    dictionary.Add("'" + SpecificServersNotVisibleGridView.GetRowValues(i, "ServerType").ToString() + "'" +
                                   separator + "'" + SpecificServersNotVisibleGridView.GetRowValues(i, "ServerName").ToString() + "'",
                                   "'" + SpecificServersNotVisibleGridView.GetRowValues(i, "ServerName").ToString() + "'");
                }
            }

            /*
             * string selValues = "";
             * for (int i = 0; i < SpecificServersNotVisibleGridView.VisibleRowCount; i++)
             * {
             *  if (SpecificServersNotVisibleGridView.GetRowValues(i, "ServerName") != null)
             *  {
             *      if (selValues == "")
             *      {
             *          selValues = "'" + SpecificServersNotVisibleGridView.GetRowValues(i, "ServerName").ToString() + "'";
             *      }
             *      else
             *      {
             *          selValues += "," + "'" + SpecificServersNotVisibleGridView.GetRowValues(i, "ServerName").ToString() + "'";
             *      }
             *  }
             * }
             */
            return(dictionary);
        }
예제 #2
0
        protected void SpecificServersNotVisibleGridView_PageIndexChanged(object sender, EventArgs e)
        {
            if (Session["NotVisible"] != "" && Session["NotVisible"] != null)
            {
                int pageIndex = (sender as ASPxGridView).PageIndex;

                SpecificServersNotVisibleGridView.PageIndex = pageIndex;
                //this.SpecificServersVisibleGridView.PageIndex = SpecificServersVisibleGridView.PageIndex;
                SpecificServersNotVisibleGridView.DataSource = (DataTable)Session["NotVisible"];
                SpecificServersNotVisibleGridView.DataBind();
            }
        }
예제 #3
0
 protected void ResetServerAccessButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (IsPostBack)
         {
             LocToggleEnabled(false);
             //Server Type panel fields and buttons
             //ServerTypesRoundPanel.Enabled = false;
             //ServerTypeToggleEnabled(false);
             LocRadioButtonList.SelectedIndex = 0;
             //ServerTypeRadioButtonList.SelectedIndex = 0;
             LocNotVisibleListBox.Items.Clear();
             // LocVisibleListBox.Items.Clear();
             //ServerTypeNotVisibleListBox.Items.Clear();
             SpecificServersNotVisibleGridView.DataSource = null;
             SpecificServersNotVisibleGridView.DataBind();
             //Specific Servers
             //SpecificServersRoundPanel.Enabled = false;
             DataTable ServerAccessGrid = VSWebBL.SecurityBL.AdminTabBL.Ins.ServerAllowUpdateGrid("");
             if (ServerAccessGrid.Rows.Count > 0)
             {
                 SpecificServersVisibleGridView.DataSource   = ServerAccessGrid;
                 SpecificServersVisibleGridView.KeyFieldName = "ID";
                 SpecificServersVisibleGridView.DataBind();
             }
             else
             {
                 SpecificServersVisibleGridView.DataSource   = null;
                 SpecificServersVisibleGridView.KeyFieldName = "ID";
                 SpecificServersVisibleGridView.DataBind();
             }
             DataTable LocationVisibleDataTable = VSWebBL.SecurityBL.AdminTabBL.Ins.LocVisibleUpdateListBox();
             if (LocationVisibleDataTable.Rows.Count > 0)
             {
                 //SpecificServersRoundPanel.Enabled = true;
                 LocRadioButtonList.SelectedIndex = 0;
                 LocToggleEnabled(false);
                 LocVisibleListBox.DataSource = LocationVisibleDataTable;
                 LocVisibleListBox.DataBind();
             }
         }
     }
     catch (Exception ex)
     {
         Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
         throw ex;
     }
     finally { }
 }
예제 #4
0
        protected void FillServerLocation()
        {
            if (LocRadioButtonList.SelectedIndex == 0)
            {
                LocNotVisibleListBox.DataSource = "";
                LocNotVisibleListBox.DataBind();
            }
            DataTable dt = VSWebBL.SecurityBL.AdminTabBL.Ins.LocVisibleUpdateListBox();

            LocVisibleListBox.DataSource = dt;
            LocVisibleListBox.DataBind();
            SpecificServersNotVisibleGridView.DataSource = "";
            SpecificServersNotVisibleGridView.DataBind();
            dt = VSWebBL.SecurityBL.AdminTabBL.Ins.ServerAllowUpdateGrid("");
            SpecificServersVisibleGridView.DataSource = dt;
            SpecificServersVisibleGridView.DataBind();
            Session["visible"]    = dt;
            Session["NotVisible"] = "";
        }
예제 #5
0
        private void LoadUserRestrictions(string UserName)
        {
            try
            {
                //Load locations users are allowed to access
                DataTable LocationVisibleDataTable = new DataTable();
                LocationVisibleDataTable = VSWebBL.SecurityBL.AdminTabBL.Ins.UserLocationVisibleUpdateListBox(UserName);
                if (LocationVisibleDataTable.Rows.Count >= 0)
                {
                    LocVisibleListBox.DataSource = LocationVisibleDataTable;
                    LocVisibleListBox.DataBind();
                }
                //Load locations users are NOT allowed to access
                DataTable LocationNotVisibleDataTable = new DataTable();
                LocationNotVisibleDataTable = VSWebBL.SecurityBL.AdminTabBL.Ins.UserLocationNotVisibleUpdateListBox(UserName);
                if (LocationNotVisibleDataTable.Rows.Count > 0)
                {
                    //SpecificServersRoundPanel.Enabled = true;
                    //LocRadioButtonList.SelectedIndex = 1;
                    LocToggleEnabled(true);
                    LocNotVisibleListBox.DataSource = LocationNotVisibleDataTable;
                    LocNotVisibleListBox.DataBind();
                }
                else
                {
                    //Load all allowed locations
                    LocationVisibleDataTable = VSWebBL.SecurityBL.AdminTabBL.Ins.LocVisibleUpdateListBox();
                    if (LocationVisibleDataTable.Rows.Count >= 0)
                    {
                        //SpecificServersRoundPanel.Enabled = true;
                        //LocRadioButtonList.SelectedIndex = 0;
                        LocToggleEnabled(false);
                        LocVisibleListBox.DataSource = LocationVisibleDataTable;
                        LocVisibleListBox.DataBind();
                    }
                }


                DataTable ServerVisibleDataTable = new DataTable();
                ServerVisibleDataTable = VSWebBL.SecurityBL.AdminTabBL.Ins.ServersVisibleUpdateGrid(UserName);
                if (ServerVisibleDataTable.Rows.Count >= 0)
                {
                    SpecificServersVisibleGridView.DataSource = ServerVisibleDataTable;
                    SpecificServersVisibleGridView.DataBind();
                }
                DataTable ServerNotVisibleDataTable = new DataTable();
                ServerNotVisibleDataTable = VSWebBL.SecurityBL.AdminTabBL.Ins.ServersNotVisibleUpdateGrid(UserName);
                if (ServerNotVisibleDataTable.Rows.Count > 0 || LocationNotVisibleDataTable.Rows.Count > 0)
                {
                    LocRadioButtonList.SelectedIndex = 1;
                }
                else
                {
                    LocRadioButtonList.SelectedIndex = 0;
                }
                SpecificServersNotVisibleGridView.DataSource = ServerNotVisibleDataTable;
                SpecificServersNotVisibleGridView.DataBind();
                //9/21/2015 NS added
                Session["NotVisible"] = ServerNotVisibleDataTable;
                FillServersVisibleGrid();
            }
            catch (Exception ex)
            { throw ex; }
            finally { }
        }
예제 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             //9/22/2015 NS added
             FillGrid();
             Session["visible"] = ""; Session["NotVisible"] = "";
             FillUserNameComboBox();
             //LocationsRoundPanel.Enabled = false;
             LocToggleEnabled(false);
             //SpecificServersRoundPanel.Enabled = true;
             if (Session["UserPreferences"] != null)
             {
                 DataTable UserPreferences = (DataTable)Session["UserPreferences"];
                 foreach (DataRow dr in UserPreferences.Rows)
                 {
                     if (dr[1].ToString() == "ServerAccessGridView|ServerAccessGridView")
                     {
                         ServerAccessGridView.SettingsPager.PageSize = Convert.ToInt32(dr[2]);
                     }
                 }
             }
         }
         else
         {
             //9/22/2015 NS added
             FillGridFromSession();
             if (Session["visible"] != "" && Session["visible"] != null)
             {
                 SpecificServersVisibleGridView.DataSource   = (DataTable)Session["visible"];
                 SpecificServersVisibleGridView.KeyFieldName = "ID";
                 SpecificServersVisibleGridView.DataBind();
             }
             if (Session["NotVisible"] != "" && Session["NotVisible"] != null)
             {
                 SpecificServersNotVisibleGridView.PageIndex  = 0;
                 SpecificServersNotVisibleGridView.DataSource = (DataTable)Session["NotVisible"];
                 SpecificServersNotVisibleGridView.DataBind();
             }
         }
         //1/22/2016 Durga modified for VSPLUS--2516
         if (Session["AssignSeverAcessUpdateStatus"] != null)
         {
             if (Session["AssignSeverAcessUpdateStatus"].ToString() != "")
             {
                 Sucessdiv.InnerHtml = "Server Access information for <b>" + Session["AssignSeverAcessUpdateStatus"].ToString() +
                                       "</b> updated successfully." +
                                       "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                 Sucessdiv.Style.Value = "display: block";
                 Session["AssignSeverAcessUpdateStatus"] = "";
             }
         }
     }
     catch (Exception ex)
     {
         Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
         throw ex;
     }
     finally { }
 }
예제 #7
0
        protected void FillServersVisibleGrid()
        {
            string    lname            = "";
            DataTable dtSelLocFillGrid = new DataTable();

            for (int i = 0; i < LocVisibleListBox.Items.Count; i++)// string lname in LocVisibleListBox.Items) //.SelectedValues)
            {
                lname += "'" + LocVisibleListBox.Items[i].Value.ToString() + "',";
            }
            if (lname != "")
            {
                string LocName = lname.Substring(0, lname.Length - 1);
                dtSelLocFillGrid = VSWebBL.SecurityBL.AdminTabBL.Ins.GetServersByLocations(LocName);
            }
            Session["locationnotdt"] = (DataTable)dtSelLocFillGrid;
            Session["visible"]       = dtSelLocFillGrid;
            //Delete Visible repeating rows of NotVisible list
            if (Session["NotVisible"] != null && Session["NotVisible"] != "")
            {
                DataTable dtNotVisible = (DataTable)Session["NotVisible"];
                if (dtNotVisible.Rows.Count > 0)
                {
                    foreach (DataRow r1 in dtSelLocFillGrid.Rows.Cast <DataRow>().ToArray()) // save rows to array
                    {
                        foreach (DataRow r2 in dtNotVisible.Rows)
                        {
                            try
                            {
                                if (r1.Field <String>("ServerName") == r2.Field <String>("ServerName"))
                                {
                                    r1.Delete();
                                    break; // break inner loop
                                }
                            }
                            catch { }
                        }
                    }
                }
            }
            Session["visible"] = dtSelLocFillGrid;
            SpecificServersVisibleGridView.PageIndex  = 0;
            SpecificServersVisibleGridView.DataSource = dtSelLocFillGrid;
            SpecificServersVisibleGridView.DataBind();

            if (Session["NotVisible"] != null && Session["NotVisible"] != "")
            {
                DataTable dtNotVisible = (DataTable)Session["NotVisible"];
                if (dtNotVisible.Rows.Count > 0)
                {
                    for (int i = 0; i < LocNotVisibleListBox.Items.Count; i++)
                    {
                        foreach (DataRow r2 in dtNotVisible.Rows)
                        {
                            try
                            {
                                if (LocNotVisibleListBox.Items[i].Value.ToString() == r2.Field <String>("Location"))
                                {
                                    r2.Delete();
                                    // break; // break inner loop
                                }
                            }
                            catch { }
                        }
                    }
                }

                Session["NotVisible"] = dtNotVisible;
                SpecificServersNotVisibleGridView.PageIndex  = 0;
                SpecificServersNotVisibleGridView.DataSource = dtNotVisible;
                SpecificServersNotVisibleGridView.DataBind();
            }
        }