private static void logPaymentData(string resSettle, string resVerify, string saleReferenceID, string orderID, int resultCode, CartStatus paymentStatus) { var bankData = new BankData { ResCode = resultCode, SaleReferenceID = resultCode == 0 ? saleReferenceID : "-1", SettleCode = resultCode == 0 ? Int32.Parse(resSettle) : -1, VerifyCode = resultCode == 0 ? Int32.Parse(resVerify) : -1 }; string data = Newtonsoft.Json.JsonConvert.SerializeObject(bankData); var paymentLog = new PaymentLog { KeyID = orderID, SettleDate = DateTime.Now, PaymentStatus = paymentStatus, Data = data, LastUpdate = DateTime.Now }; PaymentLogs.UpdateByOrderID(paymentLog); }
private static void updateCart(ref string resSettle, ref string resVerify, string refID, string saleOrderID, string saleReferenceID, int resCode, CartStatus cartStatus, int cartID) { Cart updateStatus = new Cart(); // پرداخت موفقیت آمیز if (resCode == 0) { resVerify = verifyRequest(saleOrderID, saleReferenceID); resSettle = settleRequest(saleOrderID, saleReferenceID); updateStatus.SaleReferenceID = saleReferenceID; } // ویرایش اطلاعات پرداخت updateStatus.CartStatus = cartStatus; updateStatus.ID = cartID; updateStatus.LastUpdate = DateTime.Now; updateStatus.ResCode = resCode; updateStatus.RefID = refID; Carts.UpdatePaymentInfo(updateStatus); }
public static CartInitialized Create(Guid cartId, Guid clientId, CartStatus cartStatus) { Guard.Against.Default(cartId, nameof(cartId)); Guard.Against.Default(clientId, nameof(clientId)); Guard.Against.Default(cartStatus, nameof(cartStatus)); return(new CartInitialized(cartId, clientId, cartStatus)); }
public ShoppingCart(string userId, CartStatus status, bool needsDelivery, string deliveryAddress, IList <CartItems> cartItems) { CartId = Guid.NewGuid(); UserId = userId; Status = status; NeedsDelivery = needsDelivery; DeliveryAddress = deliveryAddress; CartItems = cartItems; }
public ShoppingCart(string userId, CartStatus status, bool needsDelivery, string deliveryAddress, double price) { CartId = Guid.NewGuid(); UserId = userId; Status = status; NeedsDelivery = needsDelivery; DeliveryAddress = deliveryAddress; Price = price; }
public static CartInitialized Create(Guid cartId, Guid clientId, CartStatus cartStatus) { if (cartId == Guid.Empty) { throw new ArgumentOutOfRangeException(nameof(cartId)); } if (clientId == Guid.Empty) { throw new ArgumentOutOfRangeException(nameof(clientId)); } if (cartStatus == default) { throw new ArgumentOutOfRangeException(nameof(cartStatus)); } return(new CartInitialized(cartId, clientId, cartStatus)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { CartStatus cartStatus = (CartStatus)value; switch (cartStatus) { case CartStatus.Free: return("空闲"); case CartStatus.WaitingAssorting: return("已停靠"); case CartStatus.Assorting: return("分拣中"); case CartStatus.Assorted: return("分拣完成"); case CartStatus.WaitingToBufferArea: return("等待发往缓存区"); case CartStatus.InCarriageToBufferArea: return("向缓存区运输中"); case CartStatus.ArrivedAtBufferArea: return("缓存区"); case CartStatus.NeedToWorkStation: return("需要发往生产线"); case CartStatus.WaitingToWorkStation: return("等待发往生产线"); case CartStatus.InCarriageToWorkStation: return("向生产线运输中"); case CartStatus.ArrivedAtWorkStation: return("生产线边"); case CartStatus.Indicating: return("装配中"); default: return(cartStatus.ToString()); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { CartStatus cartStatus = (CartStatus)value; switch (cartStatus) { case CartStatus.Free: return(Brushes.ForestGreen); case CartStatus.WaitingAssorting: return(Brushes.Firebrick); case CartStatus.Assorting: return(Brushes.DarkGoldenrod); case CartStatus.Assorted: return(Brushes.ForestGreen); case CartStatus.WaitingToBufferArea: return(Brushes.Gold); case CartStatus.InCarriageToBufferArea: return(Brushes.DarkGoldenrod); case CartStatus.ArrivedAtBufferArea: return(Brushes.ForestGreen); case CartStatus.NeedToWorkStation: return(Brushes.Firebrick); case CartStatus.WaitingToWorkStation: return(Brushes.Gold); case CartStatus.InCarriageToWorkStation: return(Brushes.DarkGoldenrod); case CartStatus.ArrivedAtWorkStation: return(Brushes.Firebrick); case CartStatus.Indicating: return(Brushes.DarkGoldenrod); default: return(Brushes.Black); } }
//fetching details to display the invoice public CartStatus Invoice(int UserId) { CartStatus status = new CartStatus(); try { using (var db = new Orchard9Entities()) { var query = (from cart in db.tblCarts join book in db.tblBooks on cart.ISBN equals book.ISBN join user in db.tblUsers on cart.UserId equals user.UserId where (cart.UserId == UserId) && (cart.PayStatus == true) select new CartView() { CartId = cart.CartId, UserId = cart.UserId, UserName = user.Name, ISBN = book.ISBN, BookName = book.BookName, BookImageUrl = book.BookImageUrl, Author = book.Author, Publisher = book.Publisher, Category = book.Category, Rating = book.Rating, Description = book.Description, Quantity = cart.Quantity, Price = (book.Price * cart.Quantity) }).ToList(); status.statusList = query; if (query.Count == 0) { status.statusMessage = "Invoice unsuccessful"; } else { status.statusMessage = "Invoice success"; } } } catch (Exception e) { status.statusMessage = e.Message; } return(status); }
public CartStatus Display(int UserId) //This method is used for getting all the cart details of a user { //and display it. CartStatus status = new CartStatus(); try { using (var db = new Orchard9Entities()) { if ((from e in db.tblUsers where e.UserId == UserId && e.IsActive == false select e.UserId).ToList().Count > 0) { status.statusMessage = "You are Blocked by Admin"; } else { var query = (from cart in db.tblCarts join book in db.tblBooks on cart.ISBN equals book.ISBN where (cart.UserId == UserId) && (cart.PayStatus == true) select new CartView() { CartId = cart.CartId, UserId = cart.UserId, BookName = book.BookName, BookImageUrl = book.BookImageUrl, Quantity = cart.Quantity, Price = (book.Price * cart.Quantity) }).ToList(); status.statusList = query; if (query.Count == 0) { status.statusMessage = "No Items in Cart"; } else { status.statusMessage = "Items in Cart"; } } } } catch (Exception e) { status.statusMessage = e.Message; } return(status); }
/// <summary> /// 料架状态转换 /// </summary> /// <param name="cartStatus">料架状态</param> /// <returns></returns> public static string CartStatusToTextConvert(CartStatus cartStatus) { switch (cartStatus) { case CartStatus.Free: return("空闲"); case CartStatus.WaitingAssorting: return("已停靠"); case CartStatus.Assorting: return("分拣中"); case CartStatus.Assorted: return("分拣完成"); case CartStatus.WaitingToBufferArea: return("等待发往缓存区"); case CartStatus.InCarriageToBufferArea: return("向缓存区运输中"); case CartStatus.ArrivedAtBufferArea: return("缓存区"); case CartStatus.NeedToWorkStation: return("需要发往生产线"); case CartStatus.WaitingToWorkStation: return("等待发往生产线"); case CartStatus.InCarriageToWorkStation: return("向生产线运输中"); case CartStatus.ArrivedAtWorkStation: return("生产线边"); case CartStatus.Indicating: return("装配中"); default: return(cartStatus.ToString()); } }
/// <summary> /// Inserts the specified cart. /// </summary> /// <param name="cart">The cart.</param> /// <returns>The inserted cart if was successful and action status</returns> protected ICartResult Insert(ICart cart) { ICart resultCart = null; CartStatus status = CartStatus.InvalidId; if (cart != null && cart.Id != null) { status = this.CartRepository.GetByKey(cart.Id) != null ? CartStatus.ExistingCart : ((resultCart = this.CartRepository.Add(cart)) != null ? CartStatus.Success : CartStatus.RepositoryError); } return(new CartResult() { Cart = resultCart, Status = status }); }
/// <summary> /// Reads the specified cart. /// </summary> /// <param name="cart">The cart.</param> /// <returns>The read cart if was successful and action status</returns> protected ICartResult Read(ICart cart) { ICart resultCart = null; CartStatus status = CartStatus.InvalidId; if (cart != null && cart.Id != null) { resultCart = this.CartRepository.GetByKey(cart.Id); status = resultCart != null ? CartStatus.Success : CartStatus.MissingCart; } return(new CartResult() { Cart = resultCart, Status = status }); }
/// <summary> /// Deletes the specified cart. /// </summary> /// <param name="cart">The cart.</param> /// <returns>The deleted cart if was successful and action status</returns> protected ICartResult Delete(ICart cart) { ICart resultCart = null; CartStatus status = CartStatus.InvalidId; if (cart != null && cart.Id != null) { status = this.CartRepository.GetByKey(cart.Id) == null ? CartStatus.MissingCart : this.CartRepository.Delete(cart.Id) ? CartStatus.Success : CartStatus.RepositoryError; resultCart = status == CartStatus.Success ? cart : null; } return(new CartResult() { Cart = resultCart, Status = status }); }
public string setDBCartStatus(int cartId, int cartStatusId, string userId) { try { CartDetail cart = db.CartDetails.Find(cartId); CartStatus cartStatus = db.CartStatus.Find(cartStatusId); var userID = getUserAccID(); cart.CartStatu = cartStatus; db.Entry(cart).State = EntityState.Modified; db.SaveChanges(); addCartHistory(cart, cartStatus.Id, userID); return("cart status updated"); } catch (Exception ex) { return(ex.Message); } }
public Cart(User user, CartStatus status) : this(user) { this.Status = status; }
public OrderGot(CartStatus status) { CartStatus = status; }
public SetOrderStatusCmd(ClientAgg client, CartStatus newStatus) { ClientAgg = client; CartStatus = newStatus; }
public void Cancel() { Status = CartStatus.Cancelled; }
public void Apply(CartInitialized @event) { Id = @event.CartId; TotalItemsCount = 0; Status = CartStatus.Pending; }
public AddToCart() { Date = DateTime.Now; Status = CartStatus.InCart; Quantity = 1; }
public static IO <ISetOrderStatusResult> SetOrderStatus(ClientAgg clientAgg, CartStatus newStatus) => NewIO <SetOrderStatusOp.SetOrderStatusCmd, ISetOrderStatusResult>(new SetOrderStatusOp.SetOrderStatusCmd(clientAgg, newStatus));
public void UpdateStatus(CartStatus status) { Status = status; }
public SetOrderStatusCmd(Cart cart, CartStatus newStatus) { Cart = cart; CartStatus = newStatus; }
public void Pay() { Status = CartStatus.Paid; }
public AddToCart(int quantity) { Date = DateTime.Now; Status = CartStatus.InCart; Quantity = quantity; }
public CartInitialized(Guid cartId, Guid clientId, CartStatus cartStatus) { CartId = cartId; ClientId = clientId; CartStatus = cartStatus; }
public void Apply(CartConfirmed @event) { Status = CartStatus.Confirmed; }
public static IO <ISetOrderStatusResult> SetOrderStatus(Cart cart, CartStatus status) => NewIO <SetOrderStatusCmd, ISetOrderStatusResult>(new SetOrderStatusCmd(cart, status));