public DataTable GetDataByAlertName(DominoEventLog NameObj) { DataTable AlertDataTable = new DataTable(); AlertNames Returnobject = new AlertNames(); try { if (NameObj.ID == 0) { string SqlQuery = "SELECT * FROM [DominoEventLog] where Name='" + NameObj.Name + "'"; //string SqlQuery = "SELECT * FROM Servers"; AlertDataTable = objAdaptor.FetchData(SqlQuery); } else { //7/3/2013 NS modified //string SqlQuery = "SELECT * FROM [Users] where LoginName='" + AlertsObject.AlertName + "' and AlertKey<>'" + AlertsObject.AlertKey + "'"; string SqlQuery = "SELECT * FROM [DominoEventLog] where Name='" + NameObj.Name + "' and ID<>" + NameObj.ID; AlertDataTable = objAdaptor.FetchData(SqlQuery); } } catch (Exception ex) { throw ex; } finally { } return(AlertDataTable); }
public DataTable GetDataByAlertName(DominoEventLog NameObj) { try { return(VSWebDAL.ConfiguratorDAL.DELSDAL.Ins.GetDataByAlertName(NameObj)); } catch (Exception ex) { throw ex; } }
private void FillDELSGrid() { try { DominoEventLog nameObj = new DominoEventLog(); nameObj.Name = EventNameTextBox.Text; DELSDataTable = new DataTable(); DELSDataTable = VSWebBL.ConfiguratorBL.DELSBL.Ins.GetDELSData(nameObj); //if (DELSDataTable.Rows.Count > 0) //{ // DELSDataTable.PrimaryKey = new DataColumn[] { DELSDataTable.Columns["ID"] }; //} DataTable dtcopy = DELSDataTable.Copy(); dtcopy.PrimaryKey = new DataColumn[] { dtcopy.Columns["ID"] }; Session["DELStable"] = dtcopy; DELSGridView.Selection.IsRowSelected(1); DELSGridView.DataSource = DELSDataTable; DELSGridView.DataBind(); //if (EventKey != 0) //{ // DataTable ELSDataTable1 = new DataTable(); // ELSDataTable1 = VSWebBL.ConfiguratorBL.ELSBL.Ins.GetSelectedEventsForKey(EventKey); // foreach (DataRow r in ELSDataTable1.Rows) // { // int startIndex = DELSGridView.PageIndex * DELSGridView.SettingsPager.PageSize; // int endIndex = Math.Min(DELSGridView.VisibleRowCount, startIndex + DELSGridView.SettingsPager.PageSize); // for (int i = startIndex; i < endIndex; i++) // { // DataRow row = DELSGridView.GetDataRow(i); // if (Convert.ToInt32(row[1]) == Convert.ToInt32(r[0])) // DELSGridView.Selection.SelectRow(i); // } // } //} } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
public DataTable GetDELSData(DominoEventLog nameObj) { DataTable Credentialstab = new DataTable(); try { // string SqlQuery = "Select * from Credentials"; string SqlQuery = "Select ID,DominoEventLogId, Keyword,RepeatOnce,NotRequiredKeyword,[Log],AgentLog from [LogFile] where DominoEventLogId=(select ID from DominoEventLog where Name='" + nameObj.Name + "')"; Credentialstab = objAdaptor.FetchData(SqlQuery); } catch (Exception ex) { throw ex; } return(Credentialstab); }
public void InsertAlertData(string flag) { try { if (Session["DELStable"] != null) { //6/24/2015 NS added List <int> list = new List <int>(); bool result = false; bool result2 = false, result3 = true; DataTable DELStable = Session["DELStable"] as DataTable; DataTable dt = new DataTable(); //AlertNames AltObj = new AlertNames(); //AlertDetails alertObj = new AlertDetails(); LogFile logObj = new LogFile(); DominoEventLog NameObj = new DominoEventLog(); NameObj.Name = EventNameTextBox.Text; NameObj.ID = EventKey; DataTable returntab = VSWebBL.ConfiguratorBL.DELSBL.Ins.GetDataByAlertName(NameObj); if (returntab.Rows.Count > 0) { //ErrorMessagePopupControl.ShowOnPageLoad = true; //ErrorMessageLabel.Text = "The Alert Name you entered already exists. Please enter a different name."; errorDiv.Style.Value = "display: block"; errorDiv.InnerHtml = "The Event Name you entered already exists. Please enter a different name." + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>"; } else { if (flag == "insert") { //result = VSWebBL.ConfiguratorBL.AlertsBL.Ins.InsertAlertName(); result = VSWebBL.ConfiguratorBL.DELSBL.Ins.insertEventName(EventNameTextBox.Text); for (int i = 0; i < DELStable.Rows.Count; i++) { logObj.Keyword = DELStable.Rows[i]["Keyword"].ToString(); logObj.NotRequiredKeyword = DELStable.Rows[i]["NotRequiredKeyword"].ToString(); logObj.RepeatOnce = Convert.ToBoolean(DELStable.Rows[i]["RepeatOnce"].ToString()); logObj.Log = Convert.ToBoolean(DELStable.Rows[i]["Log"].ToString()); logObj.AgentLog = Convert.ToBoolean(DELStable.Rows[i]["AgentLog"].ToString()); EventKey = VSWebBL.ConfiguratorBL.DELSBL.Ins.GetDominoEventLogIdbyName(EventNameTextBox.Text); //dt = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetDataByAlertName(collectAlertKey());//brijesh //alertObj.AlertKey = int.Parse(dt.Rows[0]["AlertKey"].ToString());//brijesh logObj.DominoEventLogId = EventKey; //AlertKey = alertObj.AlertKey; result2 = VSWebBL.ConfiguratorBL.DELSBL.Ins.InsertData(logObj); //result2 = VSWebBL.ConfiguratorBL.AlertsBL.Ins.InsertAlertDetails(alertObj);//brijesh } } else { if (flag == "update") { int i, j, l = 0; // logObj.ID = Convert.ToInt32(DELStable.Rows[0]["ID"].ToString()); //result = VSWebBL.ConfiguratorBL.AlertsBL.Ins.UpdateName(Session["ID"]); result = VSWebBL.ConfiguratorBL.DELSBL.Ins.updateEventName(EventKey, EventNameTextBox.Text); DataTable dt2 = VSWebBL.ConfiguratorBL.DELSBL.Ins.GetLogFilesData(EventKey); if (dt2.Rows.Count > 0) { for (i = 0; i < dt2.Rows.Count; i++) { int dtID = int.Parse(dt2.Rows[i]["ID"].ToString()); list.Add(dtID); for (j = i; j < DELStable.Rows.Count; j++, l = j) { if (int.Parse(DELStable.Rows[j]["ID"].ToString()) != 0) { int hoursTableID = int.Parse(DELStable.Rows[j]["ID"].ToString()); if (dtID == hoursTableID) { //19/05/2016 sowmya added for VSPLUS-2932 logObj.ID = Convert.ToInt32(DELStable.Rows[j]["ID"].ToString()); logObj.Keyword = DELStable.Rows[j]["Keyword"].ToString(); logObj.NotRequiredKeyword = DELStable.Rows[j]["NotRequiredKeyword"].ToString(); logObj.RepeatOnce = Convert.ToBoolean(DELStable.Rows[j]["RepeatOnce"].ToString()); logObj.Log = Convert.ToBoolean(DELStable.Rows[j]["Log"].ToString()); logObj.AgentLog = Convert.ToBoolean(DELStable.Rows[j]["AgentLog"].ToString()); logObj.DominoEventLogId = EventKey; result3 = VSWebBL.ConfiguratorBL.DELSBL.Ins.UpdateLogfileDetails(logObj); } } } } if (dt2.Rows.Count < DELStable.Rows.Count) { for (int x = 0; x < DELStable.Rows.Count; x++) { int DELStableID = int.Parse(DELStable.Rows[x]["ID"].ToString()); if (!list.Contains(DELStableID)) { //19/05/2016 sowmya added for VSPLUS-2932 logObj.ID = Convert.ToInt32(DELStable.Rows[x]["ID"].ToString()); logObj.Keyword = DELStable.Rows[x]["Keyword"].ToString(); logObj.NotRequiredKeyword = DELStable.Rows[x]["NotRequiredKeyword"].ToString(); logObj.RepeatOnce = Convert.ToBoolean(DELStable.Rows[x]["RepeatOnce"].ToString()); logObj.Log = Convert.ToBoolean(DELStable.Rows[x]["Log"].ToString()); logObj.AgentLog = Convert.ToBoolean(DELStable.Rows[x]["AgentLog"].ToString()); logObj.DominoEventLogId = EventKey; result3 = VSWebBL.ConfiguratorBL.DELSBL.Ins.InsertData(logObj); } } } } else { for (int k = 0; k < DELStable.Rows.Count; k++) { //19/05/2016 sowmya added for VSPLUS-2932 logObj.ID = Convert.ToInt32(DELStable.Rows[k]["ID"].ToString()); logObj.Keyword = DELStable.Rows[k]["Keyword"].ToString(); logObj.NotRequiredKeyword = DELStable.Rows[k]["NotRequiredKeyword"].ToString(); logObj.RepeatOnce = Convert.ToBoolean(DELStable.Rows[k]["RepeatOnce"].ToString()); logObj.Log = Convert.ToBoolean(DELStable.Rows[k]["Log"].ToString()); logObj.AgentLog = Convert.ToBoolean(DELStable.Rows[k]["AgentLog"].ToString()); logObj.DominoEventLogId = EventKey; result3 = VSWebBL.ConfiguratorBL.DELSBL.Ins.InsertData(logObj); } } } } bool retnServers = false, retnHours = false; if (result == true || result2 == true || result3 == true) { //Servers & locations string EventName = EventNameTextBox.Text; EventKey = VSWebBL.ConfiguratorBL.DELSBL.Ins.GetDominoEventLogIdbyName(EventNameTextBox.Text); //retnServerTypes = VSWebBL.ConfiguratorBL.AlertsBL.Ins.InsertRestrictedServerTypes(AlertName, RestrictedServertypes()); //retnEvents = VSWebBL.ConfiguratorBL.AlertsBL.Ins.InsertRestrictedEvents(AlertName, RestrictedEvents()); //retnLocations = VSWebBL.ConfiguratorBL.AlertsBL.Ins.InsertRestrictedLocations(AlertName, RestrictedLocations()); //retnServers = VSWebBL.ConfiguratorBL.AlertsBL.Ins.InsertRestrictedServers(AlertName, RestrictedServers()); //loop //retnHours = VSWebBL.ConfiguratorBL.AlertsBL.Ins.InsertHours(AlertName, Hourstable); //retnHours = true; //retnEvents = VSWebBL.ConfiguratorBL.AlertsBL.Ins.InsertSelectedEvents(AlertKey, GetSelectedEvents(AlertKey)); retnServers = VSWebBL.ConfiguratorBL.DELSBL.Ins.InsertSelectedServers(EventKey, GetSelectedServers(EventKey)); } if (retnServers == true) { if (flag == "insert") { ErrorMessageLabel.Text = "New record created successfully."; } if (flag == "update") { ErrorMessageLabel.Text = "Record updated successfully."; } ErrorMessagePopupControl.HeaderText = "Information"; ErrorMessagePopupControl.ShowCloseButton = false; ValidationUpdatedButton.Visible = true; ValidationOkButton.Visible = false; ErrorMessagePopupControl.ShowOnPageLoad = true; } } } } catch (Exception ex) { } }