Ejemplo n.º 1
0
        //
        // GET: /Size/

        public virtual ActionResult Index(string orderId)
        {
            LogI("Index");
            var model = new EmailFilterViewModel()
            {
                OrderNumber = orderId
            };

            if (String.IsNullOrEmpty(orderId))
            {
                model.ResponseStatus = (int)EmailResponseStatusFilterEnum.ResponseNeeded;
            }

            return(View(model));
        }
Ejemplo n.º 2
0
        public static IEnumerable <EmailViewModel> GetAll(IUnitOfWork db,
                                                          CompanyDTO company,
                                                          EmailFilterViewModel filter)
        {
            return(db.Emails.GetAllWithOrder(filter.GetModel()).Select(e =>
                                                                       new EmailViewModel()
            {
                Id = e.Id,
                Subject = e.Subject,
                FromEmail = e.From,
                ToEmail = e.To,
                ReceiveDate = e.ReceiveDate,
                FolderType = e.FolderType,
                EmailType = e.EmailType,
                IsReviewed = e.IsReviewed,

                FromName = e.FolderType == (int)EmailFolders.Sent ? company.CompanyName : e.BuyerName,
                ToName = e.FolderType == (int)EmailFolders.Sent ? e.BuyerName : company.CompanyName,
                OrderNumber = e.CustomerOrderId,
                OrderDate = e.OrderDate,
                OrderMarket = e.Market,
                OrderMarketplaceId = e.MarketplaceId,

                AnswerMessageID = e.AnswerMessageID,
                ResponseStatus = e.ResponseStatus,
                HasAttachments = e.HasAttachments,
                IsEscalated = e.IsEscalated,

                Label = new LabelViewModel()
                {
                    Carrier = e.Label.Carrier,
                    TrackingNumber = e.Label.TrackingNumber,
                    PurchaseDate = e.Label.LabelPurchaseDate,
                    ActualDeliveryDate = e.Label.ActualDeliveryDate,
                    ShippingCountry = e.Label.ShippingCountry,
                    TrackingStatusSource = e.Label.TrackingStateSource,
                    TrackingStateDate = e.Label.TrackingStateDate,
                    EstDeliveryDate = e.Label.EstimatedDeliveryDate,
                    DeliveredStatus = e.Label.DeliveredStatus
                }
            }));
        }
Ejemplo n.º 3
0
        public virtual ActionResult GetAllEmails([DataSourceRequest] DataSourceRequest request,
                                                 DateTime?dateFrom,
                                                 DateTime?dateTo,
                                                 string buyerName,
                                                 string orderNumber,
                                                 int?market,
                                                 bool onlyIncoming,
                                                 bool onlyWithoutAnswer,
                                                 bool includeSystem,
                                                 int?responseStatus)
        {
            LogI("GetAllEmails");

            request.Sorts = new List <SortDescriptor>()
            {
                new SortDescriptor("ReceiveDate", ListSortDirection.Descending)
            };

            var filter = new EmailFilterViewModel()
            {
                DateFrom          = dateFrom,
                DateTo            = dateTo,
                BuyerName         = buyerName,
                OrderNumber       = orderNumber,
                OnlyIncoming      = onlyIncoming,
                OnlyWithoutAnswer = onlyWithoutAnswer,
                IncludeSystem     = includeSystem,
                ResponseStatus    = responseStatus,
                Market            = market,
            };

            var items      = EmailViewModel.GetAll(Db, AccessManager.Company, filter);
            var dataSource = items.ToDataSourceResult(request);

            return(new JsonResult {
                Data = dataSource, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }