Пример #1
0
        internal void FlagAsShipped()
        {
            if (Status != OrderStatus.ReadyToShip)
                throw new InvalidOperationException("Only confirmed orders can be shipped.");

            Status = OrderStatus.ReadyToShip;
        }
Пример #2
0
 public void AddOrderHistory(int id, string ticker, decimal price, decimal volume, OrderType type, int period, int tick, OrderStatus status)
 {
     this.EnqueueCallback(delegate
     {
         StateManager.AddArchiveOrder(id, ticker, price, volume, type, period, tick, status);
     });
 }
Пример #3
0
		public OrderDetailsReceivedImpl(string customerId, string orderId, DateTime created, OrderStatus status)
		{
			CustomerId = customerId;
			OrderId = orderId;
			Created = created;
			Status = status;
		}
Пример #4
0
        public void Shipped()
        {
            if (Status != OrderStatus.Confirmed)
                throw new InvalidOperationException("Order not confirmed!");

            Status = OrderStatus.Confirmed;
        }
 private void Record(string notificationType, string code, OrderStatus status)
 {
     using (var writer = new StreamWriter(new FileStream(Configuration.OrderLog, FileMode.Append)))
     {
         writer.WriteLine("{0}: {1} {2}", notificationType, code, status);
     }
 }
 public void ChangeOrderStatus(int orderId, OrderStatus newStatus)
 {
     OrderDB orderDB = new OrderDB();
     Order order = orderDB.GetById(orderId);
     order.StatusID = newStatus;
     order.Update();
 }
Пример #7
0
 protected void EmitCancelReject(
     Order order,
     OrderStatus status,
     string message
     )
 {
 }
Пример #8
0
 public void CompleteOrder(Guid id)
 {
     if (OrderStatus.SameValueAs(OrderStatus.InProgress) || OrderStatus.SameValueAs(OrderStatus.Completed))
         OrderStatus = OrderStatus.Completed;
     else
         throw new InvalidOperationException("This order has been canceled and can not be completed.");
 }
Пример #9
0
        public void Confirm()
        {
            if (Status != OrderStatus.Draft)
                throw new InvalidOperationException("Only draft orders can be confirmed.");

            Status = OrderStatus.Confirmed;
        }
Пример #10
0
 public string GetOrderStatusStr(OrderStatus orderStatus)
 {
     switch (orderStatus)
     {
         case OrderStatus.ChuShou:
             {
                 return "出售中";
             }
         case OrderStatus.ShenHe:
             {
                 return "审核中";
             }
         case OrderStatus.GongShi:
             {
                 return "公示";
             }
         case OrderStatus.NotComplete:
             {
                 return "订单未完成";
             }
         case OrderStatus.ShenHeFail:
         {
             return "审核失败";
         }
         default:
             {
                 return "未知状态";
             }
     }
 }
Пример #11
0
 public Order(Guid userId, ICollection<OrderItem> items, NpDepartment npDepartment, OrderStatus status)
 {
     UserId = userId;
     OrderItems = items;
     NpDepartment = npDepartment;
     Status = status;
 }
Пример #12
0
        public OrderStatusFilter(OrderStatus orderStatus)
        {
            switch (orderStatus)
            {
                case OrderStatus.Pending:
                    this.value = "pending";
                    break;

                case OrderStatus.Processing:
                    this.value = "processing";
                    break;

                case OrderStatus.OnHold:
                    this.value = "on-hold";
                    break;

                case OrderStatus.Completed:
                    this.value = "completed";
                    break;

                case OrderStatus.Cancelled:
                    this.value = "cancelled";
                    break;

                case OrderStatus.Refunded:
                    this.value = "refunded";
                    break;

                case OrderStatus.Failed:
                    this.value = "failed";
                    break;
            }
        }
Пример #13
0
        internal void FlagAsReadyToShip()
        {
            if (Status != OrderStatus.Draft)
                throw new InvalidOperationException("Only draft orders can be confirmed.");

            Status = OrderStatus.ReadyToShip;
        }
Пример #14
0
        /// <summary>
        /// Get best customers
        /// </summary>
        /// <param name="createdFromUtc">Order created date from (UTC); null to load all records</param>
        /// <param name="createdToUtc">Order created date to (UTC); null to load all records</param>
        /// <param name="os">Order status; null to load all records</param>
        /// <param name="ps">Order payment status; null to load all records</param>
        /// <param name="ss">Order shipment status; null to load all records</param>
        /// <param name="orderBy">1 - order by order total, 2 - order by number of orders</param>
        /// <param name="pageIndex">Page index</param>
        /// <param name="pageSize">Page size</param>
        /// <returns>Report</returns>
        public virtual IPagedList<BestCustomerReportLine> GetBestCustomersReport(DateTime? createdFromUtc,
            DateTime? createdToUtc, OrderStatus? os, PaymentStatus? ps, ShippingStatus? ss, int orderBy,
            int pageIndex = 0, int pageSize = 214748364)
        {
            int? orderStatusId = null;
            if (os.HasValue)
                orderStatusId = (int)os.Value;

            int? paymentStatusId = null;
            if (ps.HasValue)
                paymentStatusId = (int)ps.Value;

            int? shippingStatusId = null;
            if (ss.HasValue)
                shippingStatusId = (int)ss.Value;
            var query1 = from c in _customerRepository.Table
                         join o in _orderRepository.Table on c.Id equals o.CustomerId
                         where (!createdFromUtc.HasValue || createdFromUtc.Value <= o.CreatedOnUtc) &&
                         (!createdToUtc.HasValue || createdToUtc.Value >= o.CreatedOnUtc) &&
                         (!orderStatusId.HasValue || orderStatusId == o.OrderStatusId) &&
                         (!paymentStatusId.HasValue || paymentStatusId == o.PaymentStatusId) &&
                         (!shippingStatusId.HasValue || shippingStatusId == o.ShippingStatusId) &&
                         (!o.Deleted) &&
                         (!c.Deleted)
                         select new { c, o };

            var query2 = from co in query1
                         group co by co.c.Id into g
                         select new
                         {
                             CustomerId = g.Key,
                             OrderTotal = g.Sum(x => x.o.OrderTotal),
                             OrderCount = g.Count()
                         };
            switch (orderBy)
            {
                case 1:
                    {
                        query2 = query2.OrderByDescending(x => x.OrderTotal);
                    }
                    break;
                case 2:
                    {
                        query2 = query2.OrderByDescending(x => x.OrderCount);
                    }
                    break;
                default:
                    throw new ArgumentException("Wrong orderBy parameter", "orderBy");
            }

            var tmp = new PagedList<dynamic>(query2, pageIndex, pageSize);
            return new PagedList<BestCustomerReportLine>(tmp.Select(x => new BestCustomerReportLine
                {
                    CustomerId = x.CustomerId,
                    OrderTotal = x.OrderTotal,
                    OrderCount = x.OrderCount
                }),
                tmp.PageIndex, tmp.PageSize, tmp.TotalCount);
        }
Пример #15
0
 public MTDohOrcView(string externalOrderId, YellowstonePathology.Business.Domain.Physician orderingPhysician, string reportNo, OrderStatus orderStatus, string systemInitiatingOrder)
 {
     this.m_ExternalOrderId = externalOrderId;
     this.m_OrderingPhysician = orderingPhysician;
     this.m_ReportNo = reportNo;
     this.m_OrderStatus = orderStatus;
     this.m_SystemInitiatingOrder = systemInitiatingOrder;
 }
Пример #16
0
 public OrdersUpdatedEventArgs(DateTime updated, long orderNo, OrderStatus status, double price, int balance)
 {
     Updated = updated;
     OrderNo = orderNo;
     Status = status;
     Price = price;
     Balance = balance;
 }
Пример #17
0
        public void SetStatus(int id, OrderStatus status)
        {
            var order = Find(id);
            order.Status = status;
            db.SaveChanges();

            // TODO: Send emails
        }
Пример #18
0
 /// <summary>
 /// Voegt meegegeven orderstatus toe aan triggerlijst.
 /// </summary>
 /// <param name="os">Orderstatus</param>
 public void AddFireTrigger(OrderStatus os)
 {
     if (this._fireTriggers == null)
     {
         this._fireTriggers = new List<OrderStatus>();
     }
     this._fireTriggers.Add(os);
 }
Пример #19
0
 public EpicStatusMessage(string clientOrderId, OrderStatus orderStatus, YellowstonePathology.Business.ClientOrder.Model.UniversalService universalService, object writer)
 {
     this.m_ClientOrder = YellowstonePathology.Business.Persistence.DocumentGateway.Instance.PullClientOrderByClientOrderId(clientOrderId, writer);
     this.m_OrderingPhysician = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianByNpi(this.m_ClientOrder.ProviderId);
     this.m_OrderStatus = orderStatus;
     this.m_UniversalService = universalService;
     this.SetupFileNames();
 }
Пример #20
0
 public EpicStatusMessage(YellowstonePathology.Business.ClientOrder.Model.ClientOrder clientOrder, OrderStatus orderStatus, YellowstonePathology.Business.ClientOrder.Model.UniversalService universalService)
 {
     this.m_ClientOrder = clientOrder;
     this.m_OrderingPhysician = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianByNpi(this.m_ClientOrder.ProviderId);
     this.m_OrderStatus = orderStatus;
     this.m_UniversalService = universalService;
     this.SetupFileNames();
 }
 protected void BtnCreate_Click( object sender, EventArgs e )
 {
     if ( Page.IsValid ) {
     OrderStatus orderStatus = new OrderStatus( StoreId, TxtName.Text );
     orderStatus.Save();
     base.Redirect( WebUtils.GetPageUrl( Constants.Pages.EditOrderStatus ) + "?id=" + orderStatus.Id + "&storeId=" + orderStatus.StoreId );
       }
 }
Пример #22
0
        /// <summary>
        /// Gets orders by page, filtered by status
        /// </summary>
        public PagedList<Order> GetPagedOrders(int pageSize, int currentPageIndex, 
            OrderStatus status) {

            return new PagedList<Order>(_orderRepository.GetOrders()
                .Where(x=>x.Status==status),
                currentPageIndex, pageSize);

        }
Пример #23
0
 public OrderListSearchCriteria WithStatus(OrderStatus status)
 {
     OrderListSearchCriteria another = this.Clone<OrderListSearchCriteria>();
     another.Status = status;
     // need to reset page index
     another.PageIndex = 1;
     return another;
 }
        protected void ChangeOrderStatus(OrderStatus newStatus)
        {
            RaiseEvent(ChangingOrderStatusEvent, EventArgs.Empty);

            this.OrderGroup.Status = newStatus.ToString();

            RaiseEvent(ChangedOrderStatusEvent, EventArgs.Empty);
        }
Пример #25
0
 public EPICOrcView(string externalOrderId, YellowstonePathology.Business.Domain.Physician orderingPhysician, string masterAccessionNo, OrderStatus orderStatus, string systemInitiatingOrder, bool sendUnsolicited)
 {
     this.m_ExternalOrderId = externalOrderId;
     this.m_OrderingPhysician = orderingPhysician;
     this.m_MasterAccessionNo = masterAccessionNo;
     this.m_OrderStatus = orderStatus;
     this.m_SystemInitiatingOrder = systemInitiatingOrder;
     this.m_SendUnsolicited = sendUnsolicited;
 }
Пример #26
0
 /// <summary>
 /// Order Constructor.
 /// </summary>
 /// <param name="id">Id of the parent order</param>
 /// <param name="symbol">Asset Symbol</param>
 /// <param name="status">Status of the order</param>
 /// <param name="fillPrice">Fill price information if applicable.</param>
 /// <param name="fillQuantity">Fill quantity</param>
 /// <param name="message">Message from the exchange</param>
 public OrderEvent(int id = 0, string symbol = "", OrderStatus status = OrderStatus.None, decimal fillPrice = 0, int fillQuantity = 0, string message = "")
 {
     OrderId = id;
     Status = status;
     FillPrice = fillPrice;
     Message = message;
     FillQuantity = fillQuantity;
     Symbol = symbol;
 }
Пример #27
0
 public Order(int productsCount)
 {
     this.cardData = new Card();
     this.status = OrderStatus.Pending;
     this.products = new List<Product>();
     for (int i = 0; i < productsCount; i++)
     {
         this.products[i] = new Product();
     }
 }
Пример #28
0
 /// <summary>
 /// Order Constructor.
 /// </summary>
 /// <param name="id">Id of the parent order</param>
 /// <param name="symbol">Asset Symbol</param>
 /// <param name="status">Status of the order</param>
 /// <param name="direction">The direction of the order this event belongs to</param>
 /// <param name="fillPrice">Fill price information if applicable.</param>
 /// <param name="fillQuantity">Fill quantity</param>
 /// <param name="message">Message from the exchange</param>
 public OrderEvent(int id, string symbol, OrderStatus status, OrderDirection direction, decimal fillPrice, int fillQuantity, string message = "")
 {
     OrderId = id;
     Status = status;
     FillPrice = fillPrice;
     Message = message;
     FillQuantity = fillQuantity;
     Symbol = symbol;
     Direction = direction;
 }
Пример #29
0
 public void Pay(PaymentInformation paymentInformation)
 {
     if (CalculateTotal() != paymentInformation.Amount)
     {
         throw new InvalidPaymentException();
     }
     Status = OrderStatus.Preparing;
     PaymentDateUtc = DateTime.UtcNow;
     PaymentInfo = paymentInformation;
 }
Пример #30
0
 public Orders(int orderID, string orderName, Customers customer, DateTime orderDate, OrderStatus orderStatus, string comments, Services orderService, Addresses shipFrom, Addresses shipTo, float totalPrice, float addTime, string container, float deliveryDuration, DriverLicenseTypes orderLicenseType, DriverLicenseTypes orderCertificationType, string inShift, int shiftSort, Trucks truck, string active, Drivers driver)
 {
     OrderID                = orderID;
     OrderName              = orderName;
     Customer               = customer;
     OrderDate              = orderDate;
     OrderStatus            = orderStatus;
     Comments               = comments;
     OrderService           = orderService;
     ShipFrom               = shipFrom;
     ShipTo                 = shipTo;
     TotalPrice             = totalPrice;
     AddTime                = addTime;
     Container              = container;
     OrderLicenseType       = orderLicenseType;
     OrderCertificationType = orderCertificationType;
     InShift                = inShift;
     ShiftSort              = shiftSort;
     Truck            = truck;
     Active           = active;
     Driver           = driver;
     DeliveryDuration = deliveryDuration;
 }
Пример #31
0
        public ActionResult AddOrderStatus()
        {
            OrderStatus orderStatus = new OrderStatus();

            return(View(orderStatus));
        }
Пример #32
0
 public Order(DateTime date, OrderStatus status, Client client)
 {
     Date   = date;
     Status = status;
     Client = client;
 }
Пример #33
0
        /// <summary>
        /// Get order average report
        /// </summary>
        /// <param name="storeId">Store identifier</param>
        /// <param name="os">Order status</param>
        /// <returns>Result</returns>
        public virtual OrderAverageReportLineSummary OrderAverageReport(int storeId, OrderStatus os)
        {
            var item = new OrderAverageReportLineSummary();

            item.OrderStatus = os;

            DateTime     nowDt         = _dateTimeHelper.ConvertToUserTime(DateTime.Now);
            TimeZoneInfo timeZone      = _dateTimeHelper.CurrentTimeZone;
            var          orderStatusId = new int[] { (int)os };

            //today
            DateTime t1 = new DateTime(nowDt.Year, nowDt.Month, nowDt.Day);

            if (!timeZone.IsInvalidTime(t1))
            {
                DateTime?startTime1  = _dateTimeHelper.ConvertToUtcTime(t1, timeZone);
                DateTime?endTime1    = null;
                var      todayResult = GetOrderAverageReportLine(storeId, orderStatusId, null, null, startTime1, endTime1, null);
                item.SumTodayOrders   = todayResult.SumOrders;
                item.CountTodayOrders = todayResult.CountOrders;
            }
            //week
            DayOfWeek fdow  = CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek;
            DateTime  today = new DateTime(nowDt.Year, nowDt.Month, nowDt.Day);
            DateTime  t2    = today.AddDays(-(today.DayOfWeek - fdow));

            if (!timeZone.IsInvalidTime(t2))
            {
                DateTime?startTime2 = _dateTimeHelper.ConvertToUtcTime(t2, timeZone);
                DateTime?endTime2   = null;
                var      weekResult = GetOrderAverageReportLine(storeId, orderStatusId, null, null, startTime2, endTime2, null);
                item.SumThisWeekOrders   = weekResult.SumOrders;
                item.CountThisWeekOrders = weekResult.CountOrders;
            }
            //month
            DateTime t3 = new DateTime(nowDt.Year, nowDt.Month, 1);

            if (!timeZone.IsInvalidTime(t3))
            {
                DateTime?startTime3  = _dateTimeHelper.ConvertToUtcTime(t3, timeZone);
                DateTime?endTime3    = null;
                var      monthResult = GetOrderAverageReportLine(storeId, orderStatusId, null, null, startTime3, endTime3, null);
                item.SumThisMonthOrders   = monthResult.SumOrders;
                item.CountThisMonthOrders = monthResult.CountOrders;
            }
            //year
            DateTime t4 = new DateTime(nowDt.Year, 1, 1);

            if (!timeZone.IsInvalidTime(t4))
            {
                DateTime?startTime4 = _dateTimeHelper.ConvertToUtcTime(t4, timeZone);
                DateTime?endTime4   = null;
                var      yearResult = GetOrderAverageReportLine(storeId, orderStatusId, null, null, startTime4, endTime4, null);
                item.SumThisYearOrders   = yearResult.SumOrders;
                item.CountThisYearOrders = yearResult.CountOrders;
            }
            //all time
            DateTime?startTime5    = null;
            DateTime?endTime5      = null;
            var      allTimeResult = GetOrderAverageReportLine(storeId, orderStatusId, null, null, startTime5, endTime5, null);

            item.SumAllTimeOrders   = allTimeResult.SumOrders;
            item.CountAllTimeOrders = allTimeResult.CountOrders;

            return(item);
        }
Пример #34
0
 public void SetOrderStatus(OrderStatus orderStatus)
 {
     OrderStatus = orderStatus;
 }
Пример #35
0
 /// <summary>
 /// 获取员工在指定的订单状态下
 /// </summary>
 /// <param name="orderStatus">订单状态</param>
 /// <param name="id">员工Id</param>
 /// <returns></returns>
 public static int GetOrderTodoCount(OrderStatus orderStatus, Guid id, Guid providerId)
 {
     return(OrderStatusAdapter.GetOrderTodoCount(orderStatus, id, providerId));
 }
Пример #36
0
 public static int SetOrderStatus(int orderid, OrderStatus status)
 {
     return(OrderDAL.UpdateOrderStatus(orderid, status));
 }
Пример #37
0
 private void Handle(OrderReservationConfirmedEvent evnt)
 {
     _status = evnt.OrderStatus;
 }
Пример #38
0
 private void Handle(OrderPaymentConfirmedEvent evnt)
 {
     _status = evnt.OrderStatus;
 }
Пример #39
0
 public Order(DateTime moment, OrderStatus status, Client client)
 {
     Moment = moment;
     Status = status;
     Client = client;
 }
Пример #40
0
 public void SetOrderStatus(Order order, OrderStatus status)
 {
     throw new NotImplementedException();
 }
Пример #41
0
 private void rptOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         HtmlAnchor         htmlAnchor           = (HtmlAnchor)e.Item.FindControl("lkbtnCouponCode");
         HtmlAnchor         htmlAnchor2          = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund");
         HtmlAnchor         htmlAnchor3          = (HtmlAnchor)e.Item.FindControl("lnkClose");
         HtmlAnchor         htmlAnchor4          = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
         HtmlAnchor         htmlAnchor5          = (HtmlAnchor)e.Item.FindControl("lkbtnProductReview");
         Literal            literal              = (Literal)e.Item.FindControl("ltlOrderItems");
         Literal            literal2             = (Literal)e.Item.FindControl("ltlOrderGifts");
         HtmlGenericControl htmlGenericControl   = e.Item.FindControl("panelOperaters") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl2  = e.Item.FindControl("divToDetail") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl3  = e.Item.FindControl("divOrderStatus") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl4  = e.Item.FindControl("divOrderError") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl5  = e.Item.FindControl("divOrderGifts") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl6  = e.Item.FindControl("divOrderItems") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl7  = (HtmlGenericControl)e.Item.FindControl("OrderIdSpan");
         HtmlGenericControl htmlGenericControl8  = (HtmlGenericControl)e.Item.FindControl("PayMoneySpan");
         HtmlGenericControl htmlGenericControl9  = (HtmlGenericControl)e.Item.FindControl("TakeCodeDIV");
         HtmlAnchor         htmlAnchor6          = (HtmlAnchor)e.Item.FindControl("lnkViewLogistics");
         HtmlAnchor         htmlAnchor7          = (HtmlAnchor)e.Item.FindControl("lnkToPay");
         HtmlAnchor         htmlAnchor8          = (HtmlAnchor)e.Item.FindControl("lnkHelpLink");
         HtmlAnchor         htmlAnchor9          = (HtmlAnchor)e.Item.FindControl("lnkFinishOrder");
         HtmlAnchor         htmlAnchor10         = (HtmlAnchor)e.Item.FindControl("lnkViewTakeCodeQRCode");
         HtmlAnchor         htmlAnchor11         = (HtmlAnchor)e.Item.FindControl("lnkCertification");
         HtmlGenericControl htmlGenericControl10 = (HtmlGenericControl)e.Item.FindControl("divSendRedEnvelope");
         OrderStatus        orderStatus          = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
         Repeater           repeater             = (Repeater)e.Item.FindControl("Repeater1");
         Repeater           repeater2            = (Repeater)e.Item.FindControl("rptPointGifts");
         this.paymenttypeselect = (Common_WAPPaymentTypeSelect)this.FindControl("paymenttypeselect");
         Literal   literal3  = (Literal)e.Item.FindControl("litGiftTitle");
         string    text      = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
         OrderInfo orderInfo = TradeHelper.GetOrderInfo(text);
         if (orderInfo != null)
         {
             if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History)
             {
                 WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                 bool visible = false;
                 if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                 {
                     visible = true;
                 }
                 if (htmlGenericControl10 != null)
                 {
                     htmlGenericControl10.Visible = visible;
                     if (this.isVShop)
                     {
                         htmlGenericControl10.InnerHtml = "<a href=\"/vshop/SendRedEnvelope.aspx?OrderId=" + orderInfo.OrderId + "\"></a>";
                     }
                     else
                     {
                         htmlGenericControl10.InnerHtml = "";
                         string text2 = Globals.HttpsFullPath("/vshop/SendRedEnvelope.aspx?OrderId=" + orderInfo.OrderId);
                         htmlGenericControl10.Attributes.Add("onclick", string.Format("ShowMsg('{0}','{1}')", "代金红包请前往微信端领取!", "false"));
                     }
                 }
             }
             this.paymenttypeselect.ClientType = base.ClientType;
             htmlGenericControl4.Visible       = (orderInfo.IsError && orderInfo.CloseReason != "订单已退款完成");
             htmlGenericControl3.Visible       = !orderInfo.IsError;
             htmlGenericControl5.Visible       = (orderInfo.LineItems.Count() == 0);
             htmlGenericControl6.Visible       = (orderInfo.LineItems.Count() > 0);
             htmlAnchor2.HRef   = "ApplyRefund.aspx?OrderId=" + text;
             htmlAnchor.Visible = false;
             htmlAnchor.HRef    = "MemberOrdersVCode?OrderId=" + text;
             HtmlGenericControl htmlGenericControl11 = (HtmlGenericControl)e.Item.FindControl("OrderSupplierH3");
             string             text3 = string.Empty;
             if (htmlGenericControl11 != null)
             {
                 text3 = htmlGenericControl11.Attributes["class"];
                 text3 = ((!string.IsNullOrEmpty(text3)) ? text3.Replace(" ztitle", "").Replace("stitle", "") : "");
             }
             if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P"))
             {
                 if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName))
                 {
                     htmlGenericControl7.InnerText = orderInfo.StoreName;
                     text3 += " mtitle";
                 }
                 else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0)
                 {
                     htmlGenericControl7.InnerText = orderInfo.ShipperName;
                     text3 += " stitle";
                 }
                 else
                 {
                     htmlGenericControl7.InnerText = "平台";
                     text3 += " ztitle";
                 }
                 htmlGenericControl11.Attributes["class"] = text3;
                 if (orderInfo.LineItems.Count <= 0)
                 {
                     literal3.Text = "(礼)";
                 }
             }
             else
             {
                 htmlGenericControl7.InnerText            = orderInfo.OrderId;
                 htmlGenericControl11.Attributes["class"] = text3;
             }
             if (orderInfo.PreSaleId > 0)
             {
                 htmlGenericControl8.InnerText = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2");
             }
             else
             {
                 htmlGenericControl8.InnerText = Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "OrderTotal")).F2ToString("f2");
             }
             if (htmlGenericControl2 != null)
             {
                 if (orderInfo.OrderType == OrderType.ServiceOrder)
                 {
                     htmlGenericControl2.Attributes.Add("onclick", "window.location.href='ServiceMemberOrderDetails.aspx?orderId=" + orderInfo.OrderId + "'");
                 }
                 else
                 {
                     htmlGenericControl2.Attributes.Add("onclick", "window.location.href='MemberOrderDetails.aspx?orderId=" + orderInfo.OrderId + "'");
                 }
             }
             if (htmlAnchor6 != null)
             {
                 if (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent || orderInfo.OrderStatus == OrderStatus.Finished)
                 {
                     if (!string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber))
                     {
                         htmlAnchor6.HRef = "MyLogistics.aspx?OrderId=" + text;
                     }
                     else if (orderInfo.ExpressCompanyName == "同城物流配送")
                     {
                         htmlAnchor6.HRef = "MyLogistics.aspx?OrderId=" + text;
                     }
                     else
                     {
                         htmlAnchor6.Visible = false;
                     }
                 }
                 else
                 {
                     htmlAnchor6.Visible = false;
                 }
             }
             if (htmlAnchor10 != null)
             {
                 htmlAnchor10.HRef = "ViewQRCode.aspx?orderId=" + orderInfo.OrderId;
             }
             int num4;
             if (htmlAnchor5 != null && ((orderStatus == OrderStatus.Finished && orderInfo.LineItems.Count > 0) || (orderStatus == OrderStatus.Closed && orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count && orderInfo.LineItems.Count > 0)))
             {
                 htmlAnchor5.Visible = true;
                 htmlAnchor5.HRef    = "MemberSubmitProductReview.aspx?orderId=" + text;
                 DataTable    productReviewAll = ProductBrowser.GetProductReviewAll(text);
                 LineItemInfo lineItemInfo     = new LineItemInfo();
                 int          num  = 0;
                 int          num2 = 0;
                 int          num3 = 0;
                 bool         flag = false;
                 foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                 {
                     flag         = false;
                     lineItemInfo = lineItem.Value;
                     for (int i = 0; i < productReviewAll.Rows.Count; i++)
                     {
                         num4 = lineItemInfo.ProductId;
                         if (num4.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim())
                         {
                             flag = true;
                         }
                     }
                     if (!flag)
                     {
                         num2++;
                     }
                     else
                     {
                         num3++;
                     }
                 }
                 if (num + num2 == orderInfo.LineItems.Count)
                 {
                     htmlAnchor5.InnerText = "查看评论";
                 }
                 else
                 {
                     SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                     if (masterSettings != null)
                     {
                         if (masterSettings.ProductCommentPoint <= 0)
                         {
                             htmlAnchor5.InnerText = "评价";
                         }
                         else
                         {
                             htmlAnchor5.InnerText = $"评价得{num3 * masterSettings.ProductCommentPoint}积分";
                         }
                     }
                 }
             }
             if (htmlAnchor3 != null && orderStatus == OrderStatus.WaitBuyerPay)
             {
                 if (orderInfo.PreSaleId == 0 || (orderInfo.PreSaleId > 0 && !orderInfo.DepositDate.HasValue))
                 {
                     htmlAnchor3.Visible = true;
                 }
                 htmlAnchor3.Attributes.Add("onclick", $"closeOrder('{text}')");
             }
             DateTime dateTime;
             if (htmlAnchor7 != null)
             {
                 if (orderStatus == OrderStatus.WaitBuyerPay && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.PaymentTypeId != -3 && orderInfo.Gateway != "hishop.plugins.payment.bankrequest" && orderInfo.Gateway != "hishop.plugins.payment.podrequest")
                 {
                     htmlAnchor7.Attributes.Add("IsServiceOrder", (orderInfo.OrderType == OrderType.ServiceOrder).ToString().ToLower());
                     if (orderInfo.PreSaleId > 0)
                     {
                         ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                         if (!orderInfo.DepositDate.HasValue)
                         {
                             htmlGenericControl8.InnerText = orderInfo.Deposit.F2ToString("f2");
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "定金:¥";
                             if (productPreSaleInfo.PreSaleEndDate > DateTime.Now)
                             {
                                 AttributeCollection attributes = htmlAnchor7.Attributes;
                                 num4 = orderInfo.PaymentTypeId;
                                 attributes.Add("PaymentTypeId", num4.ToString());
                                 htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                                 htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.Deposit.F2ToString("f2"));
                                 AttributeCollection attributes2 = htmlAnchor7.Attributes;
                                 num4 = orderInfo.FightGroupId;
                                 attributes2.Add("FightGroupId", num4.ToString());
                             }
                             else
                             {
                                 htmlAnchor7.Visible = false;
                                 (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "定金:¥";
                             }
                         }
                         else if (productPreSaleInfo.PaymentStartDate > DateTime.Now || productPreSaleInfo.PaymentEndDate < DateTime.Now)
                         {
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款:¥";
                             htmlGenericControl8.InnerText = orderInfo.FinalPayment.F2ToString("f2");
                             htmlAnchor7.Visible           = false;
                             htmlAnchor3.Visible           = false;
                             if (productPreSaleInfo.PaymentEndDate < DateTime.Now)
                             {
                                 (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款支付结束";
                                 htmlGenericControl8.Visible = false;
                             }
                         }
                         else
                         {
                             AttributeCollection attributes3 = htmlAnchor7.Attributes;
                             num4 = orderInfo.PaymentTypeId;
                             attributes3.Add("PaymentTypeId", num4.ToString());
                             htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                             htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.FinalPayment.F2ToString("f2"));
                             AttributeCollection attributes4 = htmlAnchor7.Attributes;
                             num4 = orderInfo.FightGroupId;
                             attributes4.Add("FightGroupId", num4.ToString());
                             htmlGenericControl8.InnerText = orderInfo.FinalPayment.F2ToString("f2");
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款:¥";
                             htmlAnchor3.Visible = false;
                         }
                     }
                     else
                     {
                         AttributeCollection attributes5 = htmlAnchor7.Attributes;
                         num4 = orderInfo.PaymentTypeId;
                         attributes5.Add("PaymentTypeId", num4.ToString());
                         htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                         htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.GetTotal(false).F2ToString("f2"));
                         AttributeCollection attributes6 = htmlAnchor7.Attributes;
                         num4 = orderInfo.FightGroupId;
                         attributes6.Add("FightGroupId", num4.ToString());
                         if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime)
                         {
                             StoresInfo storeById = StoresHelper.GetStoreById(orderInfo.StoreId);
                             dateTime = DateTime.Now;
                             string str = dateTime.ToString("yyyy-MM-dd");
                             dateTime = storeById.OpenStartDate;
                             DateTime value = (str + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                             dateTime = DateTime.Now;
                             string str2 = dateTime.ToString("yyyy-MM-dd");
                             dateTime = storeById.OpenEndDate;
                             DateTime dateTime2 = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                             if (dateTime2 <= value)
                             {
                                 dateTime2 = dateTime2.AddDays(1.0);
                             }
                             if (DateTime.Now < value || DateTime.Now > dateTime2)
                             {
                                 htmlAnchor7.Attributes.Add("NeedNotInTimeTip", "1");
                             }
                         }
                     }
                 }
                 else
                 {
                     htmlAnchor7.Visible = false;
                 }
             }
             if (htmlAnchor8 != null)
             {
                 if (orderInfo.Gateway == "hishop.plugins.payment.bankrequest" && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                 {
                     htmlAnchor8.HRef = "FinishOrder.aspx?OrderId=" + text + "&onlyHelp=true";
                 }
                 else
                 {
                     htmlAnchor8.Visible = false;
                 }
             }
             if (htmlAnchor9 != null)
             {
                 if (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl)
                 {
                     htmlAnchor9.Attributes.Add("onclick", $"FinishOrder('{text}','{orderInfo.PaymentType}',{orderInfo.LineItems.Count})");
                 }
                 else
                 {
                     htmlAnchor9.Visible = false;
                 }
             }
             if (htmlAnchor11 != null)
             {
                 if (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods)
                 {
                     htmlAnchor11.Attributes.Add("orderId", orderInfo.OrderId);
                     htmlAnchor11.Attributes.Add("onclick", "Certification(this)");
                     htmlAnchor11.Visible = true;
                 }
                 else
                 {
                     htmlAnchor11.Visible = false;
                 }
             }
             if (literal != null)
             {
                 Literal literal4 = literal;
                 num4          = this.GetGoodsNum(orderInfo);
                 literal4.Text = num4.ToString();
             }
             if (literal2 != null)
             {
                 Literal literal5 = literal2;
                 num4          = this.GetGiftsNum(orderInfo);
                 literal5.Text = num4.ToString();
             }
             if (orderInfo.OrderType == OrderType.ServiceOrder)
             {
                 Label label = (Label)e.Item.FindControl("OrderStatusLabel2");
                 IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(orderInfo.OrderId);
                 ServiceOrderStatus orderStatus2 = this.GetOrderStatus(orderInfo, orderVerificationItems);
                 label.Text    = ((Enum)(object)orderStatus2).ToDescription();
                 label.Visible = true;
             }
             else
             {
                 OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("OrderStatusLabel1");
                 orderStatusLabel.OrderItemStatus    = ((orderInfo.ItemStatus != 0) ? OrderItemStatus.HasReturnOrReplace : OrderItemStatus.Nomarl);
                 orderStatusLabel.Gateway            = orderInfo.Gateway;
                 orderStatusLabel.OrderStatusCode    = orderInfo.OrderStatus;
                 orderStatusLabel.ShipmentModelId    = orderInfo.ShippingModeId;
                 orderStatusLabel.IsConfirm          = orderInfo.IsConfirm;
                 orderStatusLabel.ShipmentModelId    = orderInfo.ShippingModeId;
                 orderStatusLabel.PaymentTypeId      = orderInfo.PaymentTypeId;
                 orderStatusLabel.PreSaleId          = orderInfo.PreSaleId;
                 orderStatusLabel.DepositDate        = orderInfo.DepositDate;
                 orderStatusLabel.OrderType          = orderInfo.OrderType;
                 orderStatusLabel.ExpressCompanyName = orderInfo.ExpressCompanyName;
                 orderStatusLabel.DadaStatus         = orderInfo.DadaStatus;
                 orderStatusLabel.Visible            = true;
             }
             Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
             foreach (string key in lineItems.Keys)
             {
                 lineItems[key].IsValid = (orderInfo.OrderType == OrderType.ServiceOrder);
             }
             repeater.DataSource     = lineItems.Values;
             repeater.ItemDataBound += this.Repeater1_ItemDataBound;
             repeater.DataBind();
             if (orderInfo.LineItems.Count == 0)
             {
                 IEnumerable <OrderGiftInfo> enumerable = from a in orderInfo.Gifts
                                                          where a.PromoteType == 0 || a.PromoteType == 15
                                                          select a;
                 foreach (OrderGiftInfo item in enumerable)
                 {
                     item.NeedPoint = ((orderInfo.OrderType == OrderType.ServiceOrder) ? 1 : 0);
                 }
                 repeater2.DataSource     = enumerable;
                 repeater2.ItemDataBound += this.rptPointGifts_ItemDataBound;
                 repeater2.DataBind();
             }
             OrderItemStatus itemStatus = orderInfo.ItemStatus;
             DateTime        obj;
             if (DataBinder.Eval(e.Item.DataItem, "FinishDate") != DBNull.Value)
             {
                 obj = (DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate");
             }
             else
             {
                 dateTime = DateTime.Now;
                 obj      = dateTime.AddYears(-1);
             }
             DateTime dateTime3 = obj;
             string   text4     = "";
             if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
             {
                 text4 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
             }
             RefundInfo refundInfo = TradeHelper.GetRefundInfo(text);
             if (htmlAnchor2 != null)
             {
                 if (orderInfo.OrderType == OrderType.ServiceOrder)
                 {
                     htmlAnchor2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.LineItems.Count != 0);
                     if (htmlAnchor2.Visible)
                     {
                         LineItemInfo value2 = orderInfo.LineItems.FirstOrDefault().Value;
                         if (value2.IsRefund)
                         {
                             if (value2.IsOverRefund)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else if (value2.IsValid)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else if (DateTime.Now >= value2.ValidStartDate.Value && DateTime.Now <= value2.ValidEndDate.Value)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else
                             {
                                 htmlAnchor2.Visible = false;
                             }
                         }
                         else
                         {
                             htmlAnchor2.Visible = false;
                         }
                     }
                 }
                 else
                 {
                     htmlAnchor2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.LineItems.Count != 0 && orderInfo.GetPayTotal() > decimal.Zero);
                 }
             }
             if (htmlAnchor != null)
             {
                 htmlAnchor.Visible = (orderInfo.OrderType == OrderType.ServiceOrder && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
             }
             SiteSettings masterSettings2 = SettingsManager.GetMasterSettings();
             if (!string.IsNullOrEmpty(orderInfo.TakeCode) && (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.WaitBuyerPay))
             {
                 htmlAnchor10.Visible = true;
             }
             if (!htmlAnchor2.Visible && !htmlAnchor4.Visible && !htmlAnchor10.Visible && !htmlAnchor6.Visible && !htmlAnchor3.Visible && !htmlAnchor7.Visible && !htmlAnchor8.Visible && !htmlAnchor9.Visible && !htmlAnchor5.Visible && !htmlAnchor.Visible)
             {
                 htmlGenericControl.Visible = false;
             }
             if (orderInfo.FightGroupId > 0)
             {
                 FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                 if (fightGroup != null)
                 {
                     htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                 }
             }
         }
     }
 }
Пример #42
0
 public void setStatus(OrderStatus status)
 {
     this.status = status;
 }
Пример #43
0
 public bool InsertOrderStatus(OrderStatus con)
 {
     return(ordstatusDa.InsertOrderStatus(con));
 }
Пример #44
0
        public async Task <Result <Order> > CreateOrder(User user, string paymentMethod, decimal paymentFeeAmount, string shippingMethodName, Address billingAddress, Address shippingAddress, OrderStatus orderStatus = OrderStatus.New)
        {
            var cart = _cartRepository
                       .Query()
                       .Include(c => c.Items).ThenInclude(x => x.Product)
                       .Where(x => x.UserId == user.Id && x.IsActive).FirstOrDefault();

            if (cart == null)
            {
                return(Result.Fail <Order>($"Cart of user {user.Id} cannot be found"));
            }

            var checkingDiscountResult = await CheckForDiscountIfAny(user, cart);

            if (!checkingDiscountResult.Succeeded)
            {
                return(Result.Fail <Order>(checkingDiscountResult.ErrorMessage));
            }

            var validateShippingMethodResult = await ValidateShippingMethod(shippingMethodName, shippingAddress, cart);

            if (!validateShippingMethodResult.Success)
            {
                return(Result.Fail <Order>(validateShippingMethodResult.Error));
            }

            var shippingMethod = validateShippingMethodResult.Value;

            var orderBillingAddress = new OrderAddress()
            {
                AddressLine1      = billingAddress.AddressLine1,
                AddressLine2      = billingAddress.AddressLine2,
                ContactName       = billingAddress.ContactName,
                CountryId         = billingAddress.CountryId,
                StateOrProvinceId = billingAddress.StateOrProvinceId,
                DistrictId        = billingAddress.DistrictId,
                City    = billingAddress.City,
                ZipCode = billingAddress.ZipCode,
                Phone   = billingAddress.Phone
            };

            var orderShippingAddress = new OrderAddress()
            {
                AddressLine1      = shippingAddress.AddressLine1,
                AddressLine2      = shippingAddress.AddressLine2,
                ContactName       = shippingAddress.ContactName,
                CountryId         = shippingAddress.CountryId,
                StateOrProvinceId = shippingAddress.StateOrProvinceId,
                DistrictId        = shippingAddress.DistrictId,
                City    = shippingAddress.City,
                ZipCode = shippingAddress.ZipCode,
                Phone   = shippingAddress.Phone
            };

            var order = new Order
            {
                CreatedOn        = DateTimeOffset.Now,
                CreatedById      = user.Id,
                BillingAddress   = orderBillingAddress,
                ShippingAddress  = orderShippingAddress,
                PaymentMethod    = paymentMethod,
                PaymentFeeAmount = paymentFeeAmount
            };

            foreach (var cartItem in cart.Items)
            {
                if (cartItem.Product.StockTrackingIsEnabled && cartItem.Product.StockQuantity < cartItem.Quantity)
                {
                    return(Result.Fail <Order>($"There are only {cartItem.Product.StockQuantity} items available for {cartItem.Product.Name}"));
                }

                var taxPercent = await _taxService.GetTaxPercent(cartItem.Product.TaxClassId, shippingAddress.CountryId, shippingAddress.StateOrProvinceId, shippingAddress.ZipCode);

                var productPrice = cartItem.Product.Price;
                if (cart.IsProductPriceIncludeTax)
                {
                    productPrice = productPrice / (1 + (taxPercent / 100));
                }

                var orderItem = new OrderItem
                {
                    Product      = cartItem.Product,
                    ProductPrice = productPrice,
                    Quantity     = cartItem.Quantity,
                    TaxPercent   = taxPercent,
                    TaxAmount    = cartItem.Quantity * (productPrice * taxPercent / 100)
                };

                var discountedItem = checkingDiscountResult.DiscountedProducts.FirstOrDefault(x => x.Id == cartItem.ProductId);
                if (discountedItem != null)
                {
                    orderItem.DiscountAmount = discountedItem.DiscountAmount;
                }

                order.AddOrderItem(orderItem);
                if (cartItem.Product.StockTrackingIsEnabled)
                {
                    cartItem.Product.StockQuantity = cartItem.Product.StockQuantity - cartItem.Quantity;
                }
            }

            order.OrderStatus          = orderStatus;
            order.OrderNote            = cart.OrderNote;
            order.CouponCode           = checkingDiscountResult.CouponCode;
            order.CouponRuleName       = cart.CouponRuleName;
            order.DiscountAmount       = checkingDiscountResult.DiscountAmount;
            order.ShippingFeeAmount    = shippingMethod.Price;
            order.ShippingMethod       = shippingMethod.Name;
            order.TaxAmount            = order.OrderItems.Sum(x => x.TaxAmount);
            order.SubTotal             = order.OrderItems.Sum(x => x.ProductPrice * x.Quantity);
            order.SubTotalWithDiscount = order.SubTotal - checkingDiscountResult.DiscountAmount;
            order.OrderTotal           = order.SubTotal + order.TaxAmount + order.ShippingFeeAmount + order.PaymentFeeAmount - order.DiscountAmount;
            _orderRepository.Add(order);

            cart.IsActive = false;

            var vendorIds = cart.Items.Where(x => x.Product.VendorId.HasValue).Select(x => x.Product.VendorId.Value).Distinct();

            if (vendorIds.Any())
            {
                order.IsMasterOrder = true;
            }

            foreach (var vendorId in vendorIds)
            {
                var subOrder = new Order
                {
                    CreatedOn       = DateTimeOffset.Now,
                    CreatedById     = user.Id,
                    BillingAddress  = orderBillingAddress,
                    ShippingAddress = orderShippingAddress,
                    VendorId        = vendorId,
                    Parent          = order
                };

                foreach (var cartItem in cart.Items.Where(x => x.Product.VendorId == vendorId))
                {
                    var taxPercent = await _taxService.GetTaxPercent(cartItem.Product.TaxClassId, shippingAddress.CountryId, shippingAddress.StateOrProvinceId, shippingAddress.ZipCode);

                    var productPrice = cartItem.Product.Price;
                    if (cart.IsProductPriceIncludeTax)
                    {
                        productPrice = productPrice / (1 + (taxPercent / 100));
                    }

                    var orderItem = new OrderItem
                    {
                        Product      = cartItem.Product,
                        ProductPrice = productPrice,
                        Quantity     = cartItem.Quantity,
                        TaxPercent   = taxPercent,
                        TaxAmount    = cartItem.Quantity * (productPrice * taxPercent / 100)
                    };

                    if (cart.IsProductPriceIncludeTax)
                    {
                        orderItem.ProductPrice = orderItem.ProductPrice - orderItem.TaxAmount;
                    }

                    subOrder.AddOrderItem(orderItem);
                }

                subOrder.SubTotal   = subOrder.OrderItems.Sum(x => x.ProductPrice * x.Quantity);
                subOrder.TaxAmount  = subOrder.OrderItems.Sum(x => x.TaxAmount);
                subOrder.OrderTotal = subOrder.SubTotal + subOrder.TaxAmount + subOrder.ShippingFeeAmount - subOrder.DiscountAmount;
                _orderRepository.Add(subOrder);
            }

            using (var transaction = _orderRepository.BeginTransaction())
            {
                _orderRepository.SaveChanges();
                _couponService.AddCouponUsage(user.Id, order.Id, checkingDiscountResult);
                _orderRepository.SaveChanges();
                transaction.Commit();
            }

            // await _orderEmailService.SendEmailToUser(user, order);
            return(Result.Ok(order));
        }
Пример #45
0
 /// <summary>
 /// 获取订单状态
 /// </summary>
 /// <param name="status">系统状态</param>
 /// <param name="role">订单角色</param>
 public static string GetOrderStatus(OrderStatus status, OrderRole role)
 {
     return(OrderStatusAdapter.Instance.GetStatus(status, role));
 }
Пример #46
0
        public async Task <Result <Order> > CreateOrder(User user, string paymentMethod, decimal paymentFeeAmount, OrderStatus orderStatus = OrderStatus.New)
        {
            var cart = await _cartRepository
                       .Query()
                       .Where(x => x.UserId == user.Id && x.IsActive).FirstOrDefaultAsync();

            if (cart == null)
            {
                return(Result.Fail <Order>($"Cart of user {user.Id} cannot be found"));
            }

            var     shippingData = JsonConvert.DeserializeObject <DeliveryInformationVm>(cart.ShippingData);
            Address billingAddress;
            Address shippingAddress;

            if (shippingData.ShippingAddressId == 0)
            {
                var address = new Address
                {
                    AddressLine1      = shippingData.NewAddressForm.AddressLine1,
                    AddressLine2      = shippingData.NewAddressForm.AddressLine2,
                    ContactName       = shippingData.NewAddressForm.ContactName,
                    CountryId         = shippingData.NewAddressForm.CountryId,
                    StateOrProvinceId = shippingData.NewAddressForm.StateOrProvinceId,
                    DistrictId        = shippingData.NewAddressForm.DistrictId,
                    City    = shippingData.NewAddressForm.City,
                    ZipCode = shippingData.NewAddressForm.ZipCode,
                    Phone   = shippingData.NewAddressForm.Phone
                };

                var userAddress = new UserAddress
                {
                    Address     = address,
                    AddressType = AddressType.Shipping,
                    UserId      = user.Id
                };

                _userAddressRepository.Add(userAddress);

                billingAddress = shippingAddress = address;
            }
            else
            {
                billingAddress = shippingAddress = _userAddressRepository.Query().Where(x => x.Id == shippingData.ShippingAddressId).Select(x => x.Address).First();
            }

            return(await CreateOrder(user, paymentMethod, paymentFeeAmount, shippingData.ShippingMethod, billingAddress, shippingAddress, orderStatus));
        }
Пример #47
0
        void EWrapper.orderStatus(int orderId, string status, double filled, double remaining, double avgFillPrice, int permId, int parentId, double lastFillPrice, int clientId, string whyHeld)
        {
            ShowDebugMessage(orderId, status, filled, remaining, avgFillPrice, permId, parentId, lastFillPrice, clientId, whyHeld);

            OrderStatus?.Invoke(orderId, status, filled, remaining, avgFillPrice, permId, parentId, lastFillPrice, clientId, whyHeld);
        }
Пример #48
0
        private void OnTransactionReply(uint transactionId, Codes replyCode, Codes extendedCode, OrderStatus status, long orderId, string message)
        {
            this.AddDebugLog("Order: transId {0} replyCode {1} extendedCode {2} status {3} orderId {4} message {5}", transactionId, replyCode, extendedCode, status, orderId, message);

            if (!IsAsyncMode)
            {
                return;
            }

            try
            {
                var builder = _transactions.TryGetValue(transactionId);

                if (builder == null)
                {
                    throw new InvalidOperationException(LocalizedStrings.Str1839Params.Put(transactionId));
                }

                if (builder.TransactionType == TransactionTypes.CancelGroup)
                {
                    if (replyCode != Codes.Success || status != OrderStatus.Accepted)
                    {
                        SendOutError(new ApiException(replyCode, message));
                    }

                    return;
                }

                if (builder.TransactionType == TransactionTypes.Register && extendedCode == Codes.Success && orderId == 0)
                {
                    extendedCode = Codes.Failed;
                }

                var isCancelFailed = builder.TransactionType == TransactionTypes.Cancel && status != OrderStatus.Accepted;

                if (isCancelFailed)
                {
                    extendedCode = Codes.Failed;
                }

                ApiException exception = null;

                if (extendedCode != Codes.Success)
                {
                    exception = new ApiException(extendedCode, message);
                }

                var orderMessage = builder.Message.ToExecutionMessage();

                orderMessage.SystemComment = message;

                if (!isCancelFailed)
                {
                    orderMessage.OrderStatus = status;
                }

                ProcessTransactionReply(orderMessage, builder, orderId, message, replyCode, exception);
            }
            catch (Exception ex)
            {
                SendOutError(ex);
            }
        }
Пример #49
0
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
     {
         Repeater  repeater  = (Repeater)e.Item.FindControl("rptSubList");
         OrderInfo orderInfo = OrderHelper.GetOrderInfo(DataBinder.Eval(e.Item.DataItem, "OrderID").ToString());
         if ((orderInfo != null) && (orderInfo.LineItems.Count > 0))
         {
             repeater.DataSource = orderInfo.LineItems.Values;
             repeater.DataBind();
         }
         OrderStatus status = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
         string      str    = "";
         if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
         {
             str = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
         }
         int             num              = (DataBinder.Eval(e.Item.DataItem, "GroupBuyId") != DBNull.Value) ? ((int)DataBinder.Eval(e.Item.DataItem, "GroupBuyId")) : 0;
         HtmlInputButton button           = (HtmlInputButton)e.Item.FindControl("btnModifyPrice");
         HtmlInputButton button2          = (HtmlInputButton)e.Item.FindControl("btnSendGoods");
         Button          button3          = (Button)e.Item.FindControl("btnPayOrder");
         Button          button4          = (Button)e.Item.FindControl("btnConfirmOrder");
         HtmlInputButton button5          = (HtmlInputButton)e.Item.FindControl("btnCloseOrderClient");
         HtmlAnchor      anchor1          = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
         HtmlAnchor      anchor2          = (HtmlAnchor)e.Item.FindControl("lkbtnCheckReturn");
         HtmlAnchor      anchor3          = (HtmlAnchor)e.Item.FindControl("lkbtnCheckReplace");
         Literal         literal          = (Literal)e.Item.FindControl("WeiXinNickName");
         Literal         literal2         = (Literal)e.Item.FindControl("litOtherInfo");
         int             totalPointNumber = orderInfo.GetTotalPointNumber();
         MemberInfo      member           = MemberProcessor.GetMember(orderInfo.UserId, true);
         if (member != null)
         {
             literal.Text = "买家:" + member.UserName;
         }
         StringBuilder builder = new StringBuilder();
         decimal       total   = orderInfo.GetTotal();
         if (total > 0M)
         {
             builder.Append("<strong>¥" + total.ToString("F2") + "</strong>");
             builder.Append("<small>(含运费¥" + orderInfo.AdjustedFreight.ToString("F2") + ")</small>");
         }
         if (totalPointNumber > 0)
         {
             builder.Append("<small>" + totalPointNumber.ToString() + "积分</small>");
         }
         if (orderInfo.PaymentType == "货到付款")
         {
             builder.Append("<span class=\"setColor bl\"><strong>货到付款</strong></span>");
         }
         if (string.IsNullOrEmpty(builder.ToString()))
         {
             builder.Append("<strong>¥" + total.ToString("F2") + "</strong>");
         }
         literal2.Text = builder.ToString();
         if (status == OrderStatus.WaitBuyerPay)
         {
             button.Visible = true;
             button.Attributes.Add("onclick", "DialogFrame('../trade/EditOrder.aspx?OrderId=" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'修改订单价格',900,450)");
             button5.Attributes.Add("onclick", "CloseOrderFun('" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "')");
             button5.Visible = true;
             if (str != "hishop.plugins.payment.podrequest")
             {
                 button3.Visible = true;
             }
         }
         if (num > 0)
         {
             GroupBuyStatus status2 = (GroupBuyStatus)DataBinder.Eval(e.Item.DataItem, "GroupBuyStatus");
             button2.Visible = (status == OrderStatus.BuyerAlreadyPaid) && (status2 == GroupBuyStatus.Success);
         }
         else
         {
             button2.Visible = (status == OrderStatus.BuyerAlreadyPaid) || ((status == OrderStatus.WaitBuyerPay) && (str == "hishop.plugins.payment.podrequest"));
         }
         button2.Attributes.Add("onclick", "DialogFrame('../trade/SendOrderGoods.aspx?OrderId=" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'订单发货',750,220)");
         button4.Visible = status == OrderStatus.SellerAlreadySent;
     }
 }
Пример #50
0
 static HElement ViewStatus(OrderStatus status)
 {
     return(h.Span(h.style("color:darkgray;font-size:85%;"), string.Format(" ({0}) ", DisplayStatus(status))));
 }
Пример #51
0
 public async Task <IEnumerable <UserOrderList> > GetUserOrderListByStatus(int userId, OrderStatus status)
 {
     return(await _context.UserOrderLists.Include("Items.Product")
            .Where(u => u.UserId == userId)
            .Where(u => u.Status == status)
            .Where(u => !u.SoftDeleted)
            .ToListAsync());
 }
Пример #52
0
        public static MvcHtmlString OrderStatusLabel(this HtmlHelper html, OrderStatus orderStatus)
        {
            var labelHelper = new BootstrapLabelHelper(LabelClassDictionary);

            return(labelHelper.BootstrapLabel(html, orderStatus.Name, orderStatus.Name));
        }
Пример #53
0
 public Order(OrderIdentity id, CustomerIdentity customerId, DateTime orderDate, OrderStatus status, IEnumerable <OrderItem> orderDetails)
     : base(id)
 {
     CustomerId = customerId;
     OrderDate  = orderDate;
     Status     = status;
     OrderItems = orderDetails.ToList().AsReadOnly();
 }
Пример #54
0
 public Order(OrderStatus status, Client cliente)
 {
     this.Moment  = DateTime.Now;
     this.Status  = status;
     this.cliente = cliente;
 }
Пример #55
0
 public Orders(int orderID, string orderName, Customers customer, DateTime orderDate, OrderStatus orderStatus, string comments, Services orderService, Addresses shipFrom, Addresses shipTo, float totalPrice, float addTime, string container, float deliveryDuration, DriverLicenseTypes orderLicenseType, DriverLicenseTypes orderCertificationType)
 {
     OrderID                = orderID;
     OrderName              = orderName;
     Customer               = customer;
     OrderDate              = orderDate;
     OrderStatus            = orderStatus;
     Comments               = comments;
     OrderService           = orderService;
     ShipFrom               = shipFrom;
     ShipTo                 = shipTo;
     TotalPrice             = totalPrice;
     AddTime                = addTime;
     Container              = container;
     OrderLicenseType       = orderLicenseType;
     OrderCertificationType = orderCertificationType;
     DeliveryDuration       = deliveryDuration;
 }
Пример #56
0
        public IPurchaseOrder SetOrderPaid(long orderId, long?paymentId)
        {
            var order = m_orderRepository.GetOrder(orderId);

            if (order == null)
            {
                throw new InvalidOperationException("Order not found");
            }

            if (paymentId != null)
            {
                var payment = m_paymentRepository.GetPayment(paymentId.Value);
                if (payment == null)
                {
                    throw new InvalidOperationException("Platba neexistuje");
                }

                var ordersList = payment.Orders?.ToList() ?? new List <IPurchaseOrder>(0);
                if ((ordersList.SingleOrDefault()?.Id ?? orderId) != orderId)
                {
                    throw new InvalidOperationException("Platba uz je prirazena k jine objednavce");
                }
            }

            using (var tx = m_database.OpenTransaction())
            {
                m_log.Info("Starting transaction for payment pairing orderId={orderId}, paymentId={paymentId}");
                if (order.ErpId != null)
                {
                    order.PaymentId            = paymentId;
                    order.PaymentPairingUserId = m_session.User.Id;
                    order.PaymentPairingDt     = DateTime.Now;
                    m_database.Save(order);

                    m_log.Info($"Order saved to the database in transaction; paymentId={order.PaymentId}, pairngUserId={order.PaymentPairingUserId}, pairingDt={order.PaymentPairingDt}");
                }
                else
                {
                    m_log.Error("Order.ErpId == null");
                }

                if (order.OrderStatusId == OrderStatus.PendingPayment.Id)
                {
                    order = PerformErpActionSafe(order, (e, ord) => e.MarkOrderPaid(ord),
                                                 synced =>
                    {
                        if (!OrderStatus.IsPaid(synced.OrderStatusId))
                        {
                            throw new InvalidOperationException(
                                $" Byl odeslan pozadavek na nastaveni platby objednavky, ale objednavka ma stale stav '{synced.ErpStatusId} - {synced.ErpStatusName}', ktery Elsa mapuje na stav '{synced.OrderStatus?.Name}'");
                        }
                    }, "SetOrderPaid");
                }
                else
                {
                    m_log.Info($"Order sync skipped - statusId={order.OrderStatusId}");
                }

                tx.Commit();
                m_log.Info("Transaction commited");
            }

            return(order);
        }
Пример #57
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (OrderId.Length != 0)
            {
                hash ^= OrderId.GetHashCode();
            }
            if (ClinetOrderId.Length != 0)
            {
                hash ^= ClinetOrderId.GetHashCode();
            }
            if (ClinetOrderLinkId.Length != 0)
            {
                hash ^= ClinetOrderLinkId.GetHashCode();
            }
            if (Side != 0)
            {
                hash ^= Side.GetHashCode();
            }
            if (SimpleOrderQuantity != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SimpleOrderQuantity);
            }
            if (OrderQuantity != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(OrderQuantity);
            }
            if (Price != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Price);
            }
            if (DisplayQuantity != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(DisplayQuantity);
            }
            if (StopPrice != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(StopPrice);
            }
            if (PegOffsetValue != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(PegOffsetValue);
            }
            if (PegPriceType.Length != 0)
            {
                hash ^= PegPriceType.GetHashCode();
            }
            if (OrderType != 0)
            {
                hash ^= OrderType.GetHashCode();
            }
            if (TimeInForce != 0)
            {
                hash ^= TimeInForce.GetHashCode();
            }
            if (ExecutionInstruction.Length != 0)
            {
                hash ^= ExecutionInstruction.GetHashCode();
            }
            if (OrderStatus != 0)
            {
                hash ^= OrderStatus.GetHashCode();
            }
            if (SimpleLeavesQuantity != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SimpleLeavesQuantity);
            }
            if (LeavesQuantity != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LeavesQuantity);
            }
            if (AveragePrice != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(AveragePrice);
            }
            if (Text.Length != 0)
            {
                hash ^= Text.GetHashCode();
            }
            if (transactTime_ != null)
            {
                hash ^= TransactTime.GetHashCode();
            }
            if (timestamp_ != null)
            {
                hash ^= Timestamp.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #58
0
        public static void SeedInMemory(this OnlineStoreDbContext dbContext)
        {
            var creationUser     = "******";
            var creationDateTime = DateTime.Now;

            var country = new Country
            {
                CountryID        = 1,
                CountryName      = "USA",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Countries.Add(country);

            var currency = new Currency
            {
                CurrencyID       = "USD",
                CurrencyName     = "US Dollar",
                CurrencySymbol   = "$",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Currencies.Add(currency);

            var countryCurrency = new CountryCurrency
            {
                CountryID        = country.CountryID,
                CurrencyID       = currency.CurrencyID,
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.CountryCurrencies.Add(countryCurrency);

            dbContext.SaveChanges();

            var employee = new Employee
            {
                EmployeeID       = 1,
                FirstName        = "John",
                LastName         = "Doe",
                BirthDate        = DateTime.Now.AddYears(-25),
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Employees.Add(employee);

            dbContext.SaveChanges();

            var productCategory = new ProductCategory
            {
                ProductCategoryID   = 1,
                ProductCategoryName = "PS4 Games",
                CreationUser        = creationUser,
                CreationDateTime    = creationDateTime
            };

            dbContext.ProductCategories.Add(productCategory);

            var product = new Product
            {
                ProductID         = 1,
                ProductName       = "The King of Fighters XIV",
                ProductCategoryID = 1,
                UnitPrice         = 29.99m,
                Description       = "KOF XIV",
                Discontinued      = false,
                Stocks            = 15000,
                CreationUser      = creationUser,
                CreationDateTime  = creationDateTime
            };

            dbContext.Products.Add(product);

            var location = new Location
            {
                LocationID       = "W0001",
                LocationName     = "Warehouse 001",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Warehouses.Add(location);

            var productInventory = new ProductInventory
            {
                ProductID        = product.ProductID,
                LocationID       = location.LocationID,
                OrderDetailID    = 1,
                Quantity         = 1500,
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.ProductInventories.Add(productInventory);

            dbContext.SaveChanges();

            var orderStatus = new OrderStatus
            {
                OrderStatusID    = 100,
                Description      = "Created",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.OrderStatuses.Add(orderStatus);

            var paymentMethod = new PaymentMethod
            {
                PaymentMethodID          = Guid.NewGuid(),
                PaymentMethodDescription = "Credit Card",
                CreationUser             = creationUser,
                CreationDateTime         = creationDateTime
            };

            dbContext.PaymentMethods.Add(paymentMethod);

            var customer = new Customer
            {
                CustomerID       = 1,
                CompanyName      = "Best Buy",
                ContactName      = "Colleen Dunn",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Customers.Add(customer);

            var shipper = new Shipper
            {
                ShipperID        = 1,
                CompanyName      = "DHL",
                ContactName      = "Ricardo A. Bartra",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Shippers.Add(shipper);

            var order = new OrderHeader
            {
                OrderStatusID    = orderStatus.OrderStatusID,
                CustomerID       = customer.CustomerID,
                EmployeeID       = employee.EmployeeID,
                OrderDate        = DateTime.Now,
                Total            = 29.99m,
                CurrencyID       = "USD",
                PaymentMethodID  = paymentMethod.PaymentMethodID,
                Comments         = "Order from unit tests",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Orders.Add(order);

            var orderDetail = new OrderDetail
            {
                OrderHeaderID    = order.OrderHeaderID,
                ProductID        = product.ProductID,
                ProductName      = product.ProductName,
                UnitPrice        = 29.99m,
                Quantity         = 1,
                Total            = 29.99m,
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.OrderDetails.Add(orderDetail);

            dbContext.SaveChanges();
        }
Пример #59
0
        public static string GetOrderStatusName(this OrderStatus orderStatus)
        {
            var result = Enum.GetName(typeof(OrderStatus), orderStatus);

            return(Regex.Replace(result, "[A-Z]", " $0").Trim());
        }
Пример #60
-1
 public Order(int id, string customerid, int employeeid, DateTime orderdate, DateTime requireddate, 
     DateTime shippeddate, int shipvia, double freight, string shipname, string shipaddress, string shipcity, 
     string shiparegion, string shippostalcode, string shipcountry, List<OrderDetails> details)
 {
     ID = id;
     CustomerID = customerid;
     EmployeeID = employeeid;
     OrderDate = orderdate;
     RequiredDate = requireddate;
     ShippedDate = shippeddate;
     ShipVia = shipvia;
     Freight = freight;
     ShipName = shipname;
     ShipAddress = shipaddress;
     ShipCity = shipcity;
     ShipRegion = shiparegion;
     ShipPostalCode = shippostalcode;
     ShipCountry = shipcountry;
     Details = details;
     if (orderdate.Equals(DateTime.MinValue))
         Status = OrderStatus.NEW;
     else if (ShippedDate.Equals(DateTime.MinValue))
         Status = OrderStatus.NOTSHIPPED;
     else
         Status = OrderStatus.SHIPPED;
 }