예제 #1
0
        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);
        }
예제 #2
0
        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);
        }