Пример #1
0
        public static void InsertExpiryDateReminder(VaaaN.TollMax.Library.TollMaxLibrary.CBE.PrepaidCardCBE prepaidCard)
        {
            CBE.CustomerSmsNotificationCBE smsNotification = new CBE.CustomerSmsNotificationCBE();

            try
            {
                smsNotification.TmsId          = prepaidCard.TmsId;
                smsNotification.PlazaId        = prepaidCard.PlazaId;
                smsNotification.TellerId       = 0;
                smsNotification.CreationDate   = DateTime.Now;
                smsNotification.DeliveryDate   = DateTime.MaxValue;
                smsNotification.DeliveryStatus = "0"; // Delivered = 1 and Un Delivered = 0
                smsNotification.SentStatus     = "0"; // Sent = 1 Unsent = 0
                smsNotification.SentDate       = DateTime.Now;

                CBE.AccountCBE account = new CBE.AccountCBE();
                account.PlazaId                 = prepaidCard.PlazaId;
                account.TmsId                   = prepaidCard.TmsId;
                account.AccountId               = prepaidCard.AccountId;
                account                         = BLL.AccountBLL.GetAccountById(account);
                smsNotification.AccountId       = prepaidCard.AccountId;
                smsNotification.SerialNo        = prepaidCard.SerialNo;
                smsNotification.EmailId         = account.EmailId;
                smsNotification.ContactNumber   = account.MobNumber;
                smsNotification.CustomerName    = account.FirstName;
                smsNotification.AttemptCount    = 0;
                smsNotification.MessageCategory = "expiryreminder";
                smsNotification.MediaType       = Convert.ToString((int)Constants.CustomerNotificationMedia.SMS);
                smsNotification.ModuleName      = "POS";
                smsNotification.Message         = CreateMessageForSMS(smsNotification, prepaidCard, null);

                // Send only one reminder to customer in a month
                VaaaN.TollMax.Library.TollMaxLibrary.CBE.CustomerSmsNotificationCollection notifications = VaaaN.TollMax.Library.TollMaxLibrary.BLL.CustomerSmsNotificationBLL.GetBySerialNo(smsNotification.TmsId, smsNotification.PlazaId, smsNotification.SerialNo);

                bool createReminder = true;
                foreach (VaaaN.TollMax.Library.TollMaxLibrary.CBE.CustomerSmsNotificationCBE notification in notifications)
                {
                    if ((DateTime.Now - notification.CreationDate).TotalDays <= 20 && notification.MessageCategory.ToLower() == smsNotification.MessageCategory.ToLower())
                    {
                        createReminder = false;
                        break;
                    }
                }

                if (createReminder)
                {
                    VaaaN.TollMax.Library.TollMaxLibrary.BLL.CustomerSmsNotificationBLL.Insert(smsNotification);
                }
                else
                {
                    VaaaN.TollMax.Library.SharedLibrary.FileIO.Log.Write("Reminder not required." + smsNotification.ToString(), logModule);
                }
            }
            catch (Exception ex)
            {
                VaaaN.TollMax.Library.SharedLibrary.FileIO.Log.Write("Failed to insert customer notification." + smsNotification.ToString(), logModule);
                throw ex;
            }
        }
Пример #2
0
        public static void InsertCustomerNotification(VaaaN.TollMax.Library.TollMaxLibrary.CBE.PrepaidTransactionCBE prepaidTransaction, string eventType)
        {
            CBE.CustomerSmsNotificationCBE smsNotification = new CBE.CustomerSmsNotificationCBE();

            try
            {
                VaaaN.TollMax.Library.SharedLibrary.FileIO.Log.Write("Prepaid tran: " + prepaidTransaction.ToString(), logModule);

                smsNotification.TmsId          = prepaidTransaction.TmsId;
                smsNotification.PlazaId        = prepaidTransaction.PlazaId;
                smsNotification.TellerId       = prepaidTransaction.TellerId;
                smsNotification.CreationDate   = prepaidTransaction.StartDateTime;
                smsNotification.DeliveryDate   = DateTime.MaxValue;
                smsNotification.DeliveryStatus = "0"; // Delivered = 1 and Un Delivered = 0
                smsNotification.SentStatus     = "0"; // Sent = 1 Unsent = 0
                smsNotification.SentDate       = DateTime.Now;

                CBE.AccountCBE account = new CBE.AccountCBE();
                account.PlazaId   = prepaidTransaction.PlazaId;
                account.TmsId     = prepaidTransaction.TmsId;
                account.AccountId = prepaidTransaction.AccountId;
                account           = BLL.AccountBLL.GetAccountById(account);

                VaaaN.TollMax.Library.SharedLibrary.FileIO.Log.Write("Account detail: " + account.ToString(), logModule);


                smsNotification.AccountId       = prepaidTransaction.AccountId;
                smsNotification.SerialNo        = prepaidTransaction.SerialNo;
                smsNotification.EmailId         = account.EmailId;
                smsNotification.ContactNumber   = account.MobNumber;
                smsNotification.CustomerName    = account.FirstName;
                smsNotification.AttemptCount    = 0;
                smsNotification.MessageCategory = eventType;
                smsNotification.MediaType       = Convert.ToString((int)Constants.CustomerNotificationMedia.SMS);
                smsNotification.ModuleName      = "POS";
                smsNotification.Message         = CreateMessageForSMS(smsNotification, null, prepaidTransaction);

                VaaaN.TollMax.Library.TollMaxLibrary.BLL.CustomerSmsNotificationBLL.Insert(smsNotification);
            }
            catch (Exception ex)
            {
                VaaaN.TollMax.Library.SharedLibrary.FileIO.Log.Write("Failed to insert customer notification. Exception: " + ex.Message + smsNotification.ToString(), logModule);
                throw ex;
            }
        }