예제 #1
0
 private void FillExchangeServerGridfromSession()
 {
     try
     {
         DataTable DSTaskSettingsDataTable = new DataTable();
         if (Session["ExchangeServer"] != null && Session["ExchangeServer"] != "")
         {
             DSTaskSettingsDataTable = (DataTable)Session["ExchangeServer"];//VSWebBL.ConfiguratorBL.ExchangePropertiesBL.Ins.GetAllData();
         }
         if (DSTaskSettingsDataTable.Rows.Count > 0)
         {
             MSServerGridView.DataSource = DSTaskSettingsDataTable;
             MSServerGridView.DataBind();
         }
     }
     catch (Exception ex)
     {
         //6/27/2014 NS added for VSPLUS-634
         Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
         throw ex;
     }
     finally { }
 }
예제 #2
0
        private void FillExchangeServerGrid()
        {
            try
            {
                DataTable DSTaskSettingsDataTable = new DataTable();

                DSTaskSettingsDataTable = VSWebBL.ConfiguratorBL.DAGBL.Ins.GetAllData();
                if (DSTaskSettingsDataTable.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 DSTaskSettingsDataTable.Rows)
                            {
                                if (resser["serverid"].ToString() == Exchangerow["ID"].ToString())
                                {
                                    ServerID.Add(DSTaskSettingsDataTable.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)
                        {
                            DSTaskSettingsDataTable.Rows[Id].Delete();
                        }
                        DSTaskSettingsDataTable.AcceptChanges();

                        //foreach (int Lid in LocationID)
                        //{
                        //    DSTaskSettingsDataTable.Rows[Lid].Delete();
                        //}
                        foreach (int lid in LocationID)
                        {
                            DataRow[] row = DSTaskSettingsDataTable.Select("locationid=" + lid + "");
                            for (int i = 0; i < row.Count(); i++)
                            {
                                DSTaskSettingsDataTable.Rows.Remove(row[i]);
                                DSTaskSettingsDataTable.AcceptChanges();
                            }
                        }
                        DSTaskSettingsDataTable.AcceptChanges();
                    }
                    Session["ExchangeServer"]   = DSTaskSettingsDataTable;
                    MSServerGridView.DataSource = DSTaskSettingsDataTable;
                    MSServerGridView.DataBind();
                }
            }
            catch (Exception ex)
            {
                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }