/* * private void FillNodesSettingsGrid() * { * try * { * * DataTable NodesSettings = new DataTable(); * NodesSettings = VSWebBL.SecurityBL.NodesBL.Ins.GetAllDatafromNodes(); * if (NodesSettings.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 NodesSettings.Rows) * { * * if (resser["serverid"].ToString() == Windowsrow["ID"].ToString()) * { * ServerID.Add(NodesSettings.Rows.IndexOf(Windowsrow)); * } * if (resser["locationID"].ToString() == Windowsrow["locationid"].ToString()) * { * LocationID.Add(Convert.ToInt32(Windowsrow["locationid"].ToString())); * } * } * * } * foreach (int Id in ServerID) * { * NodesSettings.Rows[Id].Delete(); * } * NodesSettings.AcceptChanges(); * foreach (int lid in LocationID) * { * DataRow[] row = NodesSettings.Select("locationid=" + lid + ""); * for (int i = 0; i < row.Count(); i++) * { * NodesSettings.Rows.Remove(row[i]); * NodesSettings.AcceptChanges(); * } * } * NodesSettings.AcceptChanges(); * } * Session["NodeServer"] = NodesSettings; * NodesGridView.DataSource = NodesSettings; * NodesGridView.DataBind(); * } * } * catch (Exception ex) * { * Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); * throw ex; * } * finally { } * } * private void FillNodeSettingsGridfromSession() * { * try * { * * DataTable NodesSettings = new DataTable(); * if (Session["NodeServer"] != null && Session["NodeServer"] != "") * NodesSettings = (DataTable)Session["NodeServer"];//VSWebBL.ConfiguratorBL.WindowsPropertiesBL.Ins.GetAllData(); * if (NodesSettings.Rows.Count > 0) * { * NodesGridView.DataSource = NodesSettings; * NodesGridView.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 FillAssignNodesgrid() { try { DataTable ASSignNodesSettings = new DataTable(); ASSignNodesSettings = VSWebBL.SecurityBL.NodesBL.Ins.GetforAssignNodes(); if (ASSignNodesSettings.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 ASSignNodesSettings.Rows) { if (resser["serverid"].ToString() == Windowsrow["ID"].ToString()) { ServerID.Add(ASSignNodesSettings.Rows.IndexOf(Windowsrow)); } if (resser["locationID"].ToString() == Windowsrow["locationid"].ToString()) { LocationID.Add(Convert.ToInt32(Windowsrow["locationid"].ToString())); } } } foreach (int Id in ServerID) { ASSignNodesSettings.Rows[Id].Delete(); } ASSignNodesSettings.AcceptChanges(); foreach (int lid in LocationID) { DataRow[] row = ASSignNodesSettings.Select("locationid=" + lid + ""); for (int i = 0; i < row.Count(); i++) { ASSignNodesSettings.Rows.Remove(row[i]); ASSignNodesSettings.AcceptChanges(); } } ASSignNodesSettings.AcceptChanges(); } Session["AssignNodeServer"] = ASSignNodesSettings; AssignNodesGridView.DataSource = ASSignNodesSettings; AssignNodesGridView.DataBind(); } } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
private void UpdateServersData() { try { //List<object> fieldValues = new List<object>(); List <object> fieldValues = AssignNodesGridView.GetSelectedFieldValues(new string[] { "ID" }); DataTable dt = GetSelectedServices(); List <DataRow> servicesSelected = dt.AsEnumerable().ToList(); if (servicesSelected.Count > 0) { foreach (DataRow row in servicesSelected) { if (row["id"] != null) { fieldValues.Add(row["id"]); } } } Object result2 = VSWebBL.SecurityBL.NodesBL.Ins.Updatenodes(Convert.ToInt32(ServerNodes.SelectedItem.Value), fieldValues); Object ReturnValue = Session["AssignNodeServer"]; if (ReturnValue.ToString() == "True") { Response.Redirect("~/Security/AssignServerToNode.aspx", false); Context.ApplicationInstance.CompleteRequest(); } } catch (Exception ex) { //10/13/2014 NS modified for VSPLUS-990 //errorDiv.InnerHtml = "The following error has occurred: " + ex.Message + // "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>"; //errorDiv.Style.Value = "display: block"; //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); } }
private void FillAssignNodesgridfromSession() { try { DataTable ASSignNodesSettings = new DataTable(); if (Session["AssignNodeServer"] != null && Session["AssignNodeServer"] != "") { ASSignNodesSettings = (DataTable)Session["AssignNodeServer"]; //VSWebBL.ConfiguratorBL.WindowsPropertiesBL.Ins.GetAllData(); } if (ASSignNodesSettings.Rows.Count > 0) { AssignNodesGridView.DataSource = ASSignNodesSettings; AssignNodesGridView.DataBind(); } } catch (Exception ex) { //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }