private static byte[] createTheHeaderForPdfPrinting(AddressVerificationHdr addressVerificationHdr, string mailerName, string logoAddressAbsolute, string addressMailFrom, string website, string userName, string printDate, string letter_Instructions, string letter_welcomePara, string letter_body, string letter_Title, string sum_Title, string sum_body, string sum_Instructions, string sum_Welcome, string batchNumber, MailLocalOrForiegnENUM mailLocalOrForiegnEnum, MailServiceENUM mailServiceENUM) { LetterClass summaryLetter; LetterClass verificationLetter; initializeTheLetterCommonText(letter_Instructions, letter_welcomePara, letter_body, letter_Title, sum_Title, sum_body, sum_Instructions, sum_Welcome, out summaryLetter, out verificationLetter); //create the letters List <AddressVerificationModel> letterList = createLetters(addressVerificationHdr); //initialize the header AddressVerificationModel_Header header = new AddressVerificationModel_Header(); //load the header header.Load(batchNumber, logoAddressAbsolute, addressMailFrom, website, mailLocalOrForiegnEnum, mailServiceENUM, printDate, mailerName, userName, summaryLetter, verificationLetter, letterList); var factory = new CustomerAddressVerificationFactory(); byte[] pdf = factory.Build(header); return(pdf); }
public void UpdateAndSaveMailingCost(MailingCostsVM mailingCostsVM, GlobalObject globalObject) { mailingCostsVM.AddressVerificationHdrId.IsNullOrWhiteSpaceThrowArgumentException("View has lost the AddressVerificationHdrId"); AddressVerificationHdr addressVerificationHdr = AddressVerificationHdrBiz.Find(mailingCostsVM.AddressVerificationHdrId); addressVerificationHdr.IsNullThrowException("AddressVerificationHdr not found."); if (mailingCostsVM.Cost == 0) { throw new Exception("Mailing cost cannot be 0. Please try again."); } if (mailingCostsVM.TotalLettersMailed == 0) { throw new Exception("Total letters mailed cannot be 0. Try again."); } if (mailingCostsVM.TotalLettersMailed < addressVerificationHdr.AddressVerificationTrxs.Count) { ErrorsGlobal.AddMessage("You have left over letters. Please go to Letter Cancelation screen"); } if (mailingCostsVM.TotalLettersMailed > addressVerificationHdr.AddressVerificationTrxs.Count) { ErrorsGlobal.AddMessage("You cannot mail more letters than you have! Please try again"); } //update fields addressVerificationHdr.TotalQtyLettersMailed = mailingCostsVM.TotalLettersMailed; addressVerificationHdr.BudgetedCost = mailingCostsVM.TotalLettersMailed * MailerBiz.GetBugetedCost(addressVerificationHdr.MailLocalOrForiegnEnum, addressVerificationHdr.MailServiceEnum); addressVerificationHdr.Verification.VerificaionStatusEnum = VerificaionStatusENUM.Mailed; addressVerificationHdr.Verification.MailedDate.SetToTodaysDate(UserName, UserId); //update all the children to mailed. addressVerificationHdr.AddressVerificationTrxs.IsNullOrEmptyThrowException("There are no letters"); foreach (AddressVerificationTrx letter in addressVerificationHdr.AddressVerificationTrxs) { letter.Verification.VerificaionStatusEnum = VerificaionStatusENUM.Mailed; letter.Verification.MailedDate.SetToTodaysDate(UserName, UserId); AddressVerificationTrxBiz.Update(letter); } ControllerCreateEditParameter param = new ControllerCreateEditParameter(); param.Entity = addressVerificationHdr as ICommonWithId; param.GlobalObject = globalObject; AddressVerificationHdrBiz.UpdateAndSave(param); }
//public override void BusinessRulesFor(ModelsClassLibrary.ModelsNS.SharedNS.ControllerCreateEditParameter parm) //{ // base.BusinessRulesFor(parm); // Mailer mailer = parm.Entity as Mailer; // mailer.IsNullThrowException("Could not box mailer"); // mailer.Name.IsNullOrWhiteSpaceThrowException("mailer Name is empty"); //} public byte[] PrintVerificationLetters(string id) { //AddressVerificationModel_Header hdr = getVerificationLetterData(addressVerificationHdr); id.IsNullOrWhiteSpaceThrowException("id"); AddressVerificationHdr addressVerificationHdr = AddressVerificationHdrBiz.Find(id); addressVerificationHdr.IsNullThrowException("addressVerificationHdr"); addressVerificationHdr.Mailer.IsNullThrowException("Mailer"); //gather data string mailerName = addressVerificationHdr.Mailer.Name; string logoAddressAbsolute = System.Web.HttpContext.Current.Server.MapPath(MyConstants.LOGO_LOCATION); string addressMailFrom = CompanyConfig.CompanyAddress; string website = CompanyConfig.CompanyNameForWebPage; string userName = UserName; string printDate = DateTime.Now.ToShortDateString(); string letter_Instructions = VerificationConfig.Letter_Instruction_Para; string letter_welcomePara = VerificationConfig.Letter_Welcome_Para; string letter_body = VerificationConfig.Letter_Body; string letter_Title = VerificationConfig.Letter_Title; string sum_Title = VerificationConfig.Summary_Title; string sum_body = VerificationConfig.Summary_Body; string sum_Instructions = VerificationConfig.Summary_Instruction_Para; string sum_Welcome = VerificationConfig.Summary_Welcome_Para; //need to initialize string batchNumber = addressVerificationHdr.BatchNo.ToString(); MailLocalOrForiegnENUM mailLocalOrForiegnEnum = addressVerificationHdr.MailLocalOrForiegnEnum; MailServiceENUM mailServiceENUM = addressVerificationHdr.MailServiceEnum; byte[] hdr = createTheHeaderForPdfPrinting(addressVerificationHdr, mailerName, logoAddressAbsolute, addressMailFrom, website, userName, printDate, letter_Instructions, letter_welcomePara, letter_body, letter_Title, sum_Title, sum_body, sum_Instructions, sum_Welcome, batchNumber, mailLocalOrForiegnEnum, mailServiceENUM); return(hdr); }
public MailingCostsVM CreateMailingCostsVm(string addressVerificationHdrId) { addressVerificationHdrId.IsNullOrWhiteSpaceThrowArgumentException("addressVerificationHdrId"); AddressVerificationHdr addressVerificationHdr = AddressVerificationHdrBiz.Find(addressVerificationHdrId); addressVerificationHdr.IsNullThrowException(); MailingCostsVM mailingCostsVM = new MailingCostsVM(); mailingCostsVM.AddressVerificationHdr = addressVerificationHdr; mailingCostsVM.TotalLettersMailed = addressVerificationHdr.AddressVerificationTrxs.Count; mailingCostsVM.AddressVerificationHdrId = addressVerificationHdrId; return(mailingCostsVM); }
public void UpdateStatusToPrinted(string addressVerificationHdr_Id, GlobalObject globalObject) { addressVerificationHdr_Id.IsNullOrWhiteSpaceThrowArgumentException("addressVerificationHdr_Id"); AddressVerificationHdr addyVerfHdr = AddressVerificationHdrBiz.Find(addressVerificationHdr_Id); addyVerfHdr.IsNullThrowException("Address Veification Header not found. Status of transaction not changed."); addyVerfHdr.Verification.SetTo(VerificaionStatusENUM.Printed); ControllerCreateEditParameter param = new ControllerCreateEditParameter(); param.Entity = addyVerfHdr as ICommonWithId; param.GlobalObject = globalObject; AddressVerificationHdrBiz.UpdateAndSave(param); //updateAllTheAddresses(addyVerfHdr); //AddressVerificationHdrBiz.UpdateAndSave(addyVerfHdr); }
private static List <AddressVerificationModel> createLetters(AddressVerificationHdr addressVerificationHdr) { List <AddressVerificationModel> letterList = new List <AddressVerificationModel>(); foreach (var trx in addressVerificationHdr.AddressVerificationTrxs) { string inProcessDate = addressVerificationHdr.BeginDate.Date_NotNull_Min.ToShortDateString(); string addressMailTo = trx.Address.ToPostal(); string letterNumber = trx.LetterNo.ToString(); string requestDate = trx.DateVerifcationPaymentAccepted_NotNull.ToShortDateString(); string verificationNumber = trx.Verification.VerificationNumber.ToString(); AddressVerificationModel letter = new AddressVerificationModel(); letter.Load(verificationNumber, addressMailTo, requestDate, inProcessDate, letterNumber); letterList.Add(letter); } return(letterList); }
private AddressVerificationHdr CreateVerificationMailingListFor(Mailer mailer, MailServiceENUM mailServiceEnum, MailLocalOrForiegnENUM mailLocalOrForiegnEnum, VerificaionStatusENUM VerificaionStatusEnum) { List <AddressVerificationTrx> mailingList = createVerificationListFor(mailer, mailLocalOrForiegnEnum, mailServiceEnum, VerificaionStatusEnum); if (mailingList.IsNullOrEmpty()) { return(null); } updateTrxs(mailingList); AddressVerificationHdr header = AddressVerificationHdrBiz.Factory() as AddressVerificationHdr; string dateTickStr = DateTime.UtcNow.Ticks.ToString(); dateTickStr = dateTickStr.Substring(dateTickStr.Length - 5); //gets last 5 digits header.Name = string.Format("{1} -{0} ", dateTickStr, UserName); header.AddBeginAndEndDateController(mailLocalOrForiegnEnum, mailServiceEnum, UserName, UserId); header.MailLocalOrForiegnEnum = mailLocalOrForiegnEnum; header.MailServiceEnum = mailServiceEnum; header.BatchNo = getNextBatchNo(); header.BeginDate.SetToTodaysDate(UserName, UserId); header.EndDate.SetToTodaysDate(UserName, UserId); int timeAllowed = NoOfDaysAllowed(mailServiceEnum, mailLocalOrForiegnEnum); header.EndDate.Date = header.EndDate.Date.Value.AddDays(timeAllowed); header.Verification.SetTo(VerificaionStatusENUM.SelectedForProcessing); //header.SuccessEnum = SuccessENUM.Inproccess; //db stuff header.MailerId = mailer.Id; header.Mailer = mailer; mailer.AddressVerificationHdrs.Add(header); header.AddressVerificationTrxs = mailingList; return(header); }