protected void btnCreateCheque_Click(object sender, EventArgs e) { if (Page.IsValid) { iBiz.FinPro.ChequePrinting bChqPrinting = new iBiz.FinPro.ChequePrinting(); iBiz.FinPro.ChequePrinting.objChequePrinting objChqPrinting = new iBiz.FinPro.ChequePrinting.objChequePrinting(); objChqPrinting.bankId = Convert.ToInt32(ddlBankAccount.SelectedValue); objChqPrinting.chequeAmountFig = Convert.ToDecimal(tbChequeAmount.Text); if (tbChequeAmountInWords.Text.Trim().Length == 0) { objChqPrinting.chequeAmount = NumberToWords(Convert.ToInt32(objChqPrinting.chequeAmountFig)); } else { objChqPrinting.chequeAmount = tbChequeAmountInWords.Text; } objChqPrinting.chequeCreatedBy = 1; objChqPrinting.chequeCreatedOn = DateTime.Now; // chequeDate.Text = 12/02/2015 objChqPrinting.chequeDate = Convert.ToDateTime(chequeDate.Text); objChqPrinting.chequeNo = tbChequeNo.Text; objChqPrinting.chequeReceivedBy = tbChequeReceiverName.Text; objChqPrinting.chequeReceiverIDCard = tbChequeReceiverCNIC.Text; objChqPrinting.chequeReceiverPhone = tbChequeReceiverPhone.Text; objChqPrinting.chequeStatus = 1; objChqPrinting.chequeTitle = tbChequeTitle.Text; int chequeId = 0; chequeId = bChqPrinting.Add(objChqPrinting); if (chequeId == 0) { rnNotify.Show("Unable to Create Cheque."); } else { Response.Redirect("~/FinApp/Printable_Cheque.aspx?id=" + chequeId.ToString()); } } }
protected void Load_Cheque(int chequeId) { iBiz.FinPro.ChequePrinting bChqPrinting = new iBiz.FinPro.ChequePrinting(); iBiz.FinPro.ChequePrinting.objChequePrinting objChqPrinting = new iBiz.FinPro.ChequePrinting.objChequePrinting(); objChqPrinting = bChqPrinting.Select(chequeId); if (objChqPrinting != null) { string templateContent = ""; using (StreamReader sr = new StreamReader(Server.MapPath(string.Format("~/ResourceBox/Cheques/{0}.txt", Template_Name(objChqPrinting.bankId))))) { templateContent = sr.ReadToEnd(); } templateContent = templateContent.Replace("[date]", objChqPrinting.chequeDate.Value.ToString("ddMMyyyy")); templateContent = templateContent.Replace("[title]", objChqPrinting.chequeTitle); templateContent = templateContent.Replace("[amount]", Comma_Amount(Convert.ToDecimal(objChqPrinting.chequeAmountFig.ToString("0")))); templateContent = templateContent.Replace("[amount_words]", objChqPrinting.chequeAmount); Response.Write(templateContent); } }