Beispiel #1
0
        public static decimal CalculateAmount(DesignCategory designCategory,
                                              string postalTariff, int mailQuantity)
        {
            decimal amount;
            decimal postage  = Convert.ToDecimal(new Common().GetProperty("PostageStamps").Value);
            decimal bulkMail = Convert.ToDecimal(new Common().GetProperty("BulkMail").Value);

            if (postalTariff == "Postage Stamps")
            {
                amount = Convert.ToDecimal((mailQuantity * 0.41) + 25);
            }
            else
            {
                amount = Convert.ToDecimal((mailQuantity * 0.15) + 25);
            }

            if (designCategory == DesignCategory.PowerKard)
            {
                if (mailQuantity <= 1000)
                {
                    amount += Convert.ToDecimal(89 + (0.03 * mailQuantity));
                }
                else if (mailQuantity > 1000 && mailQuantity <= 2000)
                {
                    amount += Convert.ToDecimal(100 + (0.04 * mailQuantity));
                }
                else if (mailQuantity > 2000)
                {
                    amount += Convert.ToDecimal(124 + (0.04 * mailQuantity));
                }
            }

            return(amount);
        }
Beispiel #2
0
        /// <summary>
        /// Completes the specified scheduled event.
        /// </summary>
        /// <param name="eventId">Internal identifier of the event.</param>
        /// <param name="mailingListFile">Mailing list file of the mailing event.</param>
        /// <param name="remarks">Remarks of the mailing event.</param>
        /// <param name="mailingCount">Mailing count of the mailing event.</param>
        /// <param name="userId">Internal identifier of the user.</param>
        public void CompleteEvent(int eventId, string mailingListFile, string remarks,
                                  int mailingCount, int userId)
        {
            // Get an instance of the Schedule DAO using the DALFactory
            ISchedule dao = (ISchedule)DALFactory.DAO.Create(DALFactory.Module.Schedule);

            try
            {
                decimal refundAmount    = 0;
                int     refundInventory = 0;

                // Get the schedule event details.
                ScheduleInfo schedule = dao.GetEventEntries(eventId);

                DesignCategory designCategory =
                    (DesignCategory)schedule.Events[0].ProductType.LookupId;
                string postalTariff     = schedule.Events[0].PostalTariff;
                int    numberOfContacts = schedule.Events[0].NumberOfContacts;
                int    orderId          = schedule.Events[0].OrderId;
                int    orderValue       = schedule.Events[0].OrderValue;

                // Check whether there are any discripencies in mail quantity.
                if (numberOfContacts != mailingCount)
                {
                    refundInventory = numberOfContacts - mailingCount;
                    refundAmount    = orderValue -
                                      (AccaProcess.CalculateAmount(designCategory, postalTariff, mailingCount));
                }

                dao.CompleteEvent(eventId, mailingListFile, remarks, mailingCount,
                                  orderId, refundAmount, designCategory, refundInventory, userId);
            }
            catch
            {
                throw;
            }
        }