Example #1
0
        //this returns a model with all the info.
        private MailCounterModel TotalOpenMailingsForMailer(Mailer mailer)
        {
            mailer.IsNullThrowExceptionArgument("Mailer");

            MailCounterModel mcm = new MailCounterModel();

            if (mailer.AddressVerificationHdrs.IsNullOrEmpty())
            {
                return(mcm);
            }



            foreach (var hdr in mailer.AddressVerificationHdrs)
            {
                if (hdr.SuccessResult == EnumLibrary.EnumNS.SuccessENUM.Inproccess)
                {
                    mcm.Inproccess++;
                }

                if (hdr.SuccessResult == EnumLibrary.EnumNS.SuccessENUM.Unknown)
                {
                    mcm.Unknown++;
                }
            }


            return(mcm);
        }
Example #2
0
        private void checkIfMailerIsAllowedAnyMoreMailingsIfNotThrowException_Helper(Mailer mailer)
        {
            MailCounterModel mcm = TotalOpenMailingsForMailer(mailer);

            if (mcm.Unknown > 0)
            {
                //ToDo send a message to the administrator that there are problems
            }

            if (!IsMailerAllowedMoreMailings(mailer))
            {
                throw new Exception(string.Format("Your Quota for Mailing is Full. You have {0} inproccess + {1} unknown Problems (Admin has been informed) = {2} Outstanding",
                                                  mcm.Inproccess,
                                                  mcm.Unknown,
                                                  mcm.TotalOutstanding));
            }
        }