protected void DELSGridView_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { try { DELSDataTable = (DataTable)Session["DELStable"]; if (Session["DELSDataTable"] != null && Session["DELSDataTable"] != "") { DELSDataTable = Session["DELSDataTable"] as DataTable; } ASPxGridView gridView = (ASPxGridView)sender; //6/24/2015 NS added for VSPLUS-1838 ASPxTextBox txtKeyword = (ASPxTextBox)DELSGridView.FindEditFormTemplateControl("LogFileTextBox"); ASPxTextBox txtNotRequiredKeyword = (ASPxTextBox)DELSGridView.FindEditFormTemplateControl("NotLogFileTextBox"); ASPxCheckBox LogFileCheckBox = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("LogFileCheckBox"); ASPxCheckBox logCheckBox = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("logCheckBox"); ASPxCheckBox AgentlogCheckBox = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("AgentlogCheckBox"); gridView.DoRowValidation(); UpdateData("Update", GetRow(DELSDataTable, e.NewValues.GetEnumerator(), Convert.ToInt32(e.Keys[0]))); //Update Grid after inserting new row, refresh grid as in page load gridView.CancelEdit(); e.Cancel = true; FillDELSGridfromSession(); } catch (Exception ex) { successDiv.InnerHtml = msgloc.ToString() + "Success." + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>"; successDiv.Style.Value = "display: block"; } }
protected void DELSGridView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { DELSDataTable = (DataTable)Session["DELStable"]; ASPxTextBox txtKeyword = (ASPxTextBox)DELSGridView.FindEditFormTemplateControl("LogFileTextBox"); ASPxTextBox txtNotRequiredKeyword = (ASPxTextBox)DELSGridView.FindEditFormTemplateControl("NotLogFileTextBox"); ASPxCheckBox LogFileCheckBox = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("LogFileCheckBox"); ASPxCheckBox logCheckBox = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("logCheckBox"); ASPxCheckBox AgentlogCheckBox = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("AgentlogCheckBox"); //UpdateEventMasterData("Insert", GetRow(DELSDataTable, e.NewValues.GetEnumerator(), -1)); try { if (Session["DELStable"] != null && Session["DELStable"] != "") { DELSDataTable = Session["DELStable"] as DataTable; } ASPxGridView gridView = (ASPxGridView)sender; UpdateData("Insert", GetRow(DELSDataTable, e.NewValues.GetEnumerator(), 0)); gridView.CancelEdit(); e.Cancel = true; FillDELSGridfromSession(); } catch (Exception ex) { errorDiv.InnerHtml = msgloc.ToString() + "<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"; } }
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 { } }
private void FillDELSGridfromSession() { try { DELSDataTable = new DataTable(); if (Session["DELStable"] != "" && Session["DELStable"] != null) { DELSDataTable = (DataTable)Session["DELStable"]; } if (DELSDataTable.Rows.Count > 0) { DELSDataTable.PrimaryKey = new DataColumn[] { DELSDataTable.Columns["ID"] }; } DELSGridView.DataSource = DELSDataTable; DELSGridView.DataBind(); } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
private void CollectData(string Mode, DataRow DELSRow) { try { DataTable DELSDataTable = Session["DELStable"] as DataTable; LogFile LogFileObject = new LogFile(); //ContentPlaceHolder cph = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1"); //ASPxGridView gv = (ASPxGridView)cph.FindControl("DELSGridView"); //cph.FindControl("LogFileGridView"); ASPxTextBox txtKeyword = (ASPxTextBox)DELSGridView.FindEditFormTemplateControl("LogFileTextBox"); ASPxTextBox txtNotRequiredKeyword = (ASPxTextBox)DELSGridView.FindEditFormTemplateControl("NotLogFileTextBox"); ASPxCheckBox LogFileCheckBox = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("LogFileCheckBox"); ASPxCheckBox logCheckBox = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("logCheckBox"); ASPxCheckBox AgentlogCheckBox = (ASPxCheckBox)DELSGridView.FindEditFormTemplateControl("AgentlogCheckBox"); LogFileObject.Keyword = txtKeyword.Text; LogFileObject.NotRequiredKeyword = txtNotRequiredKeyword.Text; //if (LogFileCheckBox.Checked == true) //{ // LogFileObject.RepeatOnce = true; //} //else //{ // LogFileObject.RepeatOnce = false; //} //if (logCheckBox.Checked == true) //{ // LogFileObject.Log = true; //} //else //{ // LogFileObject.Log = false; //} //if (AgentlogCheckBox.Checked == true) //{ // LogFileObject.AgentLog = true; //} //else //{ // LogFileObject.AgentLog = false; //} if (Mode == "Insert") { int maxid = 0; if (DELSDataTable.Rows.Count > 0) { DELSDataTable.DefaultView.Sort = "ID DESC"; maxid = int.Parse(DELSDataTable.DefaultView[0]["ID"].ToString()); } DataRow r = DELSDataTable.NewRow(); r["ID"] = maxid + 1; r["Keyword"] = txtKeyword.Text; r["NotRequiredKeyword"] = txtNotRequiredKeyword.Text; if (LogFileCheckBox.Checked) { r["RepeatOnce"] = 1; } else { r["RepeatOnce"] = 0; } if (logCheckBox.Checked) { r["Log"] = 1; } else { r["Log"] = 0; } if (AgentlogCheckBox.Checked) { r["AgentLog"] = 1; } else { r["AgentLog"] = 0; } DELSDataTable.Rows.Add(r); DELSDataTable.AcceptChanges(); Session["DELStable"] = DELSDataTable; } if (Mode == "Update") { DataRow[] dr = DELSDataTable.Select("ID=" + int.Parse(DELSRow["ID"].ToString())); //string days = ""; if (dr.Length > 0) { foreach (DataRow r in dr) { r["ID"] = int.Parse(DELSRow["ID"].ToString()); //if (DELSRow["AlertKey"].ToString() != "" && DELSRow["AlertKey"].ToString() != null) //{ // r["AlertKey"] = int.Parse(DELSRow["AlertKey"].ToString()); //} r["Keyword"] = txtKeyword.Text; r["NotRequiredKeyword"] = txtNotRequiredKeyword.Text; if (LogFileCheckBox.Checked) { r["RepeatOnce"] = 1; } else { r["RepeatOnce"] = 0; } if (logCheckBox.Checked) { r["Log"] = 1; } else { r["Log"] = 0; } if (AgentlogCheckBox.Checked) { r["AgentLog"] = 1; } else { r["AgentLog"] = 0; } DELSDataTable.AcceptChanges(); Session["DELStable"] = DELSDataTable; } } } } catch (Exception ex) { //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); } }