示例#1
0
 //Constructor
 public VehiclesController(IMapper mapper, IVehicleRepository repository, IUnitOfWork unitOfWork)
 {
     this.unitOfWork = unitOfWork;
     this.mapper     = mapper;
     //  this.context = context;
     this.repository = repository;
 }
        public void Process(Core.IUnitOfWork db,
                            DTO.OrderToTrackDTO shipping,
                            string status,
                            DateTime?statusDate,
                            IList <TrackingRecord> records,
                            DateTime when)
        {
            //USPS Desc: No record of that item
            //Pre-Shipment Info Sent to USPS

            if (IsAccept(shipping, status, statusDate, records))
            {
                var type = NotificationType.LabelNeverShipped;

                var recordId = shipping.ShipmentInfoId.HasValue
                    ? shipping.ShipmentInfoId.Value
                    : (shipping.MailInfoId ?? 0);

                var additionalParams = new LabelNeverShippedParams()
                {
                    BuyDate      = shipping.BuyDate,
                    ShippingName = shipping.ShippingName,

                    Carrier         = shipping.Carrier,
                    OrderNumber     = shipping.OrderNumber,
                    LabelFromTypeId =
                        shipping.ShipmentInfoId.HasValue ? (int)LabelFromType.Batch : (int)LabelFromType.Mail,
                    ShippingInfoId = recordId,
                    ReasonId       = shipping.ReasonId
                };

                var result = _notificationService.Add(shipping.TrackingNumber,
                                                      EntityType.Tracking,
                                                      String.Empty,

                                                      additionalParams,

                                                      shipping.OrderNumber,
                                                      type);

                if (result.HasValue)
                {
                    _log.Info("Added notification, type=" + type + ", id=" + shipping.TrackingNumber);
                }
            }
            else
            {
                _notificationService.RemoveExist(shipping.TrackingNumber, Type);
            }
        }
示例#3
0
        public void Process(Core.IUnitOfWork db,
                            DTO.OrderToTrackDTO shipping,
                            string status,
                            DateTime?statusDate,
                            IList <TrackingRecord> records,
                            DateTime when)
        {
            if (IsAccept(shipping, status, statusDate, records))
            {
                var order = db.ItemOrderMappings.GetOrderWithItems(null, shipping.OrderNumber, unmaskReferenceStyle: false, includeSourceItems: false);

                var isExist = db.OrderEmailNotifies.IsExist(order.OrderId,
                                                            OrderEmailNotifyType.OutputUndeliveredAsAddressedEmail);

                if (!isExist)
                {
                    db.OrderComments.Add(new OrderComment()
                    {
                        OrderId    = order.Id,
                        Message    = "Order being returned. Undelivered As Addressed email sent to customer",
                        Type       = (int)CommentType.ReturnExchange,
                        CreateDate = _time.GetAppNowTime(),
                        UpdateDate = _time.GetAppNowTime()
                    });

                    var emailInfo = new UndeliverableAsAddressedRequestEmailInfo(_emailService.AddressService,
                                                                                 null,
                                                                                 order.OrderId,
                                                                                 (MarketType)order.Market,
                                                                                 order.Items,
                                                                                 shipping.Carrier,
                                                                                 shipping.TrackingNumber,
                                                                                 order.BuyerName,
                                                                                 order.BuyerEmail);

                    _emailService.SendEmail(emailInfo, CallSource.Service);

                    db.OrderEmailNotifies.Add(new OrderEmailNotify()
                    {
                        Type        = (int)OrderEmailNotifyType.OutputUndeliveredAsAddressedEmail,
                        OrderNumber = shipping.OrderNumber,
                        CreateDate  = when,
                    });

                    db.Commit();
                }
            }
        }
示例#4
0
        public void Process(Core.IUnitOfWork db,
                            DTO.OrderToTrackDTO shipping,
                            string status,
                            DateTime?statusDate,
                            IList <TrackingRecord> records,
                            DateTime when)
        {
            /*
             * NO AUTHORIZED RECIPIENT AVAILABLE
             *  Notice Left
             *  Notice Left (No Authorized Recipient Available)
             *  Notice Left (No Secure Location Available)
             *  Notice Left (Receptacle Full/Item Oversized)
             */
            /*
             * Please send message similar to Notice Left to orders with status “Available for pickup”.
             *  Like 115-0119209-8758666
             */
            var labelType  = shipping.MailInfoId.HasValue ? LabelFromType.Mail : LabelFromType.Batch;
            var shippingId = shipping.MailInfoId.HasValue ? shipping.MailInfoId.Value : shipping.ShipmentInfoId.Value;

            if (IsAccept(shipping, status, statusDate, records))
            {
                if (!db.OrderEmailNotifies.IsExist(shipping.OrderNumber, OrderEmailNotifyType.OutputNoticeLeft))
                {
                    _log.Info(String.Format("Order: {0}, has status: {1}",
                                            shipping.OrderNumber,
                                            status));

                    var sendEmailActionId = _actionService.AddAction(db,
                                                                     SystemActionType.SendEmail,
                                                                     shipping.OrderNumber,
                                                                     new SendEmailInput()
                    {
                        EmailType = EmailTypes.NoticeLeft,
                        OrderId   = shipping.OrderNumber,
                        Args      = new Dictionary <string, string>()
                        {
                            { "LabelType", labelType.ToString() },
                            { "ShippingOrderId", shippingId.ToString() }
                        }
                    },
                                                                     null,
                                                                     null);

                    _actionService.AddAction(db,
                                             SystemActionType.AddComment,
                                             shipping.OrderNumber,
                                             new AddCommentInput()
                    {
                        OrderId = shipping.OrderId,
                        Message = "[System] Notice Left email sent",
                        Type    = (int)CommentType.OutputEmail,
                    },
                                             sendEmailActionId,
                                             null);


                    db.OrderEmailNotifies.Add(new OrderEmailNotify()
                    {
                        Type        = (int)OrderEmailNotifyType.OutputNoticeLeft,
                        OrderNumber = shipping.OrderNumber,
                        CreateDate  = when,
                    });
                    db.Commit();
                }
                else
                {
                    _log.Info("Notice left already sent");
                }
            }
        }
 public UnitOfWorkAdapter(Core.IUnitOfWork coreUnitOfWork)
 {
     _coreUnitOfWork = coreUnitOfWork;
 }