Exemplo n.º 1
0
 private void FillLyncServerGridfromSession()
 {
     try
     {
         DataTable dt = new DataTable();
         if (Session["LyncServer"] != null && Session["LyncServer"] != "")
         {
             dt = (DataTable)Session["LyncServer"];//VSWebBL.ConfiguratorBL.ExchangePropertiesBL.Ins.GetAllData();
         }
         if (dt.Rows.Count > 0)
         {
             MSLyncGridView.DataSource = dt;
             MSLyncGridView.DataBind();
         }
     }
     catch (Exception ex)
     {
         //6/27/2014 NS added for VSPLUS-634
         Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
         throw ex;
     }
     finally { }
 }
Exemplo n.º 2
0
        private void FillLyncServerGrid()
        {
            try
            {
                DataTable dt = new DataTable();
                //DataTable DSTaskSettingsDataTable = new DataTable();
                if (Session["UserID"] != null)
                {
                    UserID = Convert.ToInt32(Session["UserID"]);
                }
                //dt = VSWebBL.ConfiguratorBL.LyncBL.Ins.GetAllData();
                dt = VSWebBL.ConfiguratorBL.LyncBL.Ins.GetAllDataByUser(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 resser in resServers.Rows)
                        {
                            foreach (DataRow Exchangerow in dt.Rows)
                            {
                                if (resser["serverid"].ToString() == Exchangerow["ID"].ToString())
                                {
                                    ServerID.Add(dt.Rows.IndexOf(Exchangerow));
                                }
                                if (resser["locationID"].ToString() == Exchangerow["locationid"].ToString())
                                {
                                    LocationID.Add(Convert.ToInt32(Exchangerow["locationid"].ToString()));
                                    //LocationID.Add(DSTaskSettingsDataTable.Rows.IndexOf(Exchangerow));
                                }
                            }
                        }
                        foreach (int Id in ServerID)
                        {
                            dt.Rows[Id].Delete();
                        }
                        dt.AcceptChanges();

                        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["LyncServer"]     = dt;
                    MSLyncGridView.DataSource = dt;
                    MSLyncGridView.DataBind();
                }
            }
            catch (Exception ex)
            {
                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }