Beispiel #1
0
        public void fillgridbySession()
        {
            DataTable d = new DataTable();

            try
            {
                if ((Session["BlackBerryServers"] != null) && (Session["BlackBerryServers"] != ""))
                {
                    d = (DataTable)Session["BlackBerryServers"];
                    if (d.Rows.Count > 0)
                    {
                        BlackBerryGridView.DataSource = d;
                        BlackBerryGridView.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
        }
Beispiel #2
0
 public void fillgrid()
 {
     // DataTable dt = VSWebBL.ConfiguratorBL.BlackBerryServersBL.Ins.fillgrid();
     try
     {
         if (Session["UserID"] != null)
         {
             UserID = Convert.ToInt32(Session["UserID"]);
         }
         DataTable dt = VSWebBL.ConfiguratorBL.BlackBerryServersBL.Ins.getfillgridbyUser(UserID);
         if (dt.Rows.Count > 0)
         {
             if (Session["RestrictedServers"] != "" && Session["RestrictedServers"] != null)
             {
                 List <int> ServerID   = new List <int>();
                 List <int> LocationID = new List <int>();
                 DataTable  resServers = (DataTable)Session["RestrictedServers"];
                 foreach (DataRow dominorow in dt.Rows)
                 {
                     foreach (DataRow resser in resServers.Rows)
                     {
                         if (resser["serverid"].ToString() == dominorow["SID"].ToString())
                         {
                             ServerID.Add(dt.Rows.IndexOf(dominorow));
                         }
                         if (resser["locationID"].ToString() == dominorow["LocationID"].ToString())
                         {
                             LocationID.Add(Convert.ToInt32(dominorow["LocationID"].ToString()));
                             //LocationID.Add(dt.Rows.IndexOf(dominorow));
                         }
                     }
                 }
                 foreach (int Id in ServerID)
                 {
                     dt.Rows[Id].Delete();
                 }
                 dt.AcceptChanges();
                 //foreach (int Lid in LocationID)
                 //{
                 //    dt.Rows[Lid].Delete();
                 //}
                 foreach (int lid in LocationID)
                 {
                     DataRow[] row = dt.Select("LocationID=" + lid + "");
                     for (int i = 0; i < row.Count(); i++)
                     {
                         dt.Rows.Remove(row[i]);
                         dt.AcceptChanges();
                     }
                 }
                 dt.AcceptChanges();
             }
             Session["BlackBerryServers"]  = dt;
             BlackBerryGridView.DataSource = dt;
             BlackBerryGridView.DataBind();
         }
     }
     catch (Exception ex)
     {
         //6/27/2014 NS added for VSPLUS-634
         Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
         throw ex;
     }
 }