/// <summary> /// Insert data into NotesDatabases table /// </summary> /// <param name="DSObject">NotesDatabases object</param> /// <returns></returns> public bool InsertData(NotesDatabases NDObject) { bool Insert = false; //1/15/2016 NS modified for VSPLUS-2501 int paramnum = 0; string[] paramnames = new string[16]; string[] paramvalues = new string[16]; try { paramnum = 16; paramnames[0] = "@name"; paramnames[1] = "@category"; paramnames[2] = "@scaninterval"; paramnames[3] = "@offhrscaninterval"; paramnames[4] = "@serverid"; paramnames[5] = "@enabled"; paramnames[6] = "@respthreshold"; paramnames[7] = "@retryinterval"; paramnames[8] = "@servername"; paramnames[9] = "@filename"; paramnames[10] = "@triggertype"; paramnames[11] = "@triggerval"; paramnames[12] = "@abovebelow"; paramnames[13] = "@repdest"; paramnames[14] = "@initrep"; paramnames[15] = "@id"; paramvalues[0] = NDObject.Name; paramvalues[1] = NDObject.Category; paramvalues[2] = Convert.ToString(NDObject.ScanInterval); paramvalues[3] = Convert.ToString(NDObject.OffHoursScanInterval); paramvalues[4] = Convert.ToString(NDObject.ServerID); paramvalues[5] = Convert.ToString(NDObject.Enabled); paramvalues[6] = Convert.ToString(NDObject.ResponseThreshold); paramvalues[7] = Convert.ToString(NDObject.RetryInterval); paramvalues[8] = NDObject.ServerName; paramvalues[9] = NDObject.FileName; paramvalues[10] = NDObject.TriggerType; paramvalues[11] = Convert.ToString(NDObject.TriggerValue); paramvalues[12] = NDObject.AboveBelow; paramvalues[13] = NDObject.ReplicationDestination; paramvalues[14] = Convert.ToString(NDObject.InitiateReplication); paramvalues[15] = Convert.ToString(NDObject.ID); string SqlQuery = "INSERT INTO NotesDatabases (Name,Category,ScanInterval,OffHoursScanInterval,Enabled,ResponseThreshold" + ",RetryInterval,ServerID,ServerName,FileName,TriggerType,TriggerValue,AboveBelow,ReplicationDestination,InitiateReplication)" + "VALUES(" + paramnames[0] + "," + paramnames[1] + "," + paramnames[2] + "," + paramnames[3] + "," + paramnames[5] + "," + paramnames[6] + "," + paramnames[7] + "," + paramnames[4] + "," + paramnames[8] + "," + paramnames[9] + "," + paramnames[10] + "," + paramnames[11] + "," + paramnames[12] + "," + paramnames[13] + "," + paramnames[14] + ")"; Insert = objAdaptor.ExecuteQueryWithParams(SqlQuery, paramnum, paramnames, paramvalues); } catch { Insert = false; } return(Insert); }
public DataTable GetName(NotesDatabases NDObj) { try { return(VSWebDAL.ConfiguratorDAL.NotesDatabaseDAL.Ins.GetName(NDObj)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Call DAL Delete Data /// </summary> /// <param name="NDObject"></param> /// <returns></returns> public Object DeleteData(NotesDatabases NDObject) { try { return(VSWebDAL.ConfiguratorDAL.NotesDatabaseDAL.Ins.DeleteData(NDObject)); } catch (Exception ex) { throw ex; } }
public NotesDatabases GetDataOnID(NotesDatabases NDObject) { try { return(VSWebDAL.ConfiguratorDAL.NotesDatabaseDAL.Ins.GetDataOnID(NDObject)); } catch (Exception ex) { throw ex; } }
private void InsertNotesDatabase() { NotesDatabases NDObj = new NotesDatabases(); NDObj.Name = NameTextBox.Text; DataTable returntable = VSWebBL.ConfiguratorBL.NotesDatabaseBL.Ins.GetName(NDObj); if (returntable.Rows.Count > 0) { ErrorMessageLabel.Text = "This Notes Database name is already in use. Each db name must be unique to make sense on the Overall Health tab. Please enter a different name."; ErrorMessagePopupControl.ShowOnPageLoad = true; flag = true; NameTextBox.Focus(); } else { try { object ReturnValue = VSWebBL.ConfiguratorBL.NotesDatabaseBL.Ins.InsertData(CollectDataForNotesDatabase()); SetFocusOnError(ReturnValue); if (ReturnValue.ToString() == "True") { /* * ErrorMessageLabel.Text = "Data inserted successfully."; * ErrorMessagePopupControl.HeaderText = "Information"; * ErrorMessagePopupControl.ShowCloseButton = false; * ValidationUpdatedButton.Visible = true; * ValidationOkButton.Visible = false; * ErrorMessagePopupControl.ShowOnPageLoad = true; */ //12/8/2014 NS modified to redirect to the server grid page Session["NotesDBUpdateStatus"] = NameTextBox.Text; Response.Redirect("NotesDatabase.aspx", false);//Mukund, 05Aug14, VSPLUS-844:Page redirect on callback Context.ApplicationInstance.CompleteRequest(); } } catch (Exception ex) { errorDiv.Style.Value = "display: block"; //10/3/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>"; //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } } }
protected void NotesDatabaseGridView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { NotesDatabases NDObject = new NotesDatabases(); NDObject.ID = Convert.ToInt32(e.Keys[0]); //Delete row from DB Object ReturnValue = VSWebBL.ConfiguratorBL.NotesDatabaseBL.Ins.DeleteData(NDObject); //Update Grid after inserting new row, refresh grid as in page load ASPxGridView gridView = (ASPxGridView)sender; gridView.CancelEdit(); e.Cancel = true; FillNotesDatabaseGrid(); }
public DataTable GetName(NotesDatabases NDObj) { //SametimeServers SametimeObj = new SametimeServers(); DataTable NotesTable = new DataTable(); try { string sqlQuery = "Select * from NotesDatabases where Name='" + NDObj.Name + "'"; NotesTable = objAdaptor.FetchData(sqlQuery); } catch (Exception ex) { throw ex; } return(NotesTable); }
//delete Data from NotesDatabases Table public Object DeleteData(NotesDatabases NDObject) { Object Update; try { string SqlQuery = "Delete NotesDatabases Where ID=" + NDObject.ID; Update = objAdaptor.ExecuteNonQuery(SqlQuery); } catch { Update = false; } finally { } return(Update); }
/// <summary> /// Call to Update Data of NotesDatabases based on Key /// </summary> /// <param name="NDObject">NotesDatabases object</param> /// <returns>Object</returns> public Object UpdateData(NotesDatabases NDObject) { Object ReturnValue = ValidateDCUpdate(NDObject); try { if (ReturnValue.ToString() == "") { return(VSWebDAL.ConfiguratorDAL.NotesDatabaseDAL.Ins.UpdateData(NDObject)); } else { return(ReturnValue); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Get Data from NotesDatabase based on ID /// </summary> /// <returns></returns> public NotesDatabases GetDataOnID(NotesDatabases NDObject) { NotesDatabases ReturnNDObject = new NotesDatabases(); DataTable NotesDatabasesDataTable = new DataTable(); try { string SqlQuery = "SELECT *,(select servername from servers where id=NotesDatabases.serverid) as servernames FROM NotesDatabases where ID=" + NDObject.ID.ToString(); NotesDatabasesDataTable = objAdaptor.FetchData(SqlQuery); if (NotesDatabasesDataTable.Rows.Count > 0) { ReturnNDObject.ID = int.Parse(NotesDatabasesDataTable.Rows[0]["ID"].ToString()); ReturnNDObject.Name = NotesDatabasesDataTable.Rows[0]["Name"].ToString(); ReturnNDObject.Category = NotesDatabasesDataTable.Rows[0]["TriggerType"].ToString(); ReturnNDObject.ScanInterval = int.Parse(NotesDatabasesDataTable.Rows[0]["ScanInterval"].ToString()); ReturnNDObject.OffHoursScanInterval = int.Parse(NotesDatabasesDataTable.Rows[0]["OffHoursScanInterval"].ToString()); ReturnNDObject.Enabled = bool.Parse(NotesDatabasesDataTable.Rows[0]["Enabled"].ToString()); ReturnNDObject.ResponseThreshold = int.Parse(NotesDatabasesDataTable.Rows[0]["ResponseThreshold"].ToString()); ReturnNDObject.RetryInterval = int.Parse(NotesDatabasesDataTable.Rows[0]["RetryInterval"].ToString()); ReturnNDObject.ServerName = NotesDatabasesDataTable.Rows[0]["servernames"].ToString(); ReturnNDObject.FileName = NotesDatabasesDataTable.Rows[0]["FileName"].ToString(); ReturnNDObject.TriggerType = NotesDatabasesDataTable.Rows[0]["TriggerType"].ToString(); ReturnNDObject.TriggerValue = float.Parse(NotesDatabasesDataTable.Rows[0]["TriggerValue"].ToString()); ReturnNDObject.AboveBelow = NotesDatabasesDataTable.Rows[0]["AboveBelow"].ToString(); ReturnNDObject.ReplicationDestination = NotesDatabasesDataTable.Rows[0]["ReplicationDestination"].ToString(); ReturnNDObject.InitiateReplication = bool.Parse(NotesDatabasesDataTable.Rows[0]["InitiateReplication"].ToString()); } } catch (Exception ex) { throw ex; } finally { } return(ReturnNDObject); }
protected void ASPxDataView2_DataBound(object sender, EventArgs e) { // Mukund 10Jun2014 //VSPLUS-673: Executive Summary should have the same right-click menu as other screens try { ASPxDataView dataview = new ASPxDataView(); dataview = (ASPxDataView)sender; if (dataview.Items.Count > 0) { for (int j = 0; j < dataview.Items.Count; j++) { ASPxPanel panel = new ASPxPanel(); panel = (ASPxPanel)dataview.FindItemControl("ASPxPanel1", dataview.Items[j]); panel.BackColor = GetColor(dataview.Items[j].DataItem); string strURL = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority; string strURLFile = ""; string lblLoc = (dataview.Items[j].DataItem as DataRowView)["Location"].ToString(); //10/5/2015 NS modified for VSPLUS-2247 //string lblIP = (dataview.Items[j].DataItem as DataRowView)["IPAddress"].ToString(); string lbltext = (dataview.Items[j].DataItem as DataRowView)["Name"].ToString(); string lbltype = (dataview.Items[j].DataItem as DataRowView)["Type"].ToString(); //10/9/2014 NS added string lblstatus = (dataview.Items[j].DataItem as DataRowView)["Status"].ToString(); string Cat = (dataview.Items[j].DataItem as DataRowView)["Category"].ToString(); string lbltext1 = ""; //1/30/2015 NS added for VSPLUS-1367 string lblDate = (dataview.Items[j].DataItem as DataRowView)["LastUpdate"].ToString(); lbltext1 = lbltext; HtmlGenericControl divControl = (HtmlGenericControl)panel.FindControl("divmenu"); // e.Item.FindControl("divControl") as HtmlGenericControl; string imgtext = ""; imgtext = "<img src='" + (dataview.Items[j].DataItem as DataRowView)["imgsource"].ToString() + "'/>"; string lbl2 = ""; //lbl2 = "<font color='" + GetTextColor(dataview.Items[j].DataItem).ToString() + "' face='Tahoma' size='1'>" + (dataview.Items[j].DataItem as DataRowView)["Status"].ToString() + "</font>"; lbl2 = "<span class='" + GetTextCSS(dataview.Items[j].DataItem) + "'>" + (dataview.Items[j].DataItem as DataRowView)["Status"].ToString() + "</span>"; if (lbltext.Length > 16) { lbltext1 = lbltext.Substring(0, 14) + "..."; } if (!(Session["UserFullName"] != null && Session["UserFullName"].ToString() == "Anonymous")) { string stredit = ""; string strsuspend = ""; if (Session["Isconfigurator"] != null) { if (Session["Isconfigurator"].ToString() == "True") { stredit = " ,'edit" + j + "': { name: 'Edit in Configurator', icon: 'cut' }"; strsuspend = " ,'suspend" + j + "': { name: 'Suspend Temporarily', icon: 'copy' }"; } } string id = (VSWebBL.SecurityBL.ServersBL.Ins.GetServerIDbyServerNameType(lbltext, lbltype)).ToString(); if (lbltype == "Exchange") { //10/5/2015 NS modified for VSPLUS-2247 strURLFile = "/Configurator/ExchangeServer.aspx?ID=" + id + "&name=" + lbltext + "&Cat=Exchange&Loc=" + lblLoc; // + "&ipaddr=" + lblIP; } else if (lbltype == "Mail") { id = (VSWebBL.ConfiguratorBL.MailServicesBL.Ins.GetServerIDbyServerName(lbltext)).ToString(); strURLFile = "/Configurator/MailService.aspx?Key=" + id; } else if (lbltype == "Skype for Business") { strURLFile = "/Configurator/LyncServer.aspx?ID=" + id + "&Name=" + lbltext + "&Cat=" + Cat + "&Loc=" + lblLoc; } else if (lbltype == "SharePoint") { strURLFile = "/Configurator/SharepointServer.aspx?ID=" + id + "&Name=" + lbltext + "&Cat=" + Cat + "&Loc=" + lblLoc; } else if (lbltype.ToString() == "BES") { id = (VSWebBL.SecurityBL.ServersBL.Ins.GetServerIDbyServerName(lbltext)).ToString(); strURLFile = "/Configurator/BlackBerryEntertpriseServer.aspx?Key=" + id; } else if (lbltype == "Sametime") { id = (VSWebBL.SecurityBL.ServersBL.Ins.GetServerIDbyServerName(lbltext)).ToString(); strURLFile = "/Configurator/SametimeServer.aspx?ID=" + id; } else if (lbltype == "Network Device") { id = (VSWebBL.ConfiguratorBL.NetworkDevicesBL.Ins.GetServerIDbyServerName(lbltext)).ToString(); strURLFile = "/Configurator/NetworkDeviceProperties.aspx?ID=" + id; } else if (lbltype == "URL") { id = (VSWebBL.ConfiguratorBL.URLsBL.Ins.GetServerIDbyServerName(lbltext)).ToString(); strURLFile = "/Configurator/URLProperties.aspx?ID=" + id; } else if (lbltype == "Notes Database") { NotesDatabases nodj = new NotesDatabases(); nodj.Name = lbltext; DataTable dt = VSWebBL.ConfiguratorBL.NotesDatabaseBL.Ins.GetName(nodj); if (dt.Rows.Count > 0) { id = dt.Rows[0]["ID"].ToString(); } strURLFile = "/Configurator/EditNotes.aspx?ID=" + id; } else if (lbltype == "NotesMail Probe") { strURLFile = "/Configurator/EditNotesMailProbe.aspx?Name=" + lbltext; } else if (lbltype == "ExchangeMail Probe") { strURLFile = "/Configurator/EditExchangeMailProbe.aspx?Name=" + lbltext; } else if (lbltype == "Windows") { id = (VSWebBL.SecurityBL.ServersBL.Ins.GetServerIDbyServerName(lbltext)).ToString(); strURLFile = "/Configurator/WindowsProperties.aspx?ID=" + id + "&Name=" + lbltext + "&Cat=" + Cat + "&Loc=" + lblLoc; } else if (lbltype == "Active Directory") { id = (VSWebBL.SecurityBL.ServersBL.Ins.GetServerIDbyServerName(lbltext)).ToString(); //10/5/2015 NS modified for VSPLUS-2247 strURLFile = "/Configurator/ActiveDirectoryProperties.aspx?ID=" + id + "&name=" + lbltext + "&Cat=" + Cat + "&Loc=" + lblLoc; // +"&ipaddr=" + lblIP; } //5/9/2016 Sowjanya modified for VSPLUS-2943 else if (lbltype == "IBM Connections") { id = (VSWebBL.SecurityBL.ServersBL.Ins.GetServerIDbyServerName(lbltext)).ToString(); strURLFile = "/Configurator/IBMConnections.aspx?ID=" + id + "&name=" + lbltext + "&Cat=" + Cat + "&Loc=" + lblLoc; // +"&ipaddr=" + lblIP; } else if (lbltype == "Office365") { strURLFile = "/Configurator/O365ServerProperties.aspx"; } else { strURLFile = "/Configurator/DominoProperties.aspx?Key=" + id; } //lbltext1 = "<strong><font color='Black' face='Tahoma' size='2'><a class='dlink' href='DominoServerDetailsPage2.aspx?Name=" + lbltext + "&Type=Domino'>" + lbltext1 + "</a></font></strong>"; //1/30/2015 NS modified for VSPLUS-1367 //lbltext1 = "<a class='ahrefdom' href='DominoServerDetailsPage2.aspx?Name=" + lbltext + "&Type=Domino&Status=" + lblstatus + "'>" + lbltext1 + "</a>"; //10/5/2015 NS modified for VSPLUS-2247 if (lbltype == "Domino") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='DominoServerDetailsPage2.aspx?Name=" + lbltext + "&Type=" + lbltype + "&Status=" + lblstatus + "'>" + lbltext1 + "</a>"; } else if (lbltype == "Exchange") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='ExchangeServerDetailsPage3.aspx?Name=" + lbltext + "&Type=" + lbltype + "&Status=" + lblstatus + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "Database Availability Group") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='DAGHealth.aspx?Name=" + lbltext + "'>" + lbltext1 + "</a>"; } else if (lbltype == "SharePoint") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='Sharepointdetailspage.aspx?Name=" + lbltext + "&Type=" + lbltype + "&Status=" + lblstatus + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "Active Directory") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='ActiveDirectoryServerDetailsPage3.aspx?Name=" + lbltext + "&Type=" + lbltype + "&Status=" + lblstatus + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "URL") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='URLDetails.aspx?Name=" + lbltext + "&Type=" + lbltype + "&Status=" + lblstatus + "'>" + lbltext1 + "</a>"; } else if (lbltype == "Sametime") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='SametimeServerDetailsPage.aspx?Name=" + lbltext + "&Type=" + lbltype + "&Status=" + lblstatus + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "Notes Database") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='DominoServerDetailsPage2.aspx?Name=" + lbltext + "&Type=" + lbltype + "&Status=" + lblstatus + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "Office365") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='office365health.aspx?Name=" + lbltext + "&Type=" + lbltype + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "NotesMail Probe") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='NotesMailProbeDetailsPage.aspx?Name=" + lbltext + "&Type=" + lbltype + "&Status=" + lblstatus + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "Skype for Business") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='Lyncdetailspage.aspx?Name=" + lbltext + "&Type=" + lbltype + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "BES") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='BlackBerryServerDetailsPage2.aspx?Name=" + lbltext + "&Type=" + lbltype + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "ExchangeMail Probe") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='ExchangeMailProbeDetailsPage.aspx?Name=" + lbltext + "&Type=" + lbltype + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "Windows") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='WindowsServerDetails.aspx?Name=" + lbltext + "&Type=" + lbltype + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "Network Device") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='NetworkServerDetails.aspx?Name=" + lbltext + "&Type=" + lbltype + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else if (lbltype == "SNMP Device") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='SNMPDeviceDetails.aspx?Name=" + lbltext + "&Type=" + lbltype + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } //5/12/2016 Sowjanya modified for VSPLUS-2943 else if (lbltype == "IBM Connections") { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='ConnectionsDetailsPage.aspx?Name=" + lbltext + "&Type=" + lbltype + "&Status=" + lblstatus + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } else { lbltext1 = "<a class='ahrefdom' title='" + lbltext + "' href='DominoServerDetailsPage2.aspx?Name=" + lbltext + "&Type=" + lbltype + "&Status=" + lblstatus + "&LastDate=" + lblDate + "'>" + lbltext1 + "</a>"; } divControl.InnerHtml = " <div class='context-menu-one" + j + "'><table id='tbl' class='boxshadow' runat='server'>" + " <tr>" + " <td>" + imgtext + " </td>" + "<td>" + " <div style='overflow: visible'>" + lbltext1 + " </div>" + " </td>" + " </tr>" + " <tr>" + " <td>" + " </td>" + " <td>" + lbl2 + " </td>" + " </tr>" + "</table> </div>" + "<script type='text/javascript'>" + " $(function () {" + " $.contextMenu({" + " selector: '.context-menu-one" + j + "'," + " callback: function (key, options) {" + " var m = key; " + " var scan_n = 'scan" + j + "'; " + " var edit_n = 'edit" + j + "'; " + " var suspend_n = 'suspend" + j + "'; " + " if(m==edit_n){window.location.replace('" + strURL + strURLFile + "');}" + " if(m==scan_n){ScanNow('" + lbltext + "','" + lbltype + "');}" + " if(m==suspend_n){SuspendNow('" + lbltext + "');}" + " }," + " items: {" + " 'scan" + j + "': { name: 'Scan Now', icon: 'edit' }" + stredit + strsuspend + " }" + " });" + "" + " $('.context-menu-one" + j + "').on('click', function (e) {" + " console.log('clicked', this); " + " })" + " });" + " " + " </script>"; } else { lbltext1 = "<strong><font color='Black' face='Tahoma' size='2'>" + lbltext1 + "</font></strong>"; divControl.InnerHtml = " <table id='tbl' class='boxshadow' runat='server'>" + " <tr>" + " <td>" + imgtext + " </td>" + "<td>" + " <div style='overflow: visible'>" + lbltext1 + " </div>" + " </td>" + " </tr>" + " <tr>" + " <td>" + " </td>" + " <td>" + lbl2 + " </td>" + " </tr>" + "</table>"; } } } } catch (Exception ex) { throw ex; } }
/// <summary> /// Validation before submitting data for Server tab /// </summary> /// <param name="NDObject"></param> /// <returns></returns> public Object ValidateDCUpdate(NotesDatabases NDObject) { Object ReturnValue = ""; try { if (NDObject.Name == null || NDObject.Name == "") { return("ER#Please enter a name to identify this Notes database."); } if (NDObject.ServerName == null || NDObject.ServerName == " ") { return("ER#Please select a licensed server."); } if (NDObject.TriggerValue == null || NDObject.TriggerValue.ToString() == "") { switch (NDObject.Category.ToString()) { case "Document Count": return("ER#Please enter a number of documents for this Notes database, over which will be considered 'too many'."); break; case "Database Size": return("ER#Please enter a size, over which the Notes database will be considered 'too big'."); break; case "Database Response Time": return("ER#Please enter a Response Threshold, in milliseconds, over which the device will be considered 'slow'."); break; } } if (NDObject.FileName == null || NDObject.FileName == " ") { return("ER#Please enter a database file name"); } if (NDObject.ScanInterval == null) { return("ER#Please enter a Scan Interval"); } if (NDObject.OffHoursScanInterval == null) { return("ER#Please enter an off-hours Scan Interval"); } if (NDObject.RetryInterval == null) { return("ER#Please enter a Retry Interval, to be used when the device is down."); } //if ((NDObject.RetryInterval)>(NDObject.ScanInterval)) //{ // return "ER#Please enter a Retry Interval that is less than the Scan Interval."; //} } catch (Exception ex) { throw ex; } finally { } return(""); }
/// <summary> /// Update data into NotesDatabases table /// </summary> /// <param name="NDObject">NotesDatabases object</param> /// <returns></returns> public Object UpdateData(NotesDatabases NDObject) { Object Update; int paramnum = 0; string[] paramnames = new string[16]; string[] paramvalues = new string[16]; try { paramnum = 16; paramnames[0] = "@name"; paramnames[1] = "@category"; paramnames[2] = "@scaninterval"; paramnames[3] = "@offhrscaninterval"; paramnames[4] = "@serverid"; paramnames[5] = "@enabled"; paramnames[6] = "@respthreshold"; paramnames[7] = "@retryinterval"; paramnames[8] = "@servername"; paramnames[9] = "@filename"; paramnames[10] = "@triggertype"; paramnames[11] = "@triggerval"; paramnames[12] = "@abovebelow"; paramnames[13] = "@repdest"; paramnames[14] = "@initrep"; paramnames[15] = "@id"; paramvalues[0] = NDObject.Name; paramvalues[1] = NDObject.Category; paramvalues[2] = Convert.ToString(NDObject.ScanInterval); paramvalues[3] = Convert.ToString(NDObject.OffHoursScanInterval); paramvalues[4] = Convert.ToString(NDObject.ServerID); paramvalues[5] = Convert.ToString(NDObject.Enabled); paramvalues[6] = Convert.ToString(NDObject.ResponseThreshold); paramvalues[7] = Convert.ToString(NDObject.RetryInterval); paramvalues[8] = NDObject.ServerName; paramvalues[9] = NDObject.FileName; paramvalues[10] = NDObject.TriggerType; paramvalues[11] = Convert.ToString(NDObject.TriggerValue); paramvalues[12] = NDObject.AboveBelow; paramvalues[13] = NDObject.ReplicationDestination; paramvalues[14] = Convert.ToString(NDObject.InitiateReplication); paramvalues[15] = Convert.ToString(NDObject.ID); //string SqlQuery = "UPDATE NotesDatabases SET Name='" + NDObject.Name + "',Category='" + NDObject.Category + // "',ScanInterval='" + NDObject.ScanInterval + "',OffHoursScanInterval='" + NDObject.OffHoursScanInterval + // "',ServerID="+NDObject.ServerID+",Enabled='" + NDObject.Enabled + // "',ResponseThreshold='" + NDObject.ResponseThreshold + "', RetryInterval='" + NDObject.RetryInterval + // "',ServerName='" + NDObject.ServerName + // "',FileName='" + NDObject.FileName + "',TriggerType='" + NDObject.TriggerType + "',TriggerValue=" + NDObject.TriggerValue + // ",AboveBelow='" + NDObject.AboveBelow + "',ReplicationDestination='" + NDObject.ReplicationDestination + // "',InitiateReplication='" + NDObject.InitiateReplication + "' WHERE ID = " + NDObject.ID + ""; //Update = objAdaptor.ExecuteNonQuery(SqlQuery); string SqlQuery = "UPDATE NotesDatabases SET Name=" + paramnames[0] + ",Category=" + paramnames[1] + ",ScanInterval=" + paramnames[2] + ",OffHoursScanInterval=" + paramnames[3] + ",ServerID=" + paramnames[4] + ",Enabled=" + paramnames[5] + ",ResponseThreshold=" + paramnames[6] + ",RetryInterval=" + paramnames[7] + ",ServerName=" + paramnames[8] + ",FileName=" + paramnames[9] + ",TriggerType=" + paramnames[10] + ",TriggerValue=" + paramnames[11] + ",AboveBelow=" + paramnames[12] + ",ReplicationDestination=" + paramnames[13] + ",InitiateReplication=" + paramnames[14] + " WHERE ID = " + paramnames[15]; Update = objAdaptor.ExecuteQueryWithParams(SqlQuery, paramnum, paramnames, paramvalues); } catch { Update = false; } finally { } return(Update); }
private NotesDatabases CollectDataForNotesDatabase() { //SetFocusOnControl(); try { //Edit Notes NotesDatabases NDObject = new NotesDatabases(); if (Mode == "Update") { NDObject.ID = ID; } //ND profile NDObject.Name = NameTextBox.Text; if (DominoServerComboBox.SelectedItem != null) { NDObject.ServerID = int.Parse(DominoServerComboBox.SelectedItem.Value.ToString()); NDObject.ServerName = DominoServerComboBox.SelectedItem.Text; } NDObject.FileName = DBFileNameTextBox.Text; //Scan Settings NDObject.RetryInterval = int.Parse(RetryIntervalTextBox.Text); //if (IsNumeric(OffHoursTextBox.Text) == false) //{ // // NDObject.OffHoursScanInterval = int.Parse(OffHoursTextBox.Text); // OffHoursTextBox.Focus(); //} //OffHoursTextBox.Focus(); //} NDObject.OffHoursScanInterval = int.Parse(OffHoursTextBox.Text); NDObject.ScanInterval = int.Parse(ScanIntervalTextBox.Text); NDObject.Enabled = EnabledCheckBox.Checked; //Type Roundpanel if (TriggerValueTextBox.Text != "") { NDObject.ResponseThreshold = int.Parse(TriggerValueTextBox.Text); } NDObject.InitiateReplication = InitiateRepCheckBox.Checked; NDObject.Category = AlertTypeComboBox.Text; if (TriggerValueTextBox.Text != "") { NDObject.TriggerValue = float.Parse(TriggerValueTextBox.Text); } NDObject.TriggerType = AlertTypeComboBox.Text; //7/30/2013 NS added NDObject.AboveBelow = ""; //Figure out which servers are selected try { myIndex = 0; if (ServerListBox.SelectedItems.Count > 0) { foreach (Object item in ServerListBox.SelectedItems) { myIndex = 0; foreach (Object server in DominoServerComboBox.Items) { if (server.ToString() == item.ToString()) { //string myServers=""; myServers += ServerListBox.Items[myIndex].ToString() + ","; } myIndex += 1; } // Debug.Print(item.ToString) } } } catch (Exception ex) { //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } try { //if(myServers!="") myServers = myServers.Substring(0, myServers.Length - 1); } catch (Exception ex) { myServers = ""; // throw ex; //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); } finally { } NDObject.ReplicationDestination = myServers; return(NDObject); } 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 FillData(int ID) { try { if (ID > 0) { NotesDatabases NDObject = new NotesDatabases(); NDObject.ID = ID; NDObject = VSWebBL.ConfiguratorBL.NotesDatabaseBL.Ins.GetDataOnID(NDObject); //ND profile NameTextBox.Text = NDObject.Name; DominoServerComboBox.Text = NDObject.ServerName; DBFileNameTextBox.Text = NDObject.FileName; //Scan Settings RetryIntervalTextBox.Text = NDObject.RetryInterval.ToString(); OffHoursTextBox.Text = NDObject.OffHoursScanInterval.ToString(); ScanIntervalTextBox.Text = NDObject.ScanInterval.ToString(); EnabledCheckBox.Checked = NDObject.Enabled; //Type Roundpanel TriggerValueTextBox.Text = NDObject.ResponseThreshold.ToString(); InitiateRepCheckBox.Checked = NDObject.InitiateReplication; AlertTypeComboBox.Text = NDObject.Category.ToString(); //11/19/2014 NS modified /* * if (TriggerValueTextBox.Text != "0" && AlertTypeComboBox.Text != "Replication") * { * TriggerValueTextBox.Visible = true; * } */ DisplayLabels(); // string [] lines = new string[ServerListBox.Items.Count]; // for(int i=0;i<ServerListBox.Items.Count; i++) // { ////lines[i] = lb.GetItemText(lb.Items[i]); // this could be safer if you're using other objects than strings. // // or // lines[i] = ServerListBox.Items[i].ToString(); // } if (NDObject.Category.ToString() == "Replication") { Serverkeys = ""; Serverkeys = NDObject.ReplicationDestination; ServerListBox.Enabled = true; ServerListBox.Visible = true; ServerLabel.Visible = true; InitiateRepCheckBox.Visible = true; InitiateRepCheckBox.Enabled = true; // Split the string at the space characters words = Serverkeys.Split(','); bool Found; try { //'Explode the keys into an array, and use each key to locate the appropriate server for (int i = 0; i < ServerListBox.Items.Count - 1; i++) { Found = false; foreach (string x in words) { if (x.ToString().Trim() == ServerListBox.Items[i].Text.Trim()) //lines[i].ToString()) { Found = true; } } if (Found == true) { ServerListBox.Items[i].Selected = true; } } } catch (Exception ex) { //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } } else { //If the type is not Replication, just load the box with all the servers, none selected. for (int i = 0; i < DominoServerComboBox.Items.Count - 1; i++) { //Me.ListBox1.Items.Add(DominoServerlist(n)) ServerListBox.Items.Add(DominoServerComboBox.Items[i].ToString()); } } } else { RetryIntervalTextBox.Text = "2"; OffHoursTextBox.Text = "30"; ScanIntervalTextBox.Text = "8"; EnabledCheckBox.Checked = true; } } catch (Exception ex) { //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }