Esempio n. 1
0
 public virtual CustomerReminder.ReminderCondition UpdateConditionModel(CustomerReminder customerReminder, CustomerReminder.ReminderCondition condition, CustomerReminderModel.ConditionModel model)
 {
     condition = model.ToEntity(condition);
     _customerReminderService.UpdateCustomerReminder(customerReminder);
     _customerActivityService.InsertActivity("EditCustomerReminderCondition", customerReminder.Id, _localizationService.GetResource("ActivityLog.EditCustomerReminderCondition"), customerReminder.Name);
     return(condition);
 }
        public virtual CustomerReminderModel.ConditionModel PrepareConditionModel(CustomerReminder customerReminder)
        {
            var model = new CustomerReminderModel.ConditionModel();

            model.CustomerReminderId = customerReminder.Id;
            foreach (CustomerReminderConditionTypeEnum item in Enum.GetValues(typeof(CustomerReminderConditionTypeEnum)))
            {
                if (customerReminder.ReminderRule == CustomerReminderRuleEnum.AbandonedCart || customerReminder.ReminderRule == CustomerReminderRuleEnum.CompletedOrder ||
                    customerReminder.ReminderRule == CustomerReminderRuleEnum.UnpaidOrder)
                {
                    model.ConditionType.Add(new SelectListItem()
                    {
                        Value = ((int)item).ToString(),
                        Text  = item.ToString()
                    });
                }
                else
                {
                    if (item != CustomerReminderConditionTypeEnum.Product &&
                        item != CustomerReminderConditionTypeEnum.Manufacturer &&
                        item != CustomerReminderConditionTypeEnum.Category)
                    {
                        model.ConditionType.Add(new SelectListItem()
                        {
                            Value = ((int)item).ToString(),
                            Text  = item.ToString()
                        });
                    }
                }
            }
            return(model);
        }
        public virtual async Task RunReminder(CustomerReminder customerReminder)
        {
            if (customerReminder.ReminderRule == CustomerReminderRuleEnum.AbandonedCart)
            {
                await _customerReminderService.Task_AbandonedCart(customerReminder.Id);
            }

            if (customerReminder.ReminderRule == CustomerReminderRuleEnum.Birthday)
            {
                await _customerReminderService.Task_Birthday(customerReminder.Id);
            }

            if (customerReminder.ReminderRule == CustomerReminderRuleEnum.LastActivity)
            {
                await _customerReminderService.Task_LastActivity(customerReminder.Id);
            }

            if (customerReminder.ReminderRule == CustomerReminderRuleEnum.LastPurchase)
            {
                await _customerReminderService.Task_LastPurchase(customerReminder.Id);
            }

            if (customerReminder.ReminderRule == CustomerReminderRuleEnum.RegisteredCustomer)
            {
                await _customerReminderService.Task_RegisteredCustomer(customerReminder.Id);
            }
        }
Esempio n. 4
0
        public static CustomerReminderModel ToModel(this CustomerReminder entity, IDateTimeHelper dateTimeHelper)
        {
            var reminder = entity.MapTo <CustomerReminder, CustomerReminderModel>();

            reminder.StartDateTime  = entity.StartDateTimeUtc.ConvertToUserTime(dateTimeHelper);
            reminder.EndDateTime    = entity.EndDateTimeUtc.ConvertToUserTime(dateTimeHelper);
            reminder.LastUpdateDate = entity.LastUpdateDate.ConvertToUserTime(dateTimeHelper);
            return(reminder);
        }
Esempio n. 5
0
        public static CustomerReminder ToEntity(this CustomerReminderModel model, CustomerReminder destination, IDateTimeHelper dateTimeHelper)
        {
            var reminder = model.MapTo(destination);

            reminder.StartDateTimeUtc = model.StartDateTime.ConvertToUtcTime(dateTimeHelper);
            reminder.EndDateTimeUtc   = model.EndDateTime.ConvertToUtcTime(dateTimeHelper);
            reminder.LastUpdateDate   = model.LastUpdateDate.ConvertToUtcTime(dateTimeHelper);
            return(reminder);
        }
Esempio n. 6
0
 public virtual CustomerReminder.ReminderLevel UpdateReminderLevel(CustomerReminder customerReminder, CustomerReminder.ReminderLevel customerReminderLevel, CustomerReminderModel.ReminderLevelModel model)
 {
     customerReminderLevel.Level             = model.Level;
     customerReminderLevel.Name              = model.Name;
     customerReminderLevel.Subject           = model.Subject;
     customerReminderLevel.BccEmailAddresses = model.BccEmailAddresses;
     customerReminderLevel.Body              = model.Body;
     customerReminderLevel.EmailAccountId    = model.EmailAccountId;
     customerReminderLevel.Day     = model.Day;
     customerReminderLevel.Hour    = model.Hour;
     customerReminderLevel.Minutes = model.Minutes;
     _customerReminderService.UpdateCustomerReminder(customerReminder);
     _customerActivityService.InsertActivity("EditCustomerReminderCondition", customerReminder.Id, _localizationService.GetResource("ActivityLog.EditCustomerReminderLevel"), customerReminder.Name);
     return(customerReminderLevel);
 }
        public virtual CustomerReminderModel.ConditionModel PrepareConditionModel(CustomerReminder customerReminder, CustomerReminder.ReminderCondition condition)
        {
            var model = condition.ToModel();

            model.CustomerReminderId = customerReminder.Id;
            foreach (CustomerReminderConditionTypeEnum item in Enum.GetValues(typeof(CustomerReminderConditionTypeEnum)))
            {
                model.ConditionType.Add(new SelectListItem()
                {
                    Value = ((int)item).ToString(),
                    Text  = item.ToString()
                });
            }
            return(model);
        }
Esempio n. 8
0
        public virtual CustomerReminder UpdateCustomerReminderModel(CustomerReminder customerReminder, CustomerReminderModel model)
        {
            if (customerReminder.Conditions.Count() > 0)
            {
                model.ReminderRuleId = customerReminder.ReminderRuleId;
            }
            if (model.ReminderRuleId == 0)
            {
                model.ReminderRuleId = customerReminder.ReminderRuleId;
            }

            customerReminder = model.ToEntity(customerReminder);
            _customerReminderService.UpdateCustomerReminder(customerReminder);
            _customerActivityService.InsertActivity("EditCustomerReminder", customerReminder.Id, _localizationService.GetResource("ActivityLog.EditCustomerReminder"), customerReminder.Name);
            return(customerReminder);
        }
Esempio n. 9
0
        public virtual CustomerReminder.ReminderCondition InsertConditionModel(CustomerReminder customerReminder, CustomerReminderModel.ConditionModel model)
        {
            var condition = new CustomerReminder.ReminderCondition()
            {
                Name            = model.Name,
                ConditionTypeId = model.ConditionTypeId,
                ConditionId     = model.ConditionId,
            };

            customerReminder.Conditions.Add(condition);
            _customerReminderService.UpdateCustomerReminder(customerReminder);

            _customerActivityService.InsertActivity("AddNewCustomerReminderCondition", customerReminder.Id, _localizationService.GetResource("ActivityLog.AddNewCustomerReminder"), customerReminder.Name);

            return(condition);
        }
        public virtual async Task <CustomerReminder> UpdateCustomerReminderModel(CustomerReminder customerReminder, CustomerReminderModel model)
        {
            if (customerReminder.Conditions.Count() > 0)
            {
                model.ReminderRuleId = customerReminder.ReminderRuleId;
            }
            if (model.ReminderRuleId == 0)
            {
                model.ReminderRuleId = customerReminder.ReminderRuleId;
            }

            customerReminder = model.ToEntity(customerReminder, _dateTimeService);
            await _customerReminderService.UpdateCustomerReminder(customerReminder);

            await _customerActivityService.InsertActivity("EditCustomerReminder", customerReminder.Id, _translationService.GetResource("ActivityLog.EditCustomerReminder"), customerReminder.Name);

            return(customerReminder);
        }
Esempio n. 11
0
        void Button_Click(object sender, RoutedEventArgs e)
        {
            CustomerReminder cr = new CustomerReminder();

            cr.Name = _cInfo.FirstName + " " + _cInfo.LastName;
            cr.ExtraInfo = txtExtra.Text;
            cr.PhoneNumber = _cInfo.PhoneNumber;
            cr.SQLID = _cInfo.SQLID;
            cr.ReminderTime = remDT.Value;
            cr.How = cmbHow.Text;
            cr.Reason = cmbReason.Text;

            Reminder.AddReminder(cr);

            txtExtra.Text = string.Empty;
            cmbHow.SelectedItem = 0;
            cmbReason.SelectedIndex = 0;
        }
Esempio n. 12
0
        public virtual CustomerReminder.ReminderLevel InsertReminderLevel(CustomerReminder customerReminder, CustomerReminderModel.ReminderLevelModel model)
        {
            var level = new CustomerReminder.ReminderLevel()
            {
                Name              = model.Name,
                Level             = model.Level,
                BccEmailAddresses = model.BccEmailAddresses,
                Body              = model.Body,
                EmailAccountId    = model.EmailAccountId,
                Subject           = model.Subject,
                Day     = model.Day,
                Hour    = model.Hour,
                Minutes = model.Minutes,
            };

            customerReminder.Levels.Add(level);
            _customerReminderService.UpdateCustomerReminder(customerReminder);
            _customerActivityService.InsertActivity("AddNewCustomerReminderLevel", customerReminder.Id, _localizationService.GetResource("ActivityLog.AddNewCustomerReminderLevel"), customerReminder.Name);
            return(level);
        }
        public virtual async Task DeleteCustomerReminder(CustomerReminder customerReminder)
        {
            await _customerActivityService.InsertActivity("DeleteCustomerReminder", customerReminder.Id, _localizationService.GetResource("ActivityLog.DeleteCustomerReminder"), customerReminder.Name);

            await _customerReminderService.DeleteCustomerReminder(customerReminder);
        }
Esempio n. 14
0
 public static CustomerReminder ToEntity(this CustomerReminderModel model, CustomerReminder destination)
 {
     return(model.MapTo(destination));
 }
Esempio n. 15
0
        public virtual void PrepareReminderLevelModel(CustomerReminderModel.ReminderLevelModel model, CustomerReminder customerReminder)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            var emailAccounts = _emailAccountService.GetAllEmailAccounts();

            foreach (var item in emailAccounts)
            {
                model.EmailAccounts.Add(new SelectListItem
                {
                    Text  = item.Email,
                    Value = item.Id.ToString()
                });
            }
            var messageTokenProvider = Grand.Core.Infrastructure.EngineContext.Current.Resolve <IMessageTokenProvider>();

            model.AllowedTokens = messageTokenProvider.GetListOfCustomerReminderAllowedTokens(customerReminder.ReminderRule);
        }
        public virtual async Task PrepareReminderLevelModel(CustomerReminderModel.ReminderLevelModel model, CustomerReminder customerReminder)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            var emailAccounts = await _emailAccountService.GetAllEmailAccounts();

            foreach (var item in emailAccounts)
            {
                model.EmailAccounts.Add(new SelectListItem
                {
                    Text  = item.Email,
                    Value = item.Id.ToString()
                });
            }
            var messageTokenProvider = _serviceProvider.GetRequiredService <IMessageTokenProvider>();

            model.AllowedTokens = messageTokenProvider.GetListOfCustomerReminderAllowedTokens(customerReminder.ReminderRule);
        }
Esempio n. 17
0
 //customer action
 public static CustomerReminderModel ToModel(this CustomerReminder entity)
 {
     return(entity.MapTo <CustomerReminder, CustomerReminderModel>());
 }