public virtual async Task <IEnumerable <CustomerAttributeModel> > PrepareCustomerAttributes()
        {
            var customerAttributes = await _customerAttributeService.GetAllCustomerAttributes();

            return(customerAttributes.Select((Func <CustomerAttribute, CustomerAttributeModel>)(x =>
            {
                var attributeModel = x.ToModel();
                attributeModel.AttributeControlTypeName = TranslateExtensions.GetTranslationEnum <Domain.Catalog.AttributeControlType>(x.AttributeControlTypeId, (ITranslationService)_translationService, (IWorkContext)_workContext);
                return attributeModel;
            })));
        }
Beispiel #2
0
        public virtual async Task <IEnumerable <CheckoutAttributeModel> > PrepareCheckoutAttributeListModel()
        {
            var checkoutAttributes = await _checkoutAttributeService.GetAllCheckoutAttributes(ignorAcl : true);

            return(checkoutAttributes.Select((Func <CheckoutAttribute, CheckoutAttributeModel>)(x =>
            {
                var attributeModel = x.ToModel();
                attributeModel.AttributeControlTypeName = TranslateExtensions.GetTranslationEnum <AttributeControlType>(x.AttributeControlTypeId, (ITranslationService)_translationService, (IWorkContext)_workContext);
                return attributeModel;
            })));
        }
        public async Task <IActionResult> QueuedEmailList(DataSourceRequest command, QueuedEmailListModel model)
        {
            DateTime?startDateValue = (model.SearchStartDate == null) ? null
                            : (DateTime?)_dateTimeService.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeService.CurrentTimeZone);

            DateTime?endDateValue = (model.SearchEndDate == null) ? null
                            : (DateTime?)_dateTimeService.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);

            var queuedEmails = await _queuedEmailService.SearchEmails(model.SearchFromEmail, model.SearchToEmail, model.SearchText,
                                                                      startDateValue, endDateValue,
                                                                      model.SearchLoadNotSent, false, model.SearchMaxSentTries, true,
                                                                      command.Page - 1, command.PageSize);

            var gridModel = new DataSourceResult
            {
                Data = queuedEmails.Select((Func <QueuedEmail, QueuedEmailModel>)(x =>
                {
                    var m          = x.ToModel();
                    m.PriorityName = TranslateExtensions.GetTranslationEnum <QueuedEmailPriority>(x.PriorityId, (ITranslationService)_translationService, (IWorkContext)_workContext);
                    m.CreatedOn    = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc);
                    if (x.DontSendBeforeDateUtc.HasValue)
                    {
                        m.DontSendBeforeDate = _dateTimeService.ConvertToUserTime(x.DontSendBeforeDateUtc.Value, DateTimeKind.Utc);
                    }
                    if (x.SentOnUtc.HasValue)
                    {
                        m.SentOn = _dateTimeService.ConvertToUserTime(x.SentOnUtc.Value, DateTimeKind.Utc);
                    }
                    if (x.ReadOnUtc.HasValue)
                    {
                        m.ReadOn = _dateTimeService.ConvertToUserTime(x.ReadOnUtc.Value, DateTimeKind.Utc);
                    }

                    m.Body = "";

                    return(m);
                })),
                Total = queuedEmails.TotalCount
            };

            return(Json(gridModel));
        }