private void FillURLsGridfromSession() { try { DataTable URLDataTable = new DataTable(); if (Session["URLs"] != "" && Session["URLs"] != null) { URLDataTable = (DataTable)Session["URLs"];//VSWebBL.ConfiguratorBL.DominoPropertiesBL.Ins.GetAllData(); } if (URLDataTable.Rows.Count >= 0) { URLsGridView.DataSource = URLDataTable; URLsGridView.DataBind(); } } catch (Exception ex) { //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
private void FillURLsGrid() { try { DataTable DSTaskSettingsDataTable = new DataTable(); DSTaskSettingsDataTable = VSWebBL.ConfiguratorBL.URLsBL.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 Windowsrow in DSTaskSettingsDataTable.Rows) { if (resser["serverid"].ToString() == Windowsrow["ID"].ToString()) { ServerID.Add(DSTaskSettingsDataTable.Rows.IndexOf(Windowsrow)); } if (resser["locationID"].ToString() == Windowsrow["locationid"].ToString()) { LocationID.Add(Convert.ToInt32(Windowsrow["locationid"].ToString())); //LocationID.Add(DSTaskSettingsDataTable.Rows.IndexOf(Windowsrow)); } } } 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["URLs"] = DSTaskSettingsDataTable; URLsGridView.DataSource = DSTaskSettingsDataTable; URLsGridView.DataBind(); } catch (Exception ex) { //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }