private ELSMaster CollectDataForELS(string Mode, DataRow ELSRow) { VSFramework.TripleDES tripleDes = new VSFramework.TripleDES(); try { ELSMaster EventMasterObject = new ELSMaster(); EventMasterObject.EventName = ELSRow["EventName"].ToString(); EventMasterObject.AliasName = ELSRow["AliasName"].ToString(); Session["ELSUpdateStatus"] = EventMasterObject.AliasName; EventMasterObject.EventKey = ELSRow["EventKey"].ToString(); EventMasterObject.EventId = ELSRow["EventId"].ToString(); EventMasterObject.EventLevel = ELSRow["EventLevel"].ToString(); EventMasterObject.Source = ELSRow["Source"].ToString(); EventMasterObject.TaskCategory = ELSRow["TaskCategory"].ToString(); if (Mode == "Update") { EventMasterObject.ID = int.Parse(ELSRow["ID"].ToString()); } return(EventMasterObject); } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
private LogFile CollectDataForELS(string Mode, DataRow DELSRow) { VSFramework.TripleDES tripleDes = new VSFramework.TripleDES(); try { //ELSMaster EventMasterObject = new ELSMaster(); LogFile LogObject = new LogFile(); LogObject.Keyword = DELSRow["Keyword"].ToString(); LogObject.NotRequiredKeyword = DELSRow["NotRequiredKeyword"].ToString(); LogObject.RepeatOnce = Convert.ToBoolean(DELSRow["RepeatOnce"]); LogObject.Log = Convert.ToBoolean(DELSRow["Log"]); LogObject.AgentLog = Convert.ToBoolean(DELSRow["AgentLog"]); //LogObject.DominoEventLogId = Convert.ToInt32(DELSRow["DominoEventLogId"]); //EventMasterObject.EventName = ELSRow["EventName"].ToString(); //EventMasterObject.AliasName = ELSRow["AliasName"].ToString(); //Session["ELSUpdateStatus"] = EventMasterObject.AliasName; //EventMasterObject.EventKey = ELSRow["EventKey"].ToString(); //EventMasterObject.EventId = ELSRow["EventId"].ToString(); //EventMasterObject.EventLevel = ELSRow["EventLevel"].ToString(); //EventMasterObject.Source = ELSRow["Source"].ToString(); //EventMasterObject.TaskCategory = ELSRow["TaskCategory"].ToString(); if (Mode == "Update") { LogObject.ID = int.Parse(DELSRow["ID"].ToString()); } return(LogObject); } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
private Credentials CollectDataForCredentials(string Mode, DataRow CredentialsRow) { VSFramework.TripleDES tripleDes = new VSFramework.TripleDES(); try { Credentials CredentialsObject = new Credentials(); CredentialsObject.AliasName = CredentialsRow["AliasName"].ToString(); Session["CredentialsUpdateStatus"] = CredentialsObject.AliasName; CredentialsObject.UserID = CredentialsRow["UserID"].ToString(); ServerTypes STypeobject = new ServerTypes(); STypeobject.ServerType = CredentialsRow["ServerType"].ToString(); ServerTypes ReturnValue = VSWebBL.SecurityBL.ServerTypesBL.Ins.GetDataForServerType(STypeobject); CredentialsObject.ServerTypeID = ReturnValue.ID; string rawPass; if (Mode == "Insert") { if (Session["password"] != null) { rawPass = Session["password"].ToString(); } else { rawPass = ""; } } else { rawPass = CredentialsRow["Password"].ToString(); } byte[] encryptedPass; string encryptedPassAsString; //7/10/2015 NS modified for VSPLUS-1985 if (rawPass == "test") { encryptedPassAsString = rawPass; } else { encryptedPass = tripleDes.Encrypt(rawPass); encryptedPassAsString = string.Join(", ", encryptedPass.Select(s => s.ToString()).ToArray()); } CredentialsObject.Password = encryptedPassAsString; //if (Password.Text != "") //{ // if (PasswordTextBox.Text == " ") // PasswordTextBox.Text = ViewState["PWD"].ToString(); // TripleDES tripleDES = new TripleDES(); // byte[] encryptedPass = tripleDES.Encrypt(PasswordTextBox.Text); // string encryptedPassAsString = string.Join(", ", encryptedPass.Select(s => s.ToString()).ToArray()); // CredentialsObject.Password = encryptedPassAsString; //} if (Mode == "Update") { CredentialsObject.ID = int.Parse(CredentialsRow["ID"].ToString()); } return(CredentialsObject); } catch (Exception ex) { //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
protected void CurrValButton_Click(object sender, EventArgs e) { //CurrentValue(); //11//2014 NS added for VSPLUS-1133 byte[] MyPass; string MyDominoPassword; //should be string string MyObjPwd; string[] MyObjPwdArr; VSFramework.TripleDES mySecrets = new VSFramework.TripleDES(); try { MyObjPwd = VSWebBL.SettingBL.SettingsBL.Ins.Getvalue("Password"); if (MyObjPwd != "") { MyObjPwdArr = MyObjPwd.Split(','); MyPass = new byte[MyObjPwdArr.Length]; for (int i = 0; i < MyObjPwdArr.Length; i++) { MyPass[i] = Byte.Parse(MyObjPwdArr[i]); } } else { //10/6/2014 NS modified for VSPLUS-990 errorDiv.InnerHtml = "The following error has occurred: Notes password may not be empty. Please update the password under Stored Passwords & Options\\IBM Domino Settings." + "<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"; MyPass = null; } } catch (Exception ex) { 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"; MyPass = null; //5/15/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } try { if (MyPass != null) { MyDominoPassword = mySecrets.Decrypt(MyPass); } else { MyDominoPassword = null; } } catch (Exception ex) { 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"; MyDominoPassword = ""; //5/15/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } //3/25/2014 NS modified for VSPLUS-494 if (MyDominoPassword != null) { Domino.NotesSession NotesSessionObject = new Domino.NotesSession(); try { NotesSessionObject.Initialize(MyDominoPassword); CurrentValTextBox.Text = NotesSessionObject.SendConsoleCommand(DServerComboBox.Text, "sh stat " + DStatComboBox.Text); } catch (Exception ex) { //7/8/2013 NS modified - the code now handles an exception gracefully //throw ex; //11/3/2014 NS modified /* * ErrorMessageLabel.Text = "Notes session could not be initialized."; * ErrorMessagePopupControl.HeaderText = "Initialization Failure"; * ValidationUpdatedButton.Visible = true; * ValidationOkButton.Visible = false; * ErrorMessagePopupControl.ShowOnPageLoad = true; */ //11/3/2014 NS added 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); } finally { } System.Runtime.InteropServices.Marshal.ReleaseComObject(NotesSessionObject); } }
protected void btn_Clickeditserver(object sender, EventArgs e) { int ID; ImageButton btn = (ImageButton)sender; ID = Convert.ToInt32(btn.CommandArgument); int id = ID; WebsphereCell ProfileNamesObject = new WebsphereCell(); if (id != null) { ProfileNamesObject.CellID = id; } bool s = true; if (s == true) { DataTable celldt = VSWebBL.SecurityBL.webspehereImportBL.Ins.GetSpecificCellData(id); Session["webcellid"] = id; VitalSignsWebSphereDLL.VitalSignsWebSphereDLL WSDll = new VitalSignsWebSphereDLL.VitalSignsWebSphereDLL(); VitalSignsWebSphereDLL.VitalSignsWebSphereDLL.CellProperties cellFromInfo = new VitalSignsWebSphereDLL.VitalSignsWebSphereDLL.CellProperties(); //Set properties for Cell to pass to DLL cellFromInfo.HostName = celldt.Rows[0]["HostName"].ToString(); cellFromInfo.Port = Convert.ToInt32(celldt.Rows[0]["PortNo"].ToString()); cellFromInfo.ConnectionType = celldt.Rows[0]["ConnectionType"].ToString(); cellFromInfo.Realm = celldt.Rows[0]["Realm"].ToString(); //int credid = Convert.ToInt32(celldt.Rows[0][""].ToString()); Credentials creds = new Credentials(); //creds.AliasName = CredentialsComboBox.Text.ToString(); creds.ID = Convert.ToInt32(celldt.Rows[0]["CredentialsID"].ToString()); DataTable dt = VSWebBL.ConfiguratorBL.CredentialsBL.Ins.getCredentialsById(creds); if (dt.Rows.Count > 0) { string password; string MyObjPwd; string[] MyObjPwdArr; byte[] MyPass; MyObjPwd = dt.Rows[0]["Password"].ToString(); MyObjPwdArr = MyObjPwd.Split(','); MyPass = new byte[MyObjPwdArr.Length]; for (int i = 0; i < MyObjPwdArr.Length; i++) { MyPass[i] = Byte.Parse(MyObjPwdArr[i]); } VSFramework.TripleDES tripleDes = new VSFramework.TripleDES(); password = tripleDes.Decrypt(MyPass); cellFromInfo.UserName = dt.Rows[0]["UserID"].ToString(); cellFromInfo.Password = password; } else { throw new Exception("Username and Password could not be retreived"); } cellFromInfo.ID = id; //Call VitalSignsWebSphereDLL.VitalSignsWebSphereDLL.Cells cells = null; try { cells = WSDll.getServerList(cellFromInfo); foreach (VitalSignsWebSphereDLL.VitalSignsWebSphereDLL.Cell cell in cells.Cell) { bool ReturnValue; ReturnValue = VSWebBL.SecurityBL.webspehereImportBL.Ins.Insertwebspherenodesandservers(cell, id); if (ReturnValue == true) { NodesTreeList.Visible = true; CollapseAllButton.Visible = true; ImportButton.Visible = true; //expandButton(); } else { NodesTreeList.Visible = false; CollapseAllButton.Visible = false; ImportButton.Visible = false; } } } catch (Exception ex) { errorDivForImportingWS.Style.Value = "display: block"; errorDivForImportingWS.InnerHtml = "An error occurred. " + ex.Message + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>"; return; } //checks to see if a connection was successfully made //cells should never be null, it should hti the return before it is null and hits this spot if (cells != null && cells.Connection_Status != "CONNECTED") { errorDivForImportingWS.Style.Value = "display: block"; errorDivForImportingWS.InnerHtml = "A connection was not able to be made." + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>"; return; } else { errorDivForImportingWS.Style.Value = "display: none"; /////////////////////////////////////////////////////////////////////// //This is where the population of the tree graph should be /////////////////////////////////////////////////////////////////////// // 6/22/15 WS commented out for it not being needed anymore. All insertion of data should be done on the OK press now (Which will be taken care of by Mukund and his team) //Insertdata(); } fillNodesTreeListbycellID(id); //FillWebsphereNodeStatusGrid(id); // { // int index = NodesTreeList.FocusedRowIndex; // if (index > -1) // { // nodevalue = Convert.ToInt32(NodesTreeList.GetRowValues(index, "NodeID").ToString()); // } // } // //Response.Redirect("~/Configurator/EditProfiles.aspx?id=" + id.ToString(), false); // //Context.ApplicationInstance.CompleteRequest(); } //DecodeCellsXML("C:\\Program Files (x86)\\IBM\\WebSphere\\AppClient\\VitalSigns\\xml\\AppServerList.xml"); }