public ActionResult CreditView(String ControlID) { if (Session["Login"] != null) { LoginSession loginsession = (LoginSession)Session["Login"]; ViewBag.CompanyLogo = loginsession.CompanyLogo; String actionName = this.ControllerContext.RouteData.Values["action"].ToString(); String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, BAL.Common.LayoutType(loginsession.UserType)); if (ControlID != null) { String DecControlID = BAL.Security.URLDecrypt(ControlID); BillCreditControlList Vwobj = new BillCreditControlList(); if ((DecControlID != "0") && (DecControlID != null)) { Vwobj = BAL.BillCreditControlModel.CreditControlView(DecControlID); ViewBag.CreditID = Vwobj.ID; ViewBag.Closed = Vwobj.IsClosed; } return View(Vwobj); } else { return RedirectToAction("Index", "BillCredit"); } } else { return RedirectToAction("Index", "Home"); } }
public void GeneralLetter(String CreditControlID) { try { BillCreditControlList Vwobj = new BillCreditControlList(); Vwobj = BAL.BillCreditControlModel.ViewCreditControlReminderLetter(CreditControlID); if (Vwobj != null) { var document = new Document(PageSize.A4, 50, 50, 25, 25); String PDFName = Vwobj.BillNo + "-" + Vwobj.ID.ToString() + ".pdf"; var filePath = Path.Combine(Server.MapPath("~/PdfContent/CreditControl/Letter"), PDFName); // var output = new MemoryStream(); var output = new FileStream(filePath, FileMode.Create); var writer = PdfWriter.GetInstance(document, output); try { // Open the Document for writing document.Open(); // Read in the contents of the Receipt.htm file... StyleSheet styles = new StyleSheet(); //styles.LoadTagStyle(HtmlTags.H1, HtmlTags.FONTSIZE, "16"); //styles.LoadTagStyle(HtmlTags.P, HtmlTags.FONTSIZE, "10"); //styles.LoadTagStyle(HtmlTags.P, HtmlTags.m, "#ff0000"); //styles.LoadTagStyle(HtmlTags.CLASS, HtmlTags.COLOR, "#ff0000"); styles.LoadTagStyle(HtmlTags.TD, HtmlTags.ALIGN, "left"); styles.LoadTagStyle(HtmlTags.TD, HtmlTags.CELLPADDING, "10"); styles.LoadTagStyle(HtmlTags.P, HtmlTags.P, "margin-bottom:20px"); styles.LoadTagStyle(HtmlTags.P, HtmlTags.SPAN, "text-decoration:underline;"); styles.LoadStyle("Subject", "ALIGN", "center"); styles.LoadStyle("Subject", "FONTSIZE", "26px"); styles.LoadStyle("Subject", "color", "#ff0000"); styles.LoadStyle("c_outstanding", "font-size", "20px"); styles.LoadStyle("c_outstanding", "text-align", "center"); String contents = System.IO.File.ReadAllText(Server.MapPath("~/HTMLTemplate/GeneralLetter.htm")); // Replace the placeholders with the user-specified text contents = contents.Replace("[CustomerName]", Vwobj.ConsumerName.Trim()); contents = contents.Replace("[AddressLine1]", Vwobj.ConsumerAddress.Trim()); contents = contents.Replace("[AddressLine2]", Vwobj.ConsumerCounty.Trim()); contents = contents.Replace("[AddressLine3]", Vwobj.ConsumerCity.Trim()); contents = contents.Replace("[PostCode]", Vwobj.ConsumerZipCode.Trim()); contents = contents.Replace("[Amount]", Vwobj.LastBillAmount.ToString().Trim()); //' contents = contents.Replace("[propertyAddress]", Vwobj.PropertyNo.Trim()); contents = contents.Replace("[sitename]", Vwobj.SiteName.Trim()); contents = contents.Replace("[balanceofaccount]", Vwobj.Balance.ToString()); contents = contents.Replace("[invoicedateFrom]", Vwobj.InvoiceDateForm); contents = contents.Replace("[invoicedateTo]", Vwobj.InvoiceDateTo); contents = contents.Replace("[InvioceDate]", Vwobj.InvoiceDate); contents = contents.Replace("[ClientName]", Vwobj.ClientName); contents = contents.Replace("[ClientTelephoneNumber]", Vwobj.ClientTelephone); contents = contents.Replace("[ClientEmailAddress]", Vwobj.ClientEmail); var parsedHtmlElements = HTMLWorker.ParseToList(new StringReader(contents), styles); // Enumerate the elements, adding each one to the Document... foreach (var htmlElement in parsedHtmlElements) { document.Add(htmlElement as IElement); } writer.CloseStream = false; document.Close(); output.Dispose(); } catch (Exception ex) { output.Dispose(); document.Dispose(); } }//if }//try catch (Exception ex) { throw; } }
public JsonResult ProcessCreditControl(String ControlID, String mIsEmail, String mIsLetter, String mIsAction) { if (Session["Login"] != null) { try { LoginSession loginsession = (LoginSession)Session["Login"]; if ((ControlID != "") ) { BillCreditControlList ControlObj = new BillCreditControlList(); ControlObj = BAL.BillCreditControlModel.CreditControlView(ControlID); // Assign BillCreditControlList CreditObj = new BillCreditControlList(); CreditObj.ID = ControlObj.ID; CreditObj.IsClosed = mIsAction; CreditObj.IsEmail = mIsEmail; CreditObj.IsLetter = mIsLetter; CreditObj.Email = ControlObj.Email; CreditObj.ModifyBY = loginsession.UserID; if (mIsEmail == "1")// check true { if (ControlObj.ValidationID == "20")// Reminder Letter 1 { GenerateReminder1(ControlObj.ID); } if (ControlObj.ValidationID == "24")// Reminder Letter 2 two format { GenerateReminder2(ControlObj.ID); } } if(mIsLetter =="1") { GeneralLetter(ControlObj.ID); } if (BAL.BillCreditControlModel.UpdateCreditControlWorkFlowAction(CreditObj)) { return Json(new { Result = "true" }, JsonRequestBehavior.AllowGet); } else { return Json(new { Result = "false" }, JsonRequestBehavior.AllowGet); } } } catch (Exception ex) { return Json(new { Result = "false" }, JsonRequestBehavior.AllowGet); } } return Json(new { Result = false }, JsonRequestBehavior.AllowGet); }
public ActionResult GetLetter(String ControlID) { if (Session["Login"] != null) { LoginSession loginsession = (LoginSession)Session["Login"]; ViewBag.CompanyLogo = loginsession.CompanyLogo; String actionName = this.ControllerContext.RouteData.Values["action"].ToString(); String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, BAL.Common.LayoutType(loginsession.UserType)); if (ControlID != null) { String DecControlID = BAL.Security.URLDecrypt(ControlID); BillCreditControlList Vwobj = new BillCreditControlList(); Vwobj = BAL.BillCreditControlModel.ViewCreditControlReminderLetter(DecControlID); String PDFName = Vwobj.BillNo + "-" + Vwobj.ID.ToString() + ".pdf"; var filePath = Path.Combine(Server.MapPath("~/PdfContent/CreditControl/Letter"), PDFName); var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read ); var fsResult = new FileStreamResult(fileStream, "application/pdf"); return fsResult; } else { return RedirectToAction("Index", "BillCredit"); } } else { return RedirectToAction("Index", "Home"); } }
public void GenerateReminder1(String CreditControlID ) { try { BillCreditControlList Vwobj = new BillCreditControlList(); Vwobj = BAL.BillCreditControlModel.ViewCreditControlReminderLetter(CreditControlID); if (Vwobj != null) { // Boolean flag = false; var document = new Document(PageSize.A4, 10, 10, 10, 10); String PDFName = Vwobj.BillNo.ToString() + Vwobj.ValidationType + "_"+Vwobj.ID + ".pdf"; var filePath = Path.Combine(Server.MapPath("~/PdfContent/CreditControl/Reminder"), PDFName); // var output = new MemoryStream(); var output = new FileStream(filePath, FileMode.Create); var writer = PdfWriter.GetInstance(document, output); writer.PageEvent = new HeaderFooter(CreditControlID); try { // Open the Document for writing document.Open(); // Read in the contents of the Receipt.htm file... StyleSheet styles = new StyleSheet(); String contents = System.IO.File.ReadAllText(Server.MapPath("~/HTMLTemplate/ReminderLetter1.htm")); // Replace the placeholders with the user-specified text String clientLogo = String.Empty; // contents = contents.Replace("[ClientImage]", clientLogo); contents = contents.Replace("[ConsumerName]", Vwobj.ConsumerName.Trim()); // contents = contents.Replace("[PropertyNO]", Bill.PropertyNo.Trim()); contents = contents.Replace("[ConsumerAddress]", Vwobj.ConsumerAddress.Trim()); if (Vwobj.ConsumerAddress2 != null) { contents = contents.Replace("[ConsumerAddress2]", "<br/>" + Vwobj.ConsumerAddress2.Trim()); } else { contents = contents.Replace("[ConsumerAddress2]", " "); } contents = contents.Replace("[ConsumerCity]", Vwobj.ConsumerCity.Trim()); contents = contents.Replace("[ConsumerCountry]", Vwobj.ConsumerCounty.Trim()); contents = contents.Replace("[ConsumerZipCode]", Vwobj.ConsumerZipCode.Trim()); contents = contents.Replace("[balanceofaccount]", Vwobj.Balance.ToString()); contents = contents.Replace("[Client]", Vwobj.ClientName.Trim()); contents = contents.Replace("[ClientAddress]", Vwobj.ClientAddress.Trim()); if (Vwobj.ClientAddress2 != null) { contents = contents.Replace("[ClientAddress2]", "<br/>" + Vwobj.ClientAddress2.Trim()); } else { contents = contents.Replace("[ClientAddress2]", ""); } contents = contents.Replace("[ClientCity]", Vwobj.ClientCity.Trim()); contents = contents.Replace("[ClientCounty]", Vwobj.ClientCounty.Trim()); contents = contents.Replace("[ClientZipCode]", Vwobj.ClientZipCode.Trim()); contents = contents.Replace("[CompRegistrationNo]", Vwobj.CompRegistrationNo !=null? Vwobj.CompRegistrationNo :""); contents = contents.Replace("[Amount]", Vwobj.LastBillAmount.ToString().Trim()); contents = contents.Replace("[ReminderDate]", Vwobj.ReminderDate != null? Vwobj.ReminderDate.ToString().Trim():""); if (Vwobj.PropertyAddress != null) { contents = contents.Replace("[PropertyAddress]", Vwobj.PropertyAddress.ToString().Trim()); } else { contents = contents.Replace("[PropertyAddress]", ""); } if (Vwobj.TemplateTelephone != null) { contents = contents.Replace("[TemplateTelephone]", Vwobj.TemplateTelephone); } else { contents = contents.Replace("[TemplateTelephone]", ""); } if (Vwobj.TemplateEmail != null) { contents = contents.Replace("[TemplateEmail]", Vwobj.TemplateEmail); } else { contents = contents.Replace("[TemplateEmail]", ""); } if (Vwobj.OpeningHour != null) { contents = contents.Replace("[OpeningHour]", Vwobj.OpeningHour); } else { contents = contents.Replace("[OpeningHour]", ""); } contents = contents.Replace("[ClosingHour]", Vwobj.ClosingHour != null? Vwobj.ClosingHour:"" ); contents = contents.Replace("[TemplateAddress]", Vwobj.TemplateAddress != null? Vwobj.TemplateAddress :""); contents = contents.Replace("[TemplateCity]", Vwobj.TemplateCity != null? Vwobj.TemplateCity:""); contents = contents.Replace("[TemplateCounty]", Vwobj.TemplateCounty != null ? Vwobj.TemplateCounty:"" ); contents = contents.Replace("[TemplateZipcode]", Vwobj.TemplateZipcode != null? Vwobj.TemplateZipcode:""); StringBuilder PaymentList = new StringBuilder(); if (Vwobj.DirectDebit == "1") { PaymentList.Append("<td align='center' valign='top' ><table><tr><td align='center' valign='top'> <img src='" + Server.MapPath("~/Images/img1.jpg") + "' height='50' align='center' alt=' '></td> </tr><tr><td align='center' >Please call us on " + Vwobj.TemplateTelephone + " to set up or amend your fixed or variable Direct Debit </td></tr></table></td>"); } if (Vwobj.PayPoint == "1") { PaymentList.Append("<td valign='top' style='font-size:10px; text-align:center; padding:10px;'>"); String PayPointImg = "<img src='" + Server.MapPath("~/Images/pay_point_pdf.png") + "' height='30' alt=' '>"; PaymentList.Append(PayPointImg); PaymentList.Append("<div style='clear:both'></div>"); PaymentList.Append(" Pay by Cash at any PayPoint outlet using your payment card</td>"); } if (Vwobj.PayZone == "1") { PaymentList.Append("<td valign='top' style='font-size:10px; text-align:center; padding:10px;'>"); String PayZoneImg = "<img src='" + Server.MapPath("~/Images/pay_zone_pdf.png") + "'height='30' alt=' '>"; PaymentList.Append(PayZoneImg); PaymentList.Append("<div style='clear:both'></div>"); PaymentList.Append(" Pay by Cash at any PayZone outlet using your payment card</td>"); } if (Vwobj.PostOffice == "1") { PaymentList.Append("<td valign='top' style='font-size:10px; text-align:center; padding:10px;'>"); String PostOfficeImg = "<img src='" + Server.MapPath("~/Images/payment_card_pdf.png") + "' height='30' alt=' '>"; PaymentList.Append(PostOfficeImg); PaymentList.Append("<div style='clear:both'></div>"); PaymentList.Append(" Pay by Cash at any Post Office branch using your payment card</td>"); } if (Vwobj.BankTransfer == "1") { PaymentList.Append("<td valign='top'>"); String BankTransferImg = "<img src='" + Server.MapPath("~/Images/bank_transfer_pdf.png") + "' height='30' alt=' '>"; PaymentList.Append(BankTransferImg); PaymentList.Append("<div style='clear:both'></div>"); PaymentList.Append("Our account details for Bank Transfers: "); if (Vwobj.SortCode != null) { PaymentList.Append("Sort Code " + Vwobj.SortCode); } if (Vwobj.ClientBankAccountNo != null) { PaymentList.Append(" Account Number "); PaymentList.Append(Vwobj.ClientBankAccountNo != null?Vwobj.ClientBankAccountNo :""); } PaymentList.Append("</td>"); } if (Vwobj.TelephonePay == "1") { PaymentList.Append("<td valign='top' align='center' style='font-size:10px; text-align:center; padding:10px;'>"); String telephonepaypngImg = "<img src='" + Server.MapPath("~/Images/telephone_pay_pdf.png") + "' height='30' alt=' '>"; PaymentList.Append(telephonepaypngImg); PaymentList.Append("<div style='clear:both'></div>"); PaymentList.Append("Pay by Credit or Debit Card by calling "); PaymentList.Append(Vwobj.TemplateTelephone != null? Vwobj.TemplateTelephone:""); PaymentList.Append("</td>"); } if (Vwobj.OnlinePay == "1") { PaymentList.Append("<td valign='top' align='center' style='font-size:10px; text-align:center; padding:10px;'>"); String OnlinePaypngImg = "<img src='" + Server.MapPath("~/Images/online_pay_pdf.png") + "' height='30' alt=' '>"; PaymentList.Append(OnlinePaypngImg); PaymentList.Append("<div style='clear:both'></div>"); PaymentList.Append("Pay by Credit or Debit Card. Visit your online account for App and SMS details"); PaymentList.Append("</td>"); } if (Vwobj.OnlineNTelephonePay == "1") { PaymentList.Append("<td valign='top' style='font-size:10px; text-align:center; padding:10px;'>"); String OnlineNTelephonePayImg = "<img src='" + Server.MapPath("~/Images/telephone_online_pay_pdf.png") + "' height='30' alt=' '>"; PaymentList.Append(OnlineNTelephonePayImg); PaymentList.Append("<div style='clear:both'></div>"); PaymentList.Append("Pay by Credit or Debit Card calling "); PaymentList.Append(Vwobj.TemplateTelephone != null?Vwobj.TemplateTelephone :"" ); PaymentList.Append(" visit www.mysycous.com</td>"); } contents = contents.Replace("[PaymentOption]", PaymentList.ToString()); // Step 4: Parse the HTML string into a collection of elements... var parsedHtmlElements = HTMLWorker.ParseToList(new StringReader(contents), styles); // Enumerate the elements, adding each one to the Document... foreach (var htmlElement in parsedHtmlElements) { document.Add(htmlElement as IElement); } writer.CloseStream = false; document.Close(); output.Dispose(); //Get the pointer to the beginning of the stream. // output.Position = 0; // MailCls email = new MailCls(); // email.EmailTo = "*****@*****.**"; //// email.EmailTo = "*****@*****.**"; // email.EmailSubject = "Reminder Letter 1"; // email.Body = " Plz check It"; // email.DispalyName = "sarajit"; // email.Attachment = 0; // email.stream = output; // email.Email_Sent(); // output.Dispose(); // document.Dispose(); } catch (Exception ex) { output.Dispose(); document.Dispose(); } }//if }//try catch (Exception ex) { throw; } }
public static Boolean UpdateCreditControlWorkFlowAction(BillCreditControlList Credit) { Boolean flag = false; try { IRecordInsert objtext = new BALBillCreditControl(); flag = objtext.AddRecord(Credit); } catch (Exception ex) { throw; } return flag; }
public static Boolean UpdateCreditControl(BillCreditControlList Credit) { Boolean flag = false; try { IUpdate objtext = new BALBillCreditControl(); flag = objtext.UpdateRecord(Credit); } catch (Exception ex) { throw; } return flag; }
Object IGetRecordView.GetRecord(String ID) { BillCreditControlList vwCcredit = new BillCreditControlList(); try { vwCcredit = DAL.DALBillCreditControl.ViewCreditControlReminderLetter(ID); } catch (Exception ex) { throw; } return vwCcredit; }
public Object GetRecord(String ID) { BillCreditControlList vwCcredit = new BillCreditControlList(); try { vwCcredit = DAL.DALBillCreditControl.ViewCreditControl(ID); } catch (Exception ex) { throw; } return vwCcredit; }
public static BillCreditControlList ViewCreditControlReminderLetter(String ID) { try { BillCreditControlList Listobj = new BillCreditControlList(); //IEnumerable<ClientDetails> ClientList = null; using (var context = new SycousCon()) { var parID = new SqlParameter { ParameterName = "ID", Value = ID, Direction = ParameterDirection.Input }; Listobj = context.ExecuteStoreQuery<BillCreditControlList>("exec [SYCOUS].[GetCreditControlReminderLetterbyID] @ID", parID).FirstOrDefault(); } return Listobj; } catch (Exception ex) { throw; } }