protected void gvCertInfo_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvRow = (GridViewRow)((Button)e.CommandSource).NamingContainer; StopPaymentRemove oStopPayRemove = (StopPaymentRemove)Session[Constants.SES_STOPPAY_REMOVE_MARK]; if (oStopPayRemove != null && gvRow != null) { oStopPayRemove.DtStopPayRemoveDetail.Rows.RemoveAt(gvRow.RowIndex); DataTable dtTmp = oStopPayRemove.DtStopPayRemoveDetail.Copy(); if (dtTmp.Columns.Contains("SPScripID")) { dtTmp.Columns.Remove("SPScripID"); } gvCertInfo.DataSource = dtTmp; gvCertInfo.DataBind(); Session[Constants.SES_STOPPAY_REMOVE_MARK] = oStopPayRemove; } decimal dTotalAmount = 0m; foreach (GridViewRow gvr in gvCertInfo.Rows) { dTotalAmount += Util.GetDecimalNumber(gvr.Cells[1].Text); } txtCDTotalAmount.Text = dTotalAmount.ToString("N2"); }
protected void btnSave_Click(object sender, EventArgs e) { Config oConfig = (Config)Session[Constants.SES_USER_CONFIG]; if (oConfig != null) { if (ddlCDDenom.Items.Count > 1) { StopPaymentRemove oStopPayRemove = GetObject(); StopPaymentDAL oSPDAL = new StopPaymentDAL(); oStopPayRemove.UserDetails = ucUserDet.UserDetail; oStopPayRemove.UserDetails.MakeDate = DateTime.Now; ucUserDet.ResetData(); Result oResult = oSPDAL.SaveStopPayRemoveMark(oStopPayRemove); if (oResult.Status) { TotalClear(); LoadPreviousList(); ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR); } } else { ucMessage.OpenMessage(Constants.MSG_APPROVED_SAVE_DATA, Constants.MSG_TYPE_INFO); ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true); } } }
protected void btnApprove_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hdStopPayRemoveTransNo.Value)) { StopPaymentRemove oStopPayRemove = new StopPaymentRemove(hdStopPayRemoveTransNo.Value); oStopPayRemove.StopPayment.StopPaymentTransNo = txtStopTransNo.Text; StopPaymentDAL oStopPayDAL = new StopPaymentDAL(); oStopPayRemove.UserDetails = ucUserDet.UserDetail; Result oResult = (Result)oStopPayDAL.ApproveStopPayRemoveMark(oStopPayRemove); if (oResult.Status) { ReportDAL rdal = new ReportDAL(); oResult = rdal.StopPaymentLetter(Constants.LETTER_TYPE_STOP_REMOVE, txtStopPayRemoveTransNo.Text.Trim()); if (oResult.Status) { Session[Constants.SES_RPT_DATA] = oResult.Return; Page.RegisterStartupScript(Constants.REPORT_WINDOW, Util.OpenReport2(1)); } ClearAfterApprove(); //ucMessage.OpenMessage(Constants.MSG_SUCCESS_APPROVE, Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_APPROVE, Constants.MSG_TYPE_ERROR); } } else { ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND + " to Approve", Constants.MSG_TYPE_INFO); } }
private void LoadDataByRegNo(string sTransNo, string sRegNo, string sApprovalStaus) { StopPaymentDAL oStopPayDAL = new StopPaymentDAL(); Result oResult = null; if (hdButtonType.Value.Equals("S"))//StopPayment search { oResult = (Result)oStopPayDAL.LoadStopPayRemoveMarkByRegNo("", sTransNo, sRegNo, ""); } else if (hdButtonType.Value.Equals("D") || SEARCH_FROM.Equals(3)) //StopPayment Remove search { oResult = (Result)oStopPayDAL.LoadStopPayRemoveMarkByRegNo(sTransNo, "", sRegNo, sApprovalStaus); } TotalClear(); if (oResult.Status) { StopPaymentRemove oStopPayRemove = (StopPaymentRemove)oResult.Return; SetObject(oStopPayRemove); if (hdDataType.Value.Equals("2") && hdButtonType.Value.Equals("D")) { EnableDisableControl(true); Util.ControlEnabled(btnReject, false); Util.ControlEnabled(btnApprove, false); Util.ControlEnabled(btnBack, false); Util.ControlEnabled(btnReset, true); Util.ControlEnabled(btnSave, true); Util.ControlEnabled(btnDelete, true); btnRegSearch.Enabled = true; btnRemoveSearch.Enabled = true; fsList.Visible = true; } else if (SEARCH_FROM.Equals(3)) { EnableDisableControl(true); Util.ControlEnabled(ucUserDet.FindControl("txtCheckerComments"), true); } else { EnableDisableControl(false); } hdButtonType.Value = ""; } else { ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR); } }
protected void ddlCDDenom_SelectedIndexChanged(object sender, EventArgs e) { ddlCDCertif.Items.Clear(); if (!string.IsNullOrEmpty(ddlCDDenom.SelectedValue)) { StopPaymentRemove oStopPayRemove = (StopPaymentRemove)Session[Constants.SES_STOPPAY_REMOVE_MARK]; DDListUtil.Add(ddlCDCertif, "", ""); //Filtered by Denomination List <Scrip> filteredScripList = oStopPayRemove.Issue.ScripList.Where(s => s.Denomination.DenominationID.ToString().Equals(ddlCDDenom.SelectedValue)).ToList(); for (int iScripCount = 0; iScripCount < filteredScripList.Count; iScripCount++) { DDListUtil.Add(ddlCDCertif, filteredScripList[iScripCount].SPSeries + " " + filteredScripList[iScripCount].SlNo, filteredScripList[iScripCount].SPScripID.ToString()); } } }
private StopPaymentRemove GetObject() { StopPaymentRemove oStopPayRemove = (StopPaymentRemove)Session[Constants.SES_STOPPAY_REMOVE_MARK]; if (oStopPayRemove != null) { if (string.IsNullOrEmpty(oStopPayRemove.StopPaymentRemoveTransNo)) { oStopPayRemove.StopPaymentRemoveTransNo = "-1"; } oStopPayRemove.Remarks = txtRemoveRemarks.Text; oStopPayRemove.StopPaymentRemoveAmount = Util.GetDecimalNumber(txtCDTotalAmount.Text); oStopPayRemove.StopPaymentRemoveDate = Util.GetDateTimeByString(txtRemoveDate.Text); oStopPayRemove.UserDetails = ucUserDet.UserDetail; } return(oStopPayRemove); }
protected void btnReject_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hdStopPayRemoveTransNo.Value)) { StopPaymentRemove oStopPayRemove = new StopPaymentRemove(hdStopPayRemoveTransNo.Value); StopPaymentDAL oStopPayDAL = new StopPaymentDAL(); oStopPayRemove.UserDetails = ucUserDet.UserDetail; Result oResult = (Result)oStopPayDAL.RejectStopPayRemoveMark(oStopPayRemove); if (oResult.Status) { ucMessage.OpenMessage(Constants.MSG_SUCCESS_REJECT, Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_REJECT, Constants.MSG_TYPE_ERROR); } } else { ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND + " to Reject", Constants.MSG_TYPE_INFO); } }
private void TotalClear() { EnableDisableControl(false); // Stop Payment Remove Mark set in session StopPaymentRemove oStopPayRemoveMark = new StopPaymentRemove(); if (Session[Constants.SES_STOPPAY_MARK] == null) { Session.Add(Constants.SES_STOPPAY_MARK, oStopPayRemoveMark); } else { Session[Constants.SES_STOPPAY_MARK] = oStopPayRemoveMark; } gvCustomerDetail.DataSource = null; gvCustomerDetail.DataBind(); gvNomDetail.DataSource = null; gvNomDetail.DataBind(); gvCertInfo.DataSource = null; gvCertInfo.DataBind(); hdStopPayRemoveTransNo.Value = ""; hdIssueTransNo.Value = ""; hdRegNo.Value = ""; // hdButtonType.Value = ""; //Stop Payment Remove Mark Transaction No txtStopPayRemoveTransNo.Text = string.Empty; txtRemoveDate.Text = DateTime.Now.ToString(Constants.DATETIME_FORMAT); //Issue Details Util.ControlEnabled(txtStopTransNo, true); if (ddlBranch.Items.Count > 0) { ddlBranch.SelectedIndex = 0; } txtRegNo.Text = string.Empty; txtIssueDate.Text = string.Empty; txtIssueName.Text = string.Empty; txtStopAmount.Text = string.Empty; ddlCustomerType.Items.Clear(); if (ddlSpType.Items.Count > 0) { ddlSpType.SelectedIndex = 0; } txtStopDate.Text = string.Empty; txtStopTransNo.Text = string.Empty; // Remarks txtRemoveRemarks.Text = string.Empty; txtStopRemarks.Text = string.Empty; //Certificate Detail ddlCDDenom.Items.Clear(); ddlCDCertif.Items.Clear(); txtCDUpTo.Text = "1"; txtCDTotalAmount.Text = string.Empty; ucUserDet.Reset(); ucUserDet.ResetData(); }
private void SetObject(StopPaymentRemove oStopPayRemove) { if (oStopPayRemove != null) { if (oStopPayRemove.Issue != null) { hdStopPayRemoveTransNo.Value = oStopPayRemove.StopPaymentRemoveTransNo; hdIssueTransNo.Value = oStopPayRemove.Issue.IssueTransNo; hdRegNo.Value = oStopPayRemove.Issue.RegNo; txtRegNo.Text = oStopPayRemove.Issue.RegNo.ToString(); ddlSpType.Text = oStopPayRemove.Issue.SPType.SPTypeID.Trim(); ddlBranch.Text = oStopPayRemove.Issue.Branch.BranchID.Trim(); txtIssueName.Text = oStopPayRemove.Issue.IssueName; //Loading from StopPayment Search if (oStopPayRemove.StopPaymentRemoveDate.Year.Equals(1) || oStopPayRemove.StopPaymentRemoveDate.Year.Equals(1900)) { txtRemoveDate.Text = DateTime.Now.ToString(Constants.DATETIME_FORMAT); } else //Loading from StopPaymentRemove Search { txtRemoveDate.Text = oStopPayRemove.StopPaymentRemoveDate.ToString(Constants.DATETIME_FORMAT); } txtStopPayRemoveTransNo.Text = oStopPayRemove.StopPaymentRemoveTransNo.ToString(); //Issue Details DDListUtil.Assign(ddlSpType, oStopPayRemove.Issue.SPType.SPTypeID); DDListUtil.Assign(ddlBranch, oStopPayRemove.Issue.Branch.BranchID); txtRegNo.Text = oStopPayRemove.Issue.RegNo; txtIssueDate.Text = oStopPayRemove.Issue.VersionIssueDate.ToString(Constants.DATETIME_FORMAT); txtStopDate.Text = oStopPayRemove.StopPayment.StopPaymentDate.ToString(Constants.DATETIME_FORMAT); txtStopAmount.Text = oStopPayRemove.StopPayment.StopPaymentAmount.ToString("N2"); txtStopTransNo.Text = oStopPayRemove.StopPayment.StopPaymentTransNo; DDListUtil.Assign(ddlCustomerType, oStopPayRemove.Issue.VersionSPPolicy.DTCustomerTypePolicy, true); DDListUtil.Assign(ddlCustomerType, oStopPayRemove.Issue.CustomerType.CustomerTypeID); // Remarks txtStopRemarks.Text = oStopPayRemove.StopPayment.Remarks; txtRemoveRemarks.Text = oStopPayRemove.Remarks; #region Customer Details DataTable dtCustomerDetails = new DataTable(); dtCustomerDetails.Columns.Add(new DataColumn("Customer Name", typeof(string))); //dtCustomerDetails.Columns.Add(new DataColumn("Customer ID", typeof(string))); dtCustomerDetails.Columns.Add(new DataColumn("Address", typeof(string))); dtCustomerDetails.Columns.Add(new DataColumn("Phone", typeof(string))); DataRow rowCustomerDetails = null; for (int customerCount = 0; customerCount < oStopPayRemove.Issue.CustomerDetailsList.Count; customerCount++) { rowCustomerDetails = dtCustomerDetails.NewRow(); rowCustomerDetails["Customer Name"] = oStopPayRemove.Issue.CustomerDetailsList[customerCount].CustomerName; //rowCustomerDetails["Customer ID"] = oStopPayRemove.Issue.CustomerDetailsList[customerCount].CustomerID; rowCustomerDetails["Address"] = oStopPayRemove.Issue.CustomerDetailsList[customerCount].Address; rowCustomerDetails["Phone"] = oStopPayRemove.Issue.CustomerDetailsList[customerCount].Phone; dtCustomerDetails.Rows.Add(rowCustomerDetails); } gvCustomerDetail.DataSource = dtCustomerDetails; gvCustomerDetail.DataBind(); #endregion #region Nominee Detail DataTable dtNomineeDetail = new DataTable(); dtNomineeDetail.Columns.Add(new DataColumn("Nominee Name", typeof(string))); dtNomineeDetail.Columns.Add(new DataColumn("Relation", typeof(string))); dtNomineeDetail.Columns.Add(new DataColumn("Address", typeof(string))); dtNomineeDetail.Columns.Add(new DataColumn("Nominee Share", typeof(string))); dtNomineeDetail.Columns.Add(new DataColumn("Amount", typeof(string))); DataRow rowNomineeDetail = null; for (int nomineeCount = 0; nomineeCount < oStopPayRemove.Issue.NomineeList.Count; nomineeCount++) { rowNomineeDetail = dtNomineeDetail.NewRow(); rowNomineeDetail["Nominee Name"] = oStopPayRemove.Issue.NomineeList[nomineeCount].NomineeName; rowNomineeDetail["Relation"] = oStopPayRemove.Issue.NomineeList[nomineeCount].Relation; rowNomineeDetail["Address"] = oStopPayRemove.Issue.NomineeList[nomineeCount].Address; rowNomineeDetail["Nominee Share"] = oStopPayRemove.Issue.NomineeList[nomineeCount].NomineeShare; rowNomineeDetail["Amount"] = oStopPayRemove.Issue.NomineeList[nomineeCount].Amount; dtNomineeDetail.Rows.Add(rowNomineeDetail); } gvNomDetail.DataSource = dtNomineeDetail; gvNomDetail.DataBind(); #endregion #region Certificate Detail ArrayList alScrip = new ArrayList(); ddlCDDenom.Items.Clear(); DDListUtil.Add(ddlCDDenom, "", ""); if (!(hdDataType.Value.Equals("2") && hdButtonType.Value.Equals("D"))) { for (int iScripCount = 0; iScripCount < oStopPayRemove.Issue.ScripList.Count; iScripCount++) { if (!alScrip.Contains(oStopPayRemove.Issue.ScripList[iScripCount].Denomination.DenominationID)) { DDListUtil.Add(ddlCDDenom, oStopPayRemove.Issue.ScripList[iScripCount].Denomination.DenominationID.ToString(), oStopPayRemove.Issue.ScripList[iScripCount].Denomination.DenominationID.ToString()); alScrip.Add(oStopPayRemove.Issue.ScripList[iScripCount].Denomination.DenominationID); } } } #endregion Certificate Detail // Certificate Detail txtCDTotalAmount.Text = oStopPayRemove.StopPaymentRemoveAmount.ToString("N2"); DataTable dtTmp = oStopPayRemove.DtStopPayRemoveDetail; if (dtTmp.Columns.Contains("SPScripID")) { dtTmp.Columns.Remove("SPScripID"); } gvCertInfo.DataSource = dtTmp; gvCertInfo.DataBind(); #region Set User Details Session[Constants.SES_STOPPAY_REMOVE_MARK] = oStopPayRemove; UserDetails oUserDetails = ucUserDet.UserDetail; //Prompt message if already Stop Mark Removed if ((SEARCH_FROM.Equals(1)) && hdDataType.Value.Equals("2") && ddlCDDenom.Items.Count <= 1) { ucMessage.OpenMessage("Stop Mark removed!!", Constants.MSG_TYPE_INFO); ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true); } else if (hdButtonType.Value.Equals("S")) //Stop Payment Approve search { if (ddlCDDenom.Items.Count <= 1) { ucMessage.OpenMessage("Stop Mark removed!!", Constants.MSG_TYPE_INFO); ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true); } } else if (hdDataType.Value.Equals("2") && hdButtonType.Value.Equals("D")) //StopPaymentRemove Approve search { oUserDetails.MakerID = oStopPayRemove.UserDetails.MakerID; oUserDetails.MakeDate = oStopPayRemove.UserDetails.MakeDate; oUserDetails.CheckerID = oStopPayRemove.UserDetails.CheckerID; oUserDetails.CheckDate = oStopPayRemove.UserDetails.CheckDate; oUserDetails.CheckerComment = oStopPayRemove.UserDetails.CheckerComment; ucUserDet.UserDetail = oUserDetails; txtRemoveDate.Text = oStopPayRemove.StopPaymentRemoveDate.ToString(Constants.DATETIME_FORMAT); } else if ((hdDataType.Value.Equals("1") && SEARCH_FROM.Equals(1)) || (SEARCH_FROM.Equals(2) && hdDataType.Value.Equals("1"))) { oUserDetails.CheckerID = oStopPayRemove.UserDetails.CheckerID; oUserDetails.CheckDate = oStopPayRemove.UserDetails.CheckDate; oUserDetails.CheckerComment = oStopPayRemove.UserDetails.CheckerComment; ucUserDet.UserDetail = oUserDetails; } else if (SEARCH_FROM.Equals(3)) // Coming from Approval page { oUserDetails.MakerID = oStopPayRemove.UserDetails.MakerID; oUserDetails.CheckerComment = oStopPayRemove.UserDetails.CheckerComment; ucUserDet.UserDetail = oUserDetails; } #endregion Calculate(""); } } }
private void Calculate(string sAction) { StopPaymentRemove oStopPayRemove = (StopPaymentRemove)Session[Constants.SES_STOPPAY_REMOVE_MARK]; DataTable dt = null; if (oStopPayRemove != null) { dt = oStopPayRemove.DtStopPayRemoveDetail; if (dt.Columns.Count <= 0) { dt.Columns.Add(new DataColumn("SPScripID", typeof(string))); dt.Columns.Add(new DataColumn("Denomination", typeof(string))); dt.Columns.Add(new DataColumn("SP Series", typeof(string))); dt.Columns.Add(new DataColumn("Sl No", typeof(string))); dt.Columns.Add(new DataColumn("Status", typeof(string))); } } if (sAction.Equals("MS")) //Mark Single { #region Mark Single int iUpTo = Util.GetIntNumber(txtCDUpTo.Text); if (iUpTo > 0) { int iSelectedIndex = ddlCDCertif.SelectedIndex; for (int certificateIndex = 0; certificateIndex < iUpTo; certificateIndex++) { if (certificateIndex + iSelectedIndex == ddlCDCertif.Items.Count) { break; } DataRow[] selectedRow = dt.Select("SPScripID = " + ddlCDCertif.Items[certificateIndex + iSelectedIndex].Value); if (selectedRow.Count() <= 0) { DataRow row = dt.NewRow(); row["SPScripID"] = ddlCDCertif.Items[certificateIndex + iSelectedIndex].Value; row["Denomination"] = ddlCDDenom.SelectedItem.Value; string sTmp = ddlCDCertif.Items[certificateIndex + iSelectedIndex].Text; row["SP Series"] = (sTmp.Substring(0, sTmp.LastIndexOf(' '))).Trim(); row["Sl No"] = (sTmp.Substring(sTmp.LastIndexOf(' ') + 1, (sTmp.Length - sTmp.LastIndexOf(' ')) - 1)).Trim(); row["Status"] = "SP Removed"; dt.Rows.Add(row); } } } #endregion } else if (sAction.Equals("MA")) //Mark All { #region Mark All if (oStopPayRemove != null) { int iDnomCount = 0; if (dt.Rows.Count > 0) { object objCount = dt.Compute("COUNT(Denomination)", "Denomination = " + ddlCDDenom.SelectedItem.Value); if (objCount != null) { iDnomCount = Convert.ToInt32(objCount); } if (iDnomCount > 0) { DataRow[] DrDenomCheck = dt.Select("Denomination = " + ddlCDDenom.SelectedItem.Value); foreach (DataRow DrCheck in DrDenomCheck) { dt.Rows.Remove(DrCheck); } } } for (int scripIndex = 0; scripIndex < oStopPayRemove.Issue.ScripList.Count; scripIndex++) { DataRow row = dt.NewRow(); if (ddlCDDenom.SelectedItem.Value.Equals(oStopPayRemove.Issue.ScripList[scripIndex].Denomination.DenominationID.ToString())) { row["SPScripID"] = oStopPayRemove.Issue.ScripList[scripIndex].SPScripID; row["Denomination"] = oStopPayRemove.Issue.ScripList[scripIndex].Denomination.DenominationID; row["SP Series"] = oStopPayRemove.Issue.ScripList[scripIndex].SPSeries; row["Sl No"] = oStopPayRemove.Issue.ScripList[scripIndex].SlNo; row["Status"] = "SP Removed"; dt.Rows.Add(row); } } } #endregion } else if (sAction.Equals("RA")) //Remove All { dt.Rows.Clear(); } oStopPayRemove.DtStopPayRemoveDetail = dt; Session[Constants.SES_STOPPAY_REMOVE_MARK] = oStopPayRemove;//update session DataTable TmpDt = dt.Copy(); if (TmpDt.Columns.Contains("SPScripID")) { TmpDt.Columns.Remove("SPScripID"); } gvCertInfo.DataSource = TmpDt; gvCertInfo.DataBind(); decimal dTotalAmount = 0m; foreach (GridViewRow gvr in gvCertInfo.Rows) { dTotalAmount += Util.GetDecimalNumber(gvr.Cells[1].Text); } txtCDTotalAmount.Text = dTotalAmount.ToString("N2"); }