private void LoadGridData() { if (txtStmtEndPeriod.Text == "__/____") { LoadInitialGridData(); return; } statementRunBL = new StatementRunBL(); DataSet statementRunData = statementRunBL.GetStmtRunData(txtStmtEndPeriod.Text, out errorId); statementRunBL = null; if (statementRunData.Tables.Count != 0 && errorId != 2) { Session["StmntProcessDatat"] = statementRunData.Tables[0]; gvStmtRun.DataSource = statementRunData.Tables[0]; if (statementRunData.Tables[0].Rows.Count == 0) { gvStmtRun.EmptyDataText = "No data found for the selected period."; btnProcessStmts.Enabled = false; } gvStmtRun.DataBind(); } else if (statementRunData.Tables.Count == 0 && errorId != 2) { dtEmpty = new DataTable(); gvStmtRun.DataSource = dtEmpty; gvStmtRun.EmptyDataText = "No data found for the selected period."; btnProcessStmts.Enabled = false; gvStmtRun.DataBind(); } else { ExceptionHandler("Error in fetching grid data.", string.Empty); } }
protected void btnYesConfirmReprint_Click(object sender, EventArgs e) { try { mpeConfirmReprint.Hide(); List <int> stmtsToReprintDetail = new List <int>(); List <int> stmtsToReprintSummary = new List <int>(); List <int> stmtsToRun = new List <int>(); List <int> stmtsToRerun = new List <int>(); List <int> stmtsToArchive = new List <int>(); CheckBox cbReprintDetail; CheckBox cbReprintSummary; string stmtPeriodID; //loop thorugh grid and get selected list of statement ids to be run and archived foreach (GridViewRow row in gvStmtRun.Rows) { cbReprintDetail = (CheckBox)row.FindControl("cbReprintDetail"); cbReprintSummary = (CheckBox)row.FindControl("cbReprintSummary"); stmtPeriodID = (row.FindControl("hdnStmtPeriodID") as Label).Text; if (cbReprintDetail.Checked == true) { stmtsToReprintDetail.Add(Convert.ToInt32(stmtPeriodID)); } if (cbReprintSummary.Checked == true) { stmtsToReprintSummary.Add(Convert.ToInt32(stmtPeriodID)); } } statementRunBL = new StatementRunBL(); string loggedUserID = WebUtility.HtmlDecode(System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString()); DataSet statementRunData = statementRunBL.UpdatestmtRunData(stmtsToRun.ToArray(), stmtsToRerun.ToArray(), stmtsToArchive.ToArray(), stmtsToReprintDetail.ToArray(), stmtsToReprintSummary.ToArray(), txtStmtEndPeriod.Text, loggedUserID, out errorId); statementRunBL = null; //WUIN-746 clearing sort hidden files hdnSortExpression.Value = string.Empty; hdnSortDirection.Value = string.Empty; if (statementRunData.Tables.Count != 0 && errorId != 2) { gvStmtRun.DataSource = statementRunData.Tables[0]; if (statementRunData.Tables[0].Rows.Count == 0) { gvStmtRun.EmptyDataText = "No data found for the selected period."; } gvStmtRun.DataBind(); } else if (statementRunData.Tables.Count == 0 && errorId != 2) { dtEmpty = new DataTable(); gvStmtRun.DataSource = dtEmpty; gvStmtRun.EmptyDataText = "No data found for the selected period."; gvStmtRun.DataBind(); } else { ExceptionHandler("Error in updating reprint data.", string.Empty); } msgView.SetMessage("Statement reprint has been set up and will be generated in the next run of the statement generation.", MessageType.Warning, PositionType.Auto); } catch (ThreadAbortException ex1) { // do nothing } catch (Exception ex) { ExceptionHandler("Error in updating reprint data.", ex.Message); } finally { mpeConfirmReprint.Hide(); } }
protected void btnArchive_Click(object sender, EventArgs e) { try { List <int> stmtsToRun = new List <int>(); List <int> stmtsToRerun = new List <int>(); List <int> stmtsToArchive = new List <int>(); List <int> stmtsToReprintDetail = new List <int>(); List <int> stmtsToReprintSummary = new List <int>(); CheckBox cbRerunStmt; CheckBox cbArchiveStmt; CheckBox cbReprintDetail; CheckBox cbReprintSummary; string stmtPeriodID; bool valRerunArchive = true; //loop thorugh grid and get selected list of statement ids to be run and archived foreach (GridViewRow row in gvStmtRun.Rows) { cbRerunStmt = (CheckBox)row.FindControl("cbRerunStmt"); cbArchiveStmt = (CheckBox)row.FindControl("cbArchiveStmt"); cbReprintDetail = (CheckBox)row.FindControl("cbReprintDetail"); cbReprintSummary = (CheckBox)row.FindControl("cbReprintSummary"); stmtPeriodID = (row.FindControl("hdnStmtPeriodID") as Label).Text; if (cbArchiveStmt.Checked && (cbRerunStmt.Checked || cbReprintDetail.Checked || cbReprintSummary.Checked)) { valRerunArchive = false; break; } if (cbArchiveStmt.Checked == true) { stmtsToArchive.Add(Convert.ToInt32(stmtPeriodID)); } } if (valRerunArchive != true) { //pop up message msgView.SetMessage("Please select only archive for a statement period.", MessageType.Warning, PositionType.Auto); } else { if (stmtsToArchive.Count > 0) { statementRunBL = new StatementRunBL(); string loggedUserID = WebUtility.HtmlDecode(System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString()); DataSet statementRunData = statementRunBL.UpdatestmtRunData(stmtsToRun.ToArray(), stmtsToRerun.ToArray(), stmtsToArchive.ToArray(), stmtsToReprintDetail.ToArray(), stmtsToReprintSummary.ToArray(), txtStmtEndPeriod.Text, loggedUserID, out errorId); statementRunBL = null; //WUIN-746 clearing sort hidden files hdnSortExpression.Value = string.Empty; hdnSortDirection.Value = string.Empty; if (statementRunData.Tables.Count != 0 && errorId != 2) { gvStmtRun.DataSource = statementRunData.Tables[0]; if (statementRunData.Tables[0].Rows.Count == 0) { gvStmtRun.EmptyDataText = "No data found for the selected period."; } gvStmtRun.DataBind(); } else if (statementRunData.Tables.Count == 0 && errorId != 2) { dtEmpty = new DataTable(); gvStmtRun.DataSource = dtEmpty; gvStmtRun.EmptyDataText = "No data found for the selected period."; gvStmtRun.DataBind(); } else { ExceptionHandler("Error in updating data.", string.Empty); } /* WOS-384 - changes - Harish - 10-11-16 * try * { * string message; * CommonBL commonBl = new CommonBL(); * commonBl.RunStatementArchive(out message, out errorId); * commonBl = null; * if (errorId == 0) * { * msgView.SetMessage(message, MessageType.Warning, PositionType.Auto); * } * else if (errorId == 2) * { * msgView.SetMessage("Error in triggering statement archive.", MessageType.Warning, PositionType.Auto); * } * } * catch (Exception ex) * { * ExceptionHandler("Error in triggering statement archive.", ex.Message); * } * */ //if (errorId == 1) //{ // msgView.SetMessage("One or more Royaltor statements cannot be archived, Contract is held. Archive has been requested for the rest. The process should be triggered from the Workflow when the status of Royaltors has been checked.", // MessageType.Warning, PositionType.Auto); //} //else //{ // msgView.SetMessage("Archive has been requested. The process should be triggered from the Workflow when the status of Royaltors has been checked.", // MessageType.Warning, PositionType.Auto); //} //JIRA-923 Changes done by Ravi on 14-12-2018 -- Start CommonBL commonBl = new CommonBL(); commonBl.RunStatementArchive(out errorId); commonBl = null; //if (errorId == 1) //{ // msgView.SetMessage("There are outstanding payments to be generated for the statements requested to be archived. Statements cannot be archived until those payments are generated.", // MessageType.Warning, PositionType.Auto); //} if (errorId == 3 || errorId == 4) { if (errorId == 3) { msgView.SetMessage("Archive has already been scheduled. No further action is required.", MessageType.Warning, PositionType.Auto); } else if (errorId == 4) { msgView.SetMessage("The Archive cannot be scheduled as the process is not enabled. Please contact WARS Support.", MessageType.Warning, PositionType.Auto); } } else if (errorId == 2) { msgView.SetMessage("Error in triggering statement archive.", MessageType.Warning, PositionType.Auto); } else { msgView.SetMessage("The Archive is scheduled and will run as a background job until complete.", MessageType.Warning, PositionType.Auto); } //JIRA-923 Changes done by Ravi on 14-12-2018 -- End //================== End } else { /* WOS-384 - changes - Harish - 10-11-16 * mpeRunArchive.Show(); * lblConfirmMessage.Text = "Archive option is not selected for any of the statement periods. Do you want to trigger statement archive?"; * */ msgView.SetMessage("Please select Archive option for the statement periods.", MessageType.Warning, PositionType.Auto); //================== End } } } catch (ThreadAbortException ex1) { // do nothing } catch (Exception ex) { ExceptionHandler("Error in updating data.", ex.Message); } }