/// <summary> /// ノーツへ接続する /// (接続できない場合、Falseを返す) /// </summary> /// <param name="password"></param> /// <returns></returns> public bool TryConnect(string password) { try { this._session = new Domino.NotesSession(); this._session.Initialize(password); this._isInitialized = true; return(true); } catch { this._isInitialized = false; return(false); } }
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); } }
public void LoadDominoServers() { Domino.NotesDbDirectory dir; Domino.NotesDatabase db; Domino.NotesView view; Domino.NotesDocument doc; Domino.NotesName sname; Domino.NotesItem item; Domino.NotesItem item2; byte[] MyPass; string MyDominoPassword; //should be string string MyObjPwd; string[] MyObjPwdArr; //1/8/2014 NS added DataTable importedDT; //12/24/2013 NS added - store the value of the Domino Server field in the Settings table Primary Server column bool updatedsrv = false; updatedsrv = VSWebBL.SettingBL.SettingsBL.Ins.UpdateSvalue("Primary Server", DomServerTextBox.Text, VSWeb.Constants.Constants.SysString); //object MyObjPwd; //12/20/2013 NS added errorDiv.Style.Value = "display: none;"; //8/12/2014 NS added for VSPLUS-861 errorinfoDiv.Style.Value = "display: none"; DataTable LocationsDataTable = new DataTable(); LocationsDataTable = VSWebBL.SecurityBL.LocationsBL.Ins.GetAllData(); if (LocationsDataTable.Rows.Count > 0) { LocComboBox.DataSource = LocationsDataTable; LocComboBox.TextField = "Location"; LocComboBox.ValueField = "Location"; LocComboBox.DataBind(); LocIDComboBox.DataSource = LocationsDataTable; LocIDComboBox.TextField = "ID"; LocIDComboBox.ValueField = "ID"; LocIDComboBox.DataBind(); VSFramework.TripleDES mySecrets = new VSFramework.TripleDES(); try { MyObjPwd = VSWebBL.SettingBL.SettingsBL.Ins.Getvalue("Password"); //3/25/2014 NS modified for VSPLUS-494 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) { //12/20/2013 NS added //10/6/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"; //8/12/2014 NS added for VSPLUS-861 errorinfoDiv.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) { //12/20/2013 NS added //10/6/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"; //8/12/2014 NS added for VSPLUS-861 errorinfoDiv.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) { try { Domino.NotesSession NotesSessionObject = new Domino.NotesSession(); NotesSessionObject.Initialize(MyDominoPassword); dir = NotesSessionObject.GetDbDirectory(DomServerTextBox.Text); //db = dir.GetFirstDatabase(Domino.DB_TYPES.NOTES_DATABASE); db = dir.OpenDatabase("names.nsf"); view = db.GetView("($Servers)"); doc = view.GetFirstDocument(); DataTable dt = new DataTable(); DataRow dr = dt.NewRow(); //1/8/2014 NS added DataRow[] foundRows; dt.Columns.Add("ServerName", typeof(string)); dt.Columns.Add("IPAddress", typeof(string)); //1/8/2014 NS added - get a list of all servers already imported. Display only the ones that have not yet been imported. importedDT = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetServer(); while (doc != null) { item = doc.GetFirstItem("ServerName"); sname = NotesSessionObject.CreateName(item.Text); dr["ServerName"] = sname.Abbreviated; //1/8/2014 NS added foundRows = importedDT.Select("ServerName = '" + sname.Abbreviated + "'"); if (foundRows.Length == 0) { //5/16/2013 NS modified //item = doc.GetFirstItem("NetAddresses"); item = doc.GetFirstItem("SMTPFullHostDomain"); dr["IPAddress"] = item.Text; //2/5/2016 NS modified for VSPLUS-2068 if (item == null || item.Text == null || item.Text == "") { //1/26/2016 NS modified for VSPLUS-2068 item2 = doc.GetFirstItem("NetAddresses"); dr["IPAddress"] = item2.Text; if (item2 == null || item2.Text == null || item2.Text == "") { dr["IPAddress"] = "dummyaddress.yourdomain.com"; } } dt.Rows.Add(dr); dr = dt.NewRow(); } doc = view.GetNextDocument(doc); } //1/8/2014 NS modified if (dt.Rows.Count > 0) { //1/8/2014 NS added infoDiv.Style.Value = "display: block"; SrvCheckBoxList.DataSource = dt; SrvCheckBoxList.TextField = "ServerName"; SrvCheckBoxList.ValueField = "ServerName"; SrvCheckBoxList.DataBind(); IPCheckBoxList.DataSource = dt; IPCheckBoxList.TextField = "IPAddress"; IPCheckBoxList.ValueField = "IPAddress"; IPCheckBoxList.DataBind(); //12/20/2013 NS added ASPxRoundPanel1.Visible = true; } else { //10/6/2014 NS modified for VSPLUS-990 errorDiv.InnerHtml = "There are no new servers in the address book that have not already been imported into VitalSigns." + "<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"; } } catch (Exception ex) { //12/20/2013 NS added //10/6/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"; //8/12/2014 NS added for VSPLUS-861 errorinfoDiv.Style.Value = "display: block"; db = null; dir = null; view = null; doc = null; //5/15/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); } } } //5/13/2014 NS added for VSPLUS-183 else { //10/6/2014 NS modified for VSPLUS-990 errorDiv.InnerHtml = "All imported servers must be assigned to a location. There were no locations found. Please create at least one location entry using the 'Setup & Security - Maintain Server Locations' menu option." + "<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"; } }