public async Task UpdateStatusAsync(OrderItem orderItemEntity, OrderItemStatus newStatus) { if (orderItemEntity is null) { throw new ArgumentNullException(nameof(orderItemEntity)); } try { var orderItem = await _ordersContext.OrderItems.FindAsync(orderItemEntity.Id); if (orderItem == null) { throw new Exception("No order item with the specified Id exists."); } orderItem.Status = newStatus; _ordersContext.OrderItems.Update(orderItem); await _ordersContext.SaveChangesAsync(); } catch (Exception ex) { throw new Exception($"Order item status could not be updated. Reason: {ex.Message}", ex); } }
public async Task UpdateStatusAsync(OrderItem orderItemEntity, OrderItemStatus newStatus) { if (orderItemEntity is null) { throw new ArgumentNullException(nameof(orderItemEntity)); } try { var orderItem = await _ordersContext.OrderItems .SingleOrDefaultAsync(x => x.Id == orderItemEntity.Id); if (orderItem == null) { throw new Exception("Order item could not be found!"); } orderItem.Status = newStatus; _ordersContext.OrderItems.Update(orderItem); await _ordersContext.SaveChangesAsync(); } catch (Exception ex) { throw new Exception($"Order item status could not be updated. Reason:{ex.Message}"); } }
public OrderDetail CreateNewOrderDetailforCanellationItem(decimal cancellationFee, long orderId, long forOrganizationRoleUserId, long dataRecorderCreatorId) { DataRecorderMetaData dataRecorderMetaData = _dataRecorderMetaDataFactory. CreateDataRecorderMetaData(dataRecorderCreatorId); OrderItemStatus orderItemStatus = _orderItemStatusFactory.CreateOrderItemStatus(OrderItemType.CancellationFee, (int)OrderStatusState.FinalSuccess); // orFinalFailure return(new OrderDetail { Description = "Cancellation fee charged", Price = cancellationFee, Quantity = 1, DataRecorderMetaData = dataRecorderMetaData, ForOrganizationRoleUserId = forOrganizationRoleUserId, OrderItemStatus = orderItemStatus, OrderId = orderId, OrderItemId = 0, // Need a new Order Item SourceCodeOrderDetail = null, EventCustomerOrderDetail = null, ShippingDetailOrderDetails = null, DetailType = OrderItemType.CancellationFee }); }
public OrderItemType GetOrderItemType(OrderItemStatus orderItemStatus) { Type type = orderItemStatus.GetType(); if (type == typeof(GiftCertificateItemStatus)) { return(OrderItemType.GiftCertificateItem); } if (type == typeof(EventPackageItemStatus)) { return(OrderItemType.EventPackageItem); } if (type == typeof(ProductItemStatus)) { return(OrderItemType.ProductItem); } if (type == typeof(RefundItemStatus)) { return(OrderItemType.RefundItem); } if (type == typeof(EventTestItemStatus)) { return(OrderItemType.EventTestItem); } if (type == typeof(CancellationFeeItemStatus)) { return(OrderItemType.CancellationFee); } throw new NotSupportedException ("The given type of OrderItemStatus does not have a corresponding OrderItemType."); }
/// <summary> /// Helper to convert enum to a valid string sent/received in from the API /// <returns>String</returns> /// </summary> public static String OrderItemStatusToString(OrderItemStatus value) { switch (value) { case OrderItemStatus.Pending: return("0"); case OrderItemStatus.Processing: return("100"); case OrderItemStatus.Shipped: return("200"); case OrderItemStatus.PartiallyShipped: return("201"); case OrderItemStatus.GiftCertNotRedeemed: return("210"); case OrderItemStatus.GiftCertRedeemed: return("211"); case OrderItemStatus.DigitalNotDownloaded: return("220"); case OrderItemStatus.DigitalDownloaded: return("221"); case OrderItemStatus.Cancelled: return("300"); case OrderItemStatus.Backordered: return("400"); case OrderItemStatus.RmaIssued: return("500"); case OrderItemStatus.Returned: return("600"); } return(""); }
private static bool AllOrderItemsProcessed(Order order) { int processedOrderItems = 0; foreach (OrderItem orderItem in order.OrderItemList) { OrderItemStatus ois = EnumUtils.GetEnumFromValue <OrderItemStatus>(orderItem.OrderItemStatusId); switch (ois) { case (OrderItemStatus.Preapproved): case (OrderItemStatus.Approved): case (OrderItemStatus.Rejected): processedOrderItems++; break; case (OrderItemStatus.AwaitingApproval): // Do nothing break; } } // Complete the order if all items have been processed return(processedOrderItems == order.OrderItemList.Count); }
public int UpdateStatus(OrderItemStatus status) { return(ExecuteFaultHandledOperation(() => { int order_status_key = _order_status_repo.Save(_order_item_status_es.Map(status)); return order_status_key; })); }
public OrderItem(OrderItemIdentity id, ProductIdentity productId, decimal unitPrice, int quantity, OrderItemStatus status) : base(id) { ProductId = productId; UnitPrice = unitPrice; Quantity = quantity; Status = status; }
public OrderItem(int orderId, string description, int productId, double count, decimal price, OrderItemStatus orderItemStatus) { OrderId = orderId; Description = description; ProductId = productId; Count = count; Price = price; OrderItemStatus = orderItemStatus; }
public void CreateOrderItemStatusSetsStatusToCorrectRefundItemStatus() { OrderItemStatus expectedRefundItemStatus = RefundItemStatus.NotApplied; OrderItemStatus orderItemStatus = _orderItemStatusFactory.CreateOrderItemStatus (OrderItemType.RefundItem, RefundItemStatus.NotApplied.StatusCode); Assert.AreEqual(expectedRefundItemStatus, orderItemStatus, "OrderItemStatus was set incorrectly."); }
public bool DeleteStatus(OrderItemStatus status) { return(ExecuteFaultHandledOperation(() => { var order_status_data = _order_item_status_es.Map(status); _order_status_repo.Delete(order_status_data); return true; })); }
private IList <OrderItemStatus> GetLineItemStatuses(int orderId) { var lineItems = new List <OrderItemStatus>(); using (var cmd = new SqlCommand("usp_GetLineItemStatuses", cn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@OrderId", SqlDbType.Int) { Value = orderId }); var reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { var lineItem = new OrderItemStatus { OrderlineItemId = reader.GetString(OrderLineItemIdOrdinal), ProductIdentifier = reader.GetString(ProductIdentifierOrdinal), QtyOrdered = reader.GetInt32(QtyOrderedOrdinal), QtyShipped = reader.GetInt32(QtyShippedOrdinal), QtyCancelled = reader.GetInt32(QtyCancelledOrdinal), QtyBackordered = reader.GetInt32(QtyBackorderedOrdinal), TrackingInformation = new List <ItemTracking>() }; var tracking = new ItemTracking(); if (!reader.IsDBNull(CarrierOrdinal)) { tracking.Carrier = reader.GetString(CarrierOrdinal); } if (!reader.IsDBNull(ShipDateOrdinal)) { tracking.ShipDate = reader.GetDateTime(ShipDateOrdinal); } if (!reader.IsDBNull(TrackingNumberOrdinal)) { tracking.TrackingNumber = reader.GetString(TrackingNumberOrdinal); } if (!reader.IsDBNull(TrackingUrlOrdinal)) { tracking.TrackingUrl = reader.GetString(TrackingUrlOrdinal); } lineItem.TrackingInformation.Add(tracking); lineItems.Add(lineItem); } } else { // TODO: Throw exception indicating no line items were returned. } } return(lineItems); }
async Task <int> GetOrderItemCount(Guid orderId, OrderItemStatus status) { var result = await _client.GetIncludedOrderItemCount( new() { OrderId = orderId, Status = status }); return(result.Value); }
public OrderStatusData Map(OrderItemStatus order_status) { return(new OrderStatusData() { OrderStatusKey = order_status.OrderItemStatusKey, OrderStatusType = order_status.OrderItemStatusType, OrderStatusCode = order_status.OrderItemStatusCode, OrderStatusName = order_status.OrderItemStatusName, OrderStatusDesc = order_status.OrderItemStatusDesc }); }
public ActionResult OrderConfirm(int ID) { if (CurrentShop == null) { return(Json(new { result = "error", message = RP.S("Member.Error.ShopNotFound") })); } var order = _db.Orders.FirstOrDefault(x => x.ID == ID && x.ShopID == CurrentShop.ID); if (order == null) { return(Json(new { result = "error", message = RP.S("Member.Error.OrderNotFound") })); } if (order.OrderStatus != OrderStatus.New && order.OrderStatus != OrderStatus.Paid) { return(Json(new { result = "error", message = RP.S("Member.Error.OrderAlreadyProcessed") })); } //check if member accept all items OrderItemStatus acceptedItemStatus = OrderItemStatus.Accepted; OrderItemStatus changedItemStatus = OrderItemStatus.Changed; var any = _db.OrderItems.Any(x => x.OrderID == order.ID && x.OrderItemStatus != acceptedItemStatus && x.OrderItemStatus != changedItemStatus); if (any) //member missing some products { return(Json(new { result = "error", message = RP.S("Member.Error.YouMustAcceptAllItemsFirst") })); } if (order.PaymentMethod == PaymentMethod.Credit) { if (order.OrderStatus == OrderStatus.Paid) { order.OrderStatus = OrderStatus.Accepted; _db.SaveChanges(); } else { //run paid procedure order.PayedOn = DateTime.Now; // order.OrderStatus = OrderStatus.Accepted; _db.SaveChanges(); //and accept // return Json(new { result = "error", message = "Oreder not paid, yet" }); } } else { order.OrderStatus = OrderStatus.Accepted; //ShoppingService.AcceptedOrderStatus(); order.PayedOn = DateTime.Now; _db.SaveChanges(); } return(Json(new { result = "ok", message = RP.S("Member.OrderChanged.Confirmed") })); }
public void UpdateDeliverOrderItem(Int32 orderItemId, OrderItemStatus orderItemStatus) { if (orderItemId <= 0) { throw new ArgumentOutOfRangeException(nameof(orderItemId)); } if (!Enum.IsDefined(typeof(OrderItemStatus), orderItemStatus)) { throw new ArgumentOutOfRangeException(nameof(orderItemStatus), "Value should be defined in the OrderItemStatus enum."); } _cn.Execute("UPDATE OrderItem SET OrderItemStatus = ? WHERE Id = ?", orderItemStatus, orderItemId); }
public ActionResult OrderReject(int ID) { if (CurrentShop == null) { return(Json(new { result = "error", message = RP.S("Member.Error.ShopNotFound") })); } var order = _db.Orders.FirstOrDefault(x => x.ID == ID && x.ShopID == CurrentShop.ID); if (order == null) { return(Json(new { result = "error", message = RP.S("Member.Error.OrderNotFound") })); } if (order.OrderStatus != OrderStatus.New && order.OrderStatus != OrderStatus.Paid) { return(Json(new { result = "error", message = RP.S("Member.Error.OrderAlreadyProcessed") })); } order.OrderStatus = OrderStatus.Rejected; //ShoppingService.RejectedOrderStatus(); _db.SaveChanges(); // add to cart var items = _db.OrderItems.Where(x => x.OrderID == order.ID).ToList(); OrderItemStatus outItemStatus = OrderItemStatus.OutOfStock; foreach (var oi in items) { if (oi.OrderItemStatus != outItemStatus && oi.Quantity > 0) { ShoppingCartService.AddToCart(order.UserID, new ShoppingCartItem() { ProductAttributeOptionID = oi.ProductAttributeOptionID, ProductShopID = oi.ProductShopID, Quantity = oi.Quantity, ShopID = order.ShopID, }); } } //send email var messService = new MessageService(_db); var user = _db.Users.FirstOrDefault(x => x.ID == order.UserID); var shop = _db.Shops.FirstOrDefault(x => x.ID == order.ShopID); messService.OrderCanceledSmsToUser(order, user); messService.OrderCanceledEmailToUser(order, shop); return(Json(new { result = "ok", message = RP.S("Member.OrderChange.Rejected") })); }
public static bool ChangeOrderItemStatus(Guid orderItemId, OrderItemStatus status) { var result = false; try { var entities = new AycemEntities(); var orderItem = entities.OrderItem.FirstOrDefault(o => o.OrderItemId == orderItemId); if (orderItem != null) { orderItem.Status = status.ToInt(); result = entities.SaveChanges() > 0; } } catch (Exception) { throw; } return(result); }
protected override void MapDomainFields(OrderDetailEntity entity, OrderDetail domainObjectToMapTo) { NullArgumentChecker.CheckIfNull(entity.OrderItem, "entity.OrderItem", "The OrderItem associated with the given OrderDetail must be provided."); OrderItemStatus orderItemStatus = _orderItemStatusFactory.CreateOrderItemStatus ((OrderItemType)entity.OrderItem.Type, entity.Status); DataRecorderMetaData dataRecorderMetaData = _dataRecorderMetaDataFactory. CreateDataRecorderMetaData(entity.OrganizationRoleUserCreatorId, entity.DateCreated); domainObjectToMapTo.Id = entity.OrderDetailId; domainObjectToMapTo.OrderId = entity.OrderId; domainObjectToMapTo.OrderItemId = entity.OrderItemId; domainObjectToMapTo.ForOrganizationRoleUserId = entity.ForOrganizationRoleUserId; domainObjectToMapTo.Description = entity.Description; domainObjectToMapTo.Quantity = entity.Quantity; domainObjectToMapTo.Price = entity.Price; domainObjectToMapTo.DataRecorderMetaData = dataRecorderMetaData; domainObjectToMapTo.OrderItemStatus = orderItemStatus; domainObjectToMapTo.DetailType = (OrderItemType)entity.OrderItem.Type; domainObjectToMapTo.SourceId = entity.SourceId; }
public void MapSetsOrderItemStatusToResultOfItemStatusFactoryCall() { const int expectedOrderItemType = 1; const int expectedOrderDetailStatus = 5; OrderItemStatus expectedOrderItemStatus = FakeOrderItemStatus.StatusZero; OrderDetailEntity orderDetailEntity = GetValidOrderDetailEntity(); orderDetailEntity.OrderItem.Type = expectedOrderItemType; orderDetailEntity.Status = expectedOrderDetailStatus; Expect.Call(_mockedDataRecorderMetaDataFactory.CreateDataRecorderMetaData(0, new DateTime())). IgnoreArguments().Return(null); Expect.Call(_mockedOrderItemStatusFactory.CreateOrderItemStatus ((OrderItemType)orderDetailEntity.OrderItem.Type, orderDetailEntity.Status)). Return(expectedOrderItemStatus); _mocks.ReplayAll(); OrderDetail orderDetail = _mapper.Map(orderDetailEntity); _mocks.VerifyAll(); Assert.AreEqual(expectedOrderItemStatus, orderDetail.OrderItemStatus, "The OrderDetail's OrderItemStatus was not set correctly."); }
protected void listOrders_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus"); string text = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString(); OrderInfo orderInfo = TradeHelper.GetOrderInfo(text); if (orderInfo != null) { if (orderInfo.PreSaleId > 0) { Literal literal = (Literal)e.Item.FindControl("litPresale"); literal.Text = "(预售)"; literal.Visible = true; } OrderItemStatus itemStatus = orderInfo.ItemStatus; DateTime dateTime = (DataBinder.Eval(e.Item.DataItem, "FinishDate") == DBNull.Value) ? DateTime.Now.AddYears(-1) : ((DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate")); string text2 = ""; if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull)) { text2 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway"); } HyperLink hyperLink = (HyperLink)e.Item.FindControl("hplinkorderreview"); HtmlAnchor htmlAnchor = (HtmlAnchor)e.Item.FindControl("hlinkPay"); ImageLinkButton imageLinkButton = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder"); ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnCloseOrder"); HtmlAnchor htmlAnchor2 = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund"); HtmlAnchor htmlAnchor3 = (HtmlAnchor)e.Item.FindControl("lkbtnUserRealNameVerify"); HyperLink hyperLink2 = (HyperLink)e.Item.FindControl("hlinkOrderDetails"); Repeater repeater = (Repeater)e.Item.FindControl("rpProduct"); Repeater repeater2 = (Repeater)e.Item.FindControl("rpGift"); Label label = (Label)e.Item.FindControl("Logistics"); HtmlAnchor htmlAnchor4 = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage"); HtmlAnchor htmlAnchor5 = (HtmlAnchor)e.Item.FindControl("lkbtnRefundDetail"); htmlAnchor2.Attributes.Add("OrderId", text); htmlAnchor2.Attributes.Add("SkuId", ""); htmlAnchor2.Attributes.Add("GateWay", text2); OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus"); Literal literal2 = (Literal)e.Item.FindControl("lblGiftTitle"); orderStatusLabel.order = orderInfo; if (orderInfo.LineItems.Count <= 0) { Literal literal3 = literal2; literal3.Text += "(礼)"; } if (hyperLink != null) { if (orderInfo.GetGiftQuantity() > 0 && orderInfo.LineItems.Count() == 0) { hyperLink.Visible = false; } else { HyperLink hyperLink3 = hyperLink; int visible; switch (orderStatus) { case OrderStatus.Closed: visible = ((orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count) ? 1 : 0); break; default: visible = 0; break; case OrderStatus.Finished: visible = 1; break; } hyperLink3.Visible = ((byte)visible != 0); if (hyperLink.Visible) { DataTable productReviewAll = ProductBrowser.GetProductReviewAll(orderInfo.OrderId); 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++) { if (lineItemInfo.ProductId.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) { hyperLink.Text = "查看评论"; } else { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings != null) { if (masterSettings.ProductCommentPoint <= 0) { hyperLink.Text = "评价"; } else { hyperLink.Text = $"评价得{num3 * masterSettings.ProductCommentPoint}积分"; } } } } } } if (orderInfo.PreSaleId > 0) { FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("FormatedMoneyLabel2"); formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment; formatedMoneyLabel.Text = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2"); if (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3) { if (!orderInfo.DepositDate.HasValue) { htmlAnchor.Visible = true; } else if (orderInfo.DepositDate.HasValue) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && DateTime.Now <= productPreSaleInfo.PaymentEndDate) { htmlAnchor.Visible = true; } else { htmlAnchor.Visible = false; } } else { htmlAnchor.Visible = false; } } else { htmlAnchor.Visible = false; } } else { htmlAnchor.Visible = (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3); } imageLinkButton.Visible = (orderStatus == OrderStatus.SellerAlreadySent && itemStatus == OrderItemStatus.Nomarl); if (orderInfo.PreSaleId > 0) { imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl && !orderInfo.DepositDate.HasValue); } else { imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl); } RefundInfo refundInfo = TradeHelper.GetRefundInfo(text); htmlAnchor2.Visible = ((orderInfo.FightGroupId > 0 && VShopHelper.IsFightGroupCanRefund(orderInfo.FightGroupId) && orderInfo.IsCanRefund) || (orderInfo.FightGroupId <= 0 && orderInfo.IsCanRefund)); htmlAnchor3.Visible = (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods); if (htmlAnchor3.Visible) { htmlAnchor3.Attributes.Add("OrderId", text); } if (repeater != null && repeater2 != null) { repeater.ItemDataBound += this.listProduct_ItemDataBound; IList <NewLineItemInfo> list = new List <NewLineItemInfo>(); foreach (LineItemInfo value in orderInfo.LineItems.Values) { NewLineItemInfo newLineItemInfo = this.GetNewLineItemInfo(value, orderInfo.OrderId); list.Add(newLineItemInfo); } if (list == null || list.Count == 0) { repeater.Visible = false; DataTable dataTable = (DataTable)(repeater2.DataSource = TradeHelper.GetOrderGiftsThumbnailsUrl(((DataRowView)e.Item.DataItem).Row["OrderId"].ToString())); repeater2.DataBind(); repeater2.Visible = true; } else { repeater.DataSource = list; repeater.DataBind(); repeater2.Visible = false; repeater.Visible = true; } } if (refundInfo != null && orderInfo.ItemStatus == OrderItemStatus.Nomarl && (orderInfo.OrderStatus == OrderStatus.ApplyForRefund || orderInfo.OrderStatus == OrderStatus.RefundRefused || orderInfo.OrderStatus == OrderStatus.Closed)) { htmlAnchor5.HRef = "/user/UserRefundApplyDetails/" + refundInfo.RefundId; htmlAnchor5.Visible = true; } hyperLink2.NavigateUrl = "/user/OrderDetails/" + orderInfo.OrderId; if ((orderStatus == OrderStatus.SellerAlreadySent || orderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber) && orderInfo.ShippingModeId != -2) { label.Attributes.Add("action", "order"); label.Attributes.Add("orderId", text); label.Visible = true; } if (orderInfo.FightGroupId > 0) { FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId); htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid); } if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History) { WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); bool flag2 = false; if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime) { flag2 = true; } if (flag2) { Image image = (Image)e.Item.FindControl("imgRedEnvelope"); image.ImageUrl = "../../../../common/images/SendRedEnvelope.png"; image.Attributes.Add("class", "ztitle_RedEnvelope"); image.Attributes.Add("onclick", "GetRedEnvelope(" + orderInfo.OrderId + ")"); image.Visible = true; } } if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P")) { Label label2 = (Label)e.Item.FindControl("lblsupplier"); if (label2 != null) { string empty = string.Empty; if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName)) { label2.Text = orderInfo.StoreName; empty = "mtitle_1"; } else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0) { label2.Text = orderInfo.ShipperName; empty = "stitle_1"; } else { label2.Text = "平台"; empty = "ztitle_1_new"; } label2.Attributes.Add("style", string.IsNullOrWhiteSpace(label2.Text) ? "display:none" : "display:inline"); label2.Attributes.Add("class", empty); label2.Visible = true; } } } } }
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); } } } } }
public ActionResult OrderMissing(int ID) { if (CurrentShop == null) { return(Json(new { result = "error", message = RP.S("Member.Error.ShopNotFound") })); } var order = _db.Orders.FirstOrDefault(x => x.ID == ID && x.ShopID == CurrentShop.ID); if (order == null) { return(Json(new { result = "error", message = RP.S("Member.Error.OrderNotFound") })); } if (order.OrderStatus != OrderStatus.New && order.OrderStatus != OrderStatus.Paid) { return(Json(new { result = "error", message = RP.S("Member.Error.OrderAlreadyProcessed") })); } OrderItemStatus outItemStatus = OrderItemStatus.OutOfStock; OrderItemStatus changedItemStatus = OrderItemStatus.Changed; var any = _db.OrderItems.Any(x => x.OrderID == order.ID && (x.OrderItemStatus == outItemStatus || x.OrderItemStatus == changedItemStatus) ); if (!any) //check out of stock items { return(Json(new { result = "error", message = RP.S("Member.Error.YouDontHaveChangedProducts") })); } order.OrderStatus = OrderStatus.Rejected; //ShoppingService.RejectedOrderStatus();//canceled _db.SaveChanges(); // add to cart var items = _db.OrderItems.Where(x => x.OrderID == order.ID).ToList(); foreach (var oi in items) { if (oi.OrderItemStatus != outItemStatus && oi.Quantity > 0) { ShoppingCartService.AddToCart(order.UserID, new ShoppingCartItem() { ProductAttributeOptionID = oi.ProductAttributeOptionID, ProductShopID = oi.ProductShopID, Quantity = oi.Quantity, ShopID = order.ShopID, }); } } //send email var messService = new MessageService(_db); messService.SendOrderChangedEmailToUser(order, items .Where(x => x.OrderItemStatus == OrderItemStatus.Changed ).ToList(), items .Where(x => x.OrderItemStatus == OrderItemStatus.OutOfStock ).ToList() ); var user = _db.Users.FirstOrDefault(x => x.ID == order.UserID); messService.SendOrderChangedSmsToUser(order, user); // return(Json(new { result = "ok", message = RP.S("Member.OrderChanged.ProductsReturnedToClientOrderRejected") })); }
public OrderDetail CreateNewOrderDetail(IOrderable orderable, int quantity, long forOrganizationRoleUserId, long dataRecorderCreatorId, SourceCode sourceCode, EventCustomer eventCustomer, ShippingDetail shippingDetail, long?sourceId = null) { if (orderable == null) { throw new ArgumentNullException("orderable"); } if (orderable.Id == 0) { throw new InvalidOperationException("itemToOrder must already exist in the database."); } if (quantity < 1) { throw new ArgumentOutOfRangeException("quantity", "The quantity must be at least 1."); } DataRecorderMetaData dataRecorderMetaData = _dataRecorderMetaDataFactory. CreateDataRecorderMetaData(dataRecorderCreatorId); OrderItemStatus orderItemStatus = _orderItemStatusFactory.CreateOrderItemStatus(orderable. OrderItemType, (int)OrderStatusState.Initial); decimal price = orderable.Price; // TODO: Test source code logic. SourceCodeOrderDetail sourceCodeOrderDetail = null; if (sourceCode != null) { sourceCodeOrderDetail = new SourceCodeOrderDetail { Amount = sourceCode.CouponValue, SourceCodeId = sourceCode.Id, IsActive = true, OrganizationRoleUserCreatorId = dataRecorderMetaData.DataRecorderCreator.Id }; } EventCustomerOrderDetail eventCustomerOrderDetail = null; if (eventCustomer != null) { eventCustomerOrderDetail = new EventCustomerOrderDetail { EventCustomerId = eventCustomer.Id, IsActive = true }; } ShippingDetailOrderDetail shippingDetailOrderDetail = null; if (shippingDetail != null) { shippingDetailOrderDetail = new ShippingDetailOrderDetail { ShippingDetailId = shippingDetail.Id, IsActive = true }; } return(new OrderDetail { Description = orderable.Description, Price = price, Quantity = quantity, DetailType = orderable.OrderItemType, DataRecorderMetaData = dataRecorderMetaData, ForOrganizationRoleUserId = forOrganizationRoleUserId, OrderItemStatus = orderItemStatus, SourceCodeOrderDetail = sourceCodeOrderDetail, EventCustomerOrderDetail = eventCustomerOrderDetail, ShippingDetailOrderDetails = new List <ShippingDetailOrderDetail> { shippingDetailOrderDetail }, SourceId = sourceId }); }
private IList<OrderItemStatus> GetLineItemStatuses(int orderId) { var lineItems = new List<OrderItemStatus>(); using (var cmd = new SqlCommand("usp_GetLineItemStatuses", cn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@OrderId", SqlDbType.Int) {Value = orderId}); var reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { var lineItem = new OrderItemStatus { OrderlineItemId = reader.GetString(OrderLineItemIdOrdinal), ProductIdentifier = reader.GetString(ProductIdentifierOrdinal), QtyOrdered = reader.GetInt32(QtyOrderedOrdinal), QtyShipped = reader.GetInt32(QtyShippedOrdinal), QtyCancelled = reader.GetInt32(QtyCancelledOrdinal), QtyBackordered = reader.GetInt32(QtyBackorderedOrdinal), TrackingInformation = new List<ItemTracking>() }; var tracking = new ItemTracking(); if (!reader.IsDBNull(CarrierOrdinal)) tracking.Carrier = reader.GetString(CarrierOrdinal); if (!reader.IsDBNull(ShipDateOrdinal)) tracking.ShipDate = reader.GetDateTime(ShipDateOrdinal); if (!reader.IsDBNull(TrackingNumberOrdinal)) tracking.TrackingNumber = reader.GetString(TrackingNumberOrdinal); if (!reader.IsDBNull(TrackingUrlOrdinal)) tracking.TrackingUrl = reader.GetString(TrackingUrlOrdinal); lineItem.TrackingInformation.Add(tracking); lineItems.Add(lineItem); } } else { // TODO: Throw exception indicating no line items were returned. } } return lineItems; }
public OrderAnswer(OrderItemStatus status, string answer) : base((int)status, answer) { }
public void CannotFulfill() { Status = OrderItemStatus.Unavailable; }
public OrderException(OrderItemStatus status, string message) : base((int)status, message) { }
public async Task UpdateStatusAsync(OrderItem orderItemEntity, OrderItemStatus newStatus) { orderItemEntity.Status = newStatus; await _ordersContext.SaveChangesAsync(); }
public PurchaseOrder CreateClientPurchase(ShoppingCart shoppingCart) { UserEntity user = _context.Users.SingleOrDefault(u => u.Id == shoppingCart.UserId); OrderStatus orderWaitingStock = _context.OrderStatus.SingleOrDefault(s => s.Name == OrderStatus._WaitingStock); OrderItemStatus waitingStock = _context.OrderItemStatus.SingleOrDefault(s => s.Name == OrderItemStatus._WaitingStock); PurchaseOrder purchaseOrder = new PurchaseOrder() { User = user, CreditCarCompany = user.CreditCardCompany, CreditCarNumber = user.CreditCardNumber, Creation = DateTime.Now, Updated = DateTime.Now, Status = orderWaitingStock }; _context.Add(purchaseOrder); bool savedOrder = _context.SaveChanges() > 0; if (savedOrder) { List <PurchaseOrderItem> orderItems = new List <PurchaseOrderItem>(); foreach (CartItem item in shoppingCart.CartItems) { Product product = _context.Products.SingleOrDefault(p => p.Id == item.Product.Id); PurchaseOrderItem purchaseOrderItem = new PurchaseOrderItem() { Order = purchaseOrder, Product = product, Quantity = item.Quantity, UnitPrice = product.SellingPrice, Status = waitingStock }; _context.Add(purchaseOrderItem); orderItems.Add(purchaseOrderItem); } bool savedOrderItems = _context.SaveChanges() > 0; if (savedOrderItems) { Delete(shoppingCart); int changes = _context.SaveChanges(); return(_context.PurchaseOrders .Include(p => p.OrderItems) .ThenInclude(p => p.Product) .SingleOrDefault(p => p.Id == purchaseOrder.Id)); } else { throw new Exception($"Purchase order items not saved in the database, but order saved with Id = {purchaseOrder.Id}"); } } else { throw new Exception("Purchase order not saved in the database"); } }
private static List<OrderItemDO> GetItemListOfCollection(int collectionId, OrderItemStatus status) { var collectionItemList = GetCollectionOrderItemAsQueryable().Where(x => x.CollectionDataID == collectionId && x.StatusCode == status.ToString()); var orderItemList = CheckoutBL.GetOrderItemListByIdList(collectionItemList.Select(x => x.OrderItemID).ToList()); orderItemList.ForEach(x => { CollectionOrderItem collectionItem = collectionItemList.Single(c => c.OrderItemID == x.ID); x.IsTransferred = collectionItem.IsTransferred; x.IsTransferStatusUncertain = (collectionItem.IsTransferred == false) && (string.IsNullOrEmpty(collectionItem.IdempotencyKey) == false); x.PickupStatus = status.ToString(); x.NotFoundReasonText = collectionItem.NotFoundReasonID.HasValue ? ReasonBL.GetReasonByID(collectionItem.NotFoundReasonID.Value).ReasonText : null; x.WaybillNumber = collectionItem.WaybillNumber; }); return orderItemList; }
public static string GetStatusText(OrderItemStatus status) { //var umbracoHelper = new Umbraco.Web.UmbracoHelper(Umbraco.Web.UmbracoContext.Current); //var stats = umbracoHelper.TypedContentAtXPath("root/sysSiteSettings/sysDirectories/ordOrderStatuses/ordOrderStatus"); switch (status) { case OrderItemStatus.New: return "Ожидает обработки"; case OrderItemStatus.Processing: return "Обрабатывается"; case OrderItemStatus.Confirmed: return "Подтвержден, ожидает оплаты"; case OrderItemStatus.Paid: return "Оплачен"; case OrderItemStatus.SendToStock: return "Передан на склад"; case OrderItemStatus.SendFromStock: return "Передан со склада"; case OrderItemStatus.Canceled: return "Отменен"; case OrderItemStatus.CannotCall: return "Недозвон"; case OrderItemStatus.Exceeded: return "Просроченный"; case OrderItemStatus.Sended: return "Отправлен со склада"; case OrderItemStatus.Delivered: return "Доставка осуществлена"; } return "Ожидает обработки"; }
private static void UpdateItemsStatus(List<int> idList, OrderItemStatus status, int? collectionDataId, int userId) { CheckoutDataContextProvider dcp = CheckoutDataContextProvider.Instance; var itemList = GetAllOrderItemsAsQueryable(dcp).Where(x => idList.Contains(x.ID)).ToList(); DateTime utcNow = DateTime.UtcNow; itemList.ForEach(x => { x.StatusCode = status.ToString(); x.StatusCodeUpdateTime = utcNow; x.CollectionDataID = collectionDataId; }); dcp.CommitChanges(userId); }
public void Allocate() { Status = OrderItemStatus.Allocated; }