public override void Update(StoreOrder dataObject) { if (dataObject.Status == 3) { using (IDAL dal = this.DAL) { dal.BeginTransaction(); try { dal.Update <StoreOrder>(dataObject); IUniParameter prmStoreOrderId = dal.CreateParameter("StoreOrderId", dataObject.StoreOrderId); dal.ExecuteNonQuery("WHS_INS_GATHERINGFROMORDER_SP", prmStoreOrderId); dal.CommitTransaction(); } catch (Exception ex) { dal.RollbackTransaction(); _logger.Error($" ServiceName : StoreOrderService, MethodName : Update, Input : ({Newtonsoft.Json.JsonConvert.SerializeObject(dataObject)}, Exception : {ex.Message}"); throw; } } } else { base.Update(dataObject); } }
private StoreOrder VerifiedStoreOrder(Order order, Guid storeID) { StoreOrder storeOrder = order.StoreOrdersDict[storeID]; Assert.IsNotNull(storeOrder); return(storeOrder); }
private StoreOrder SaveForSaleInvoice(StoreOrder storeOrder) { try { var storeDetailsBusiness = Business.GetStoreOrderDetailBusiness(); var storeOrderBusiness = Business.GetStoreOrderBusiness(); var storeDetails = storeDetailsBusiness.GetByStoreOrderId(storeOrder.Id); var saleStoreOrder = storeOrderBusiness.Clone(storeOrder); saleStoreOrder.IdStoreOperation = Constants.StoreOperation.SaleInvoice.ToInt(); storeOrderBusiness.Save(saleStoreOrder); foreach (var item in storeDetails) { var saleStoreDetail = new StoreOrderDetail(); saleStoreDetail = storeDetailsBusiness.Clone(item); saleStoreDetail.IdStoreOrder = saleStoreDetail.Id; storeDetailsBusiness.Save(saleStoreDetail); } return(saleStoreOrder); } catch { throw; } }
/// <summary> /// 充值 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <string> ChargePay(InsertOrderInput input) { var order = new StoreOrder() { OpenId = input.OpenId, PayType = PayType.PayCharge, OrderNum = Guid.NewGuid().ToString("N"), OrderState = null, PayState = null, Price = input.Price, ProductId = input.ProductId }; var type = await _chargeTypeRepository.FirstOrDefaultAsync(input.ProductId); if (type == null) { throw new UserFriendlyException("充值类型不存在"); } await _storeRepository.InsertAsync(order); JsApiPay jsApiPay = new JsApiPay { Openid = input.OpenId, TotalFee = type.Cost }; jsApiPay.GetUnifiedOrderResult(order.OrderNum, "用户充值", "用户充值"); var param = jsApiPay.GetJsApiParameters(); return(param); }
public async Task <IHttpActionResult> QrCode(string AssetId, int ProductNum, string Notify_Url, string OrderNo, string Key) { var order = await _orderRepository.FirstOrDefaultAsync(c => c.OrderNum.Equals(OrderNo) && !c.PayState.HasValue); var product = await _productRepository.FirstOrDefaultAsync(c => c.ProductId == ProductNum); if (product == null) { return(Json(new { result = "0" })); } var fast = order?.FastCode ?? "000"; if (order == null) { order = new StoreOrder() { DeviceNum = AssetId, OrderNum = OrderNo, OrderState = null, PayState = null, OrderType = OrderType.Ice, ProductId = ProductNum, NoticeUrl = Notify_Url, Key = Key }; order = await _orderRepository.InsertAsync(order); } // 102 - 10152 - 222 - 990 - 2017120509563310152abcde - 1 var codeUrl = $"http://card.youyinkeji.cn/#/detail/{order.ProductId}^{order.DeviceNum}^{fast}^{product.Price}^{order.OrderNum}^{2}"; return(Json(new { result = "1", qr_code = codeUrl })); }
/// <summary> /// 卡券支付 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <string> CardPay(InsertOrderInput input) { var p = await _productRepository.FirstOrDefaultAsync(c => c.Id == input.ProductId); if (p == null) { throw new UserFriendlyException("该商品不存在"); } var order = new StoreOrder() { OpenId = input.OpenId, PayType = PayType.ActivityPay, OrderNum = Guid.NewGuid().ToString("N"), OrderState = null, PayState = null, Price = p.Price, ProductId = p.ProductId }; await _storeRepository.InsertAsync(order); JsApiPay jsApiPay = new JsApiPay { Openid = input.OpenId, TotalFee = p.Price }; jsApiPay.GetUnifiedOrderResult(order.OrderNum, p.ProductName, p.Description); var param = jsApiPay.GetJsApiParameters(); return(param); }
public StoreOrder RegisterStoreOrder(Data.Com company) { try { var storeOrder = Business.GetStoreOrderBusiness().GetById(StoreOrderId.ToGUID()); if (storeOrder == null) { storeOrder = new StoreOrder(); } storeOrder.OId = storeOrder.OId.IsNullOrEmpty() ? Business.GetStoreOrderBusiness().GetLastEditedOId(this.StoreOperationId) : storeOrder.OId; storeOrder.ODate = dtpIssueDate.Text; if (StoreOperationId == Common.Constants.StoreOperation.WarehouseReceipts) { storeOrder.IdCompany = company.Id; } storeOrder.OReverse = false; storeOrder.ODelete = false; storeOrder.IdStoreOperation = this.StoreOperationId; Business.GetStoreOrderBusiness().Save(storeOrder); return(storeOrder); } catch { throw; } }
/// <summary> /// regitser store order /// </summary> public StoreOrder RegisterStoreOrder() { try { var storeOrder = Business.GetStoreOrderBusiness().GetById(StoreOrderId); if (storeOrder == null) { storeOrder = new StoreOrder(); } var company = Business.GetComBusiness().GetByName(txtCompany.Text); if (company == null) { //رخداد خطا throw new Exception(Localize.ex_company_not_found); } storeOrder.OId = storeOrder.OId.IsNullOrEmpty() ? Business.GetStoreOrderBusiness().GetLastEditedOId(this.StoreOperationId) : storeOrder.OId; storeOrder.ODate = dtpIssueDate.Text; storeOrder.IdCompany = company.Id; storeOrder.OReverse = false; storeOrder.ODelete = false; storeOrder.IdStoreOperation = this.StoreOperationId; Business.GetStoreOrderBusiness().Save(storeOrder); StoreOrderId = storeOrder.Id; return(storeOrder); } catch { throw; } }
/// <summary> /// register store order detail /// </summary> private StoreOrderDetail RegisterStoreDetail(StoreOrder storeOrder) { try { var commodity = Business.GetCommodityBusiness().GetByName(txtCommodityCode.Text); if (commodity == null) { throw new Exception(Localize.ex_commodity_not_found); } var storeOrderDetailBusiness = Business.GetStoreOrderDetailBusiness(); var storeOrderDetail = Business.GetStoreOrderDetailBusiness().GetByCommodity(commodity.ID, cmbUnitCount.SelectedValue.ToGUID()); if (storeOrderDetail == null) { storeOrderDetail = new StoreOrderDetail(); } storeOrderDetail.IdStoreOrder = storeOrder.Id; storeOrderDetail.IdCommodity = commodity.ID; storeOrderDetail.ODCountingUnit = cmbUnitCount.SelectedValue.ToGUID(); storeOrderDetail.ODCount = storeOrderDetail.ORemained = txtCount.Text.ToInt(); storeOrderDetail.ODMoney = txtUnitPrice.Text.ToDecimal() * txtCount.Text.ToInt(); storeOrderDetail.ODDiscount = txtDicountPrice.Text.ToDecimal(); storeOrderDetail.ODDescription = txtBillDescription.Text; Business.GetStoreOrderDetailBusiness().Save(storeOrderDetail); return(storeOrderDetail); } catch { throw; } }
/// <summary> /// 在线支付 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <string> LinePay(InsertOrderInput input) { var p = await _productRepository.FirstOrDefaultAsync(c => c.Id == input.ProductId); if (p == null) { throw new UserFriendlyException("该商品不存在"); } var order = await _storeRepository.FirstOrDefaultAsync(c => c.OrderNum.Equals(input.Order)); if (order == null) { order = new StoreOrder() { FastCode = input.FastCode, OpenId = input.OpenId, PayType = PayType.LinePay, OrderType = input.OrderType, OrderState = null, OrderNum = input.Order, DeviceNum = input.Device, PayState = null, Price = p.Price, ProductId = p.ProductId }; } else { if (order.PayState.HasValue && order.PayState.Value) { throw new UserFriendlyException("该订单已支付,不可重复付款"); } order.OpenId = input.OpenId; order.Price = p.Price; order.FastCode = input.FastCode; order.OrderType = input.OrderType; order.PayType = PayType.LinePay; } JsApiPay jsApiPay = new JsApiPay { Openid = input.OpenId, TotalFee = p.Price }; var card = await _cardRepository.FirstOrDefaultAsync(c => c.Key == input.Key.Value); //使用优惠券 if (card != null) { order.UseCard = input.Key; var t = p.Price - card.Cost; jsApiPay.TotalFee = t <= 0 ? 0 : t; } await _storeRepository.InsertOrUpdateAsync(order); jsApiPay.GetUnifiedOrderResult(order.OrderNum, p.ProductName, p.Description); var param = jsApiPay.GetJsApiParameters(); return(param); }
private OrderItem VerifiedOrderItem(Order order, Guid storeID, Guid itemID) { StoreOrder storeOrder = VerifiedStoreOrder(order, storeID); OrderItem orderItem = storeOrder.OrderItemsDict[itemID]; Assert.IsNotNull(orderItem); return(orderItem); }
private void Init(string name, int dimension, int maxSize, params string[] dimensionNames) { _storageName = name; _dimension = dimension; _maxSize = maxSize; _name = dimensionNames; _order = StoreOrder.OldestLast; }
private void VerifyStoreDiscount(Order order, Guid storeID, double discount) { StoreOrder storeOrder = VerifiedStoreOrder(order, storeID); foreach (OrderItem orderItem in storeOrder.StoreOrderItems) { Assert.AreEqual(orderItem.DiscountedPricePerItem, orderItem.BasePricePerItem * discount); } }
private void SetHeader(StoreOrder storeOrder) { try { } catch { throw; } }
public async Task CreateAsync(StoreOrder order) { const string sql = @"INSERT INTO [dbo].[StoreOrders]([Id],[OrderNo],[Timestamp],[Status],[MerchantInfoId],[MerchantInfoName],[UserAccountId],[CryptoId],[CryptoCode],[CryptoAmount],[CryptoActualAmount],[ExchangeRate],[Markup],[FiatCurrency],[FiatAmount],[FiatActualAmount],[FeeRate],[TransactionFee],[PaymentTime],[Remark]) VALUES (@Id,@OrderNo,@Timestamp,@Status,@MerchantInfoId,@MerchantInfoName,@UserAccountId,@CryptoId,@CryptoCode,@CryptoAmount,@CryptoActualAmount,@ExchangeRate,@Markup,@FiatCurrency,@FiatAmount,@FiatActualAmount,@FeeRate,@TransactionFee,@PaymentTime,@Remark)"; using (var con = await WriteConnectionAsync()) { await con.ExecuteAsync(sql, order); } }
public StoreOrderDomainModel(StoreOrder model) { Id = model.Id; OrderNo = model.OrderNo; Status = model.Status; Store_Id = model.Store_Id; Subtotal = model.Subtotal; Total = model.Total; IsDeleted = model.IsDeleted; Order_Id = model.Order_Id; }
public static void AddNewOrderItem(this StoreOrder storeOrder, CartItemViewModel model) { try { Order_Items orderItem = new Order_Items(); orderItem.SetOrderItem(model); storeOrder.Order_Items.Add(orderItem); } catch (Exception) { throw; } }
public static void AddNewOrderItem(this StoreOrder storeOrder, CartItemViewModel model, DunkeyContext ctx) { try { Order_Items orderItem = new Order_Items(); orderItem.SetOrderItem(model, ctx); storeOrder.Order_Items.Add(orderItem); } catch (Exception ex) { DunkeyDelivery.Utility.LogError(ex); } }
public override void startTask() { //ViewObject.startObjects.current = 0; //current = 0; GameObject[] objs; objs = new GameObject[parentObject.transform.childCount]; Array.Sort(objs); int i = 0; foreach (Transform child in parentObject.transform) { objs[i] = child.gameObject; i++; } if (order) { // Deal with specific ordering StoreOrder ordered = order.GetComponent("StoreOrder") as StoreOrder; if (ordered) { Debug.Log("ordered"); Debug.Log(ordered.storeOrder.Count); if (ordered.storeOrder.Count > 0) { objs = ordered.storeOrder.ToArray(); } } } if (shuffle) { Experiment.Shuffle(objs); } TASK_START(); foreach (GameObject obj in objs) { objects.Add(obj); log.log("TASK_ADD "+ name + "\t" + this.GetType().Name + "\t" + obj.name + "\t" + "null", 1); } }
public static void AddNewStoreOrder(this Order order, CartItemViewModel model) { try { StoreOrder storeOrder = new StoreOrder(); storeOrder.Store_Id = model.StoreId; storeOrder.OrderNo = Guid.NewGuid().ToString("N").ToUpper(); storeOrder.AddNewOrderItem(model); order.StoreOrders.Add(storeOrder); } catch (Exception) { throw; } }
public void Handle(ICommandContext context, CreateStoreOrderCommand command) { //从上下文中获取商家的地区信息 var region = context.Get <Store>(command.StoreId).GetInfo().Region; //付款者钱包ID var walletId = context.Get <User>(command.UserId).GetWalletId(); var userid = context.Get <Store>(command.StoreId).GetUserId(); var storeownerwalletid = context.Get <User>(userid).GetWalletId(); var storeOrder = new StoreOrder( command.AggregateRootId, walletId, storeownerwalletid, new Domain.Models.Stores.StoreOrders.StoreOrderInfo( command.UserId, command.OrderId, command.StoreId, region, command.Number, command.Remark), new Domain.Models.Stores.StoreOrders.ExpressAddressInfo( command.ExpressAddressInfo.Region, command.ExpressAddressInfo.Address, command.ExpressAddressInfo.Name, command.ExpressAddressInfo.Mobile, command.ExpressAddressInfo.Zip ), command.OrderGoodses.Select(x => new OrderGoodsInfo( x.GoodsId, x.SpecificationId, walletId, storeownerwalletid, x.GoodsName, x.GoodsPic, x.SpecificationName, x.Price, x.OrigianlPrice, x.Quantity, x.Total, x.StoreTotal, DateTime.Now, x.Benevolence) ).ToList() ); //添加到上下文 context.Add(storeOrder); }
private void btnRegisterCommodity_Click(object sender, RoutedEventArgs e) { try { if (cmbUnitCount.SelectedItem == null) { throw new Exception(Localize.ex_unit_count_is_mandatory); } if (txtCount.Text.ToInt() <= 0) { throw new Exception(Localize.ex_count_is_not_valid); } var storeOrder = new StoreOrder(); var storeOrderDetails = new List <StoreOrderDetail>(); using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted, Timeout = new TimeSpan(2, 0, 0) })) { storeOrder = RegisterStoreOrder(); RegisterStoreDetail(storeOrder); storeOrderDetails = Business.GetStoreOrderDetailBusiness().GetByStoreOrderId(storeOrder.Id).ToList(); SetTotalInformations(storeOrder, storeOrderDetails); scope.Complete(); } txtBillNum.Text = storeOrder.OId; SetFooter(storeOrder, storeOrderDetails); SetDataGrid(); this.StoreOrderId = storeOrder.Id; } catch (Exception ex) { AccountingKernel.Forms.Base.BaseWindow.ShowError(ex); } }
private void SetHeader(StoreOrder storeOrder) { try { txtBillNum.Text = storeOrder.OId; dtpIssueDate.Text = storeOrder.ODate; if (storeOrder.IdCompany.HasValue) { txtCompany.Text = Business.GetCompanyBusiness().GetById(storeOrder.IdCompany.Value).CName; } } catch { throw; } }
public void Copy(GenericPointStorage src) { _storageName = src._storageName; _dimension = src._dimension; _maxSize = src._maxSize; _name = src._name; _order = src._order; _values = src._values.Clone() as ArrayList; // shallow copy // make it a deep copy for (int i = 0; i < _values.Count; i++) { _values[i] = new NPoint(src._values[i] as NPoint); } }
///// <summary> ///// register store order detail ///// </summary> //private StoreOrderDetail RegisterStoreDetail(StoreOrder storeOrder) //{ // try // { // //var commodity = Business.GetCommodityBusiness().GetByName(txtCommodityCode.Text); // //if (commodity == null) // // throw new Exception(Localize.ex_commodity_not_found); // //var storeOrderDetailBusiness = Business.GetStoreOrderDetailBusiness(); // //var storeOrderDetail = Business.GetStoreOrderDetailBusiness().GetByCommodity(commodity.ID, cmbUnitCount.SelectedValue.ToGUID()); // //if (storeOrderDetail == null) // // storeOrderDetail = new StoreOrderDetail(); // //storeOrderDetail.IdStoreOrder = storeOrder.Id; // //storeOrderDetail.IdCommodity = commodity.ID; // //storeOrderDetail.ODCountingUnit = cmbUnitCount.SelectedValue.ToGUID(); // //storeOrderDetail.ODCount = storeOrderDetail.ORemained = txtCount.Text.ToInt(); // //storeOrderDetail.ODMoney = txtUnitPrice.Text.ToDecimal() * txtCount.Text.ToInt(); // //storeOrderDetail.ODDiscount = txtDicountPrice.Text.ToDecimal(); // //storeOrderDetail.ODDescription = txtBillDescription.Text; // //Business.GetStoreOrderDetailBusiness().Save(storeOrderDetail); // //return storeOrderDetail; // } // catch // { // throw; // } //} ///// <summary> ///// regitser store order ///// </summary> //public StoreOrder RegisterStoreOrder() //{ // try // { // var storeOrder = Business.GetStoreOrderBusiness().GetById(StoreOrderId); // if (storeOrder == null) // storeOrder = new StoreOrder(); // else if (storeOrder.IdStoreOperation == Constants.StoreOperation.PreInvoice // && StoreOperationId == Constants.StoreOperation.SaleInvoice) // storeOrder = SaveForSaleInvoice(storeOrder); // var company = Business.GetCompanyBusiness().GetByName(txtCompany.Text); // if (company == null) // //رخداد خطا // throw new Exception(Localize.ex_company_not_found); // storeOrder.OId = txtBillNum.Text == string.Empty ? (Business.GetStoreOrderBusiness().GetMaxOId() + 1).ToString() : txtBillNum.Text; // storeOrder.ODate = dtpIssueDate.Text; // storeOrder.IdCompany = company.Id; // storeOrder.OReverse = false; // storeOrder.ODelete = false; // storeOrder.IdStoreOperation = this.StoreOperationId; // Business.GetStoreOrderBusiness().Save(storeOrder); // return storeOrder; // } // catch // { // throw; // } //} //private StoreOrder SaveForSaleInvoice(StoreOrder storeOrder) //{ // try // { // var storeDetailsBusiness = Business.GetStoreOrderDetailBusiness(); // var storeOrderBusiness = Business.GetStoreOrderBusiness(); // var storeDetails = storeDetailsBusiness.GetByStoreOrderId(storeOrder.Id); // var saleStoreOrder = storeOrderBusiness.Clone(storeOrder); // saleStoreOrder.IdStoreOperation = Constants.StoreOperation.SaleInvoice; // storeOrderBusiness.Save(saleStoreOrder); // foreach (var item in storeDetails) // { // var saleStoreDetail = new StoreOrderDetail(); // saleStoreDetail = storeDetailsBusiness.Clone(item); // saleStoreDetail.IdStoreOrder = saleStoreDetail.Id; // storeDetailsBusiness.Save(saleStoreDetail); // } // return saleStoreOrder; // } // catch // { // throw; // } //} ///// <summary> ///// finds storeorder by oid, odate and company ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //private void txtHeaders_TextChanged(object sender, TextChangedEventArgs e) //{ // try // { // //StoreOrderId = Guid.Empty; // if (dtpIssueDate.Text == string.Empty || txtCompany.Text.Trim() == string.Empty) // return; // var company = Business.GetCompanyBusiness().GetByName(txtCompany.Text); // if (company != null) // { // var storeOrder = Business.GetStoreOrderBusiness().GetAll().Where(r => r.OId == txtBillNum.Text && r.ODate == dtpIssueDate.Text && r.IdCompany == company.Id).FirstOrDefault(); // if (storeOrder != null) // { // StoreOrderId = storeOrder.Id; // txtTotalDiscount.Text = storeOrder.ODiscount.HasValue ? storeOrder.ODiscount.ToString() : string.Empty; // txtTotalPrice.Text = storeOrder.OSumMoney.HasValue ? storeOrder.OSumMoney.ToString() : string.Empty; // txtTotalTax.Text = storeOrder.OTax.HasValue ? storeOrder.OTax.ToString() : string.Empty; // txtTotalMunicipalTax.Text = storeOrder.OMunicipalTax.HasValue ? storeOrder.OMunicipalTax.ToString() : string.Empty; // txtStoreDescription.Text = storeOrder.ODescription; // } // } // this.SetDataGrid(); // } // catch // { // throw; // } //} ///// <summary> ///// store detail order selected cell changed ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) //{ // try // { // Guid id = (DataGrid.SelectedValue as dynamic).Id; // var storeOrderDetail = Business.GetStoreOrderDetailBusiness().GetById(id); // var commodityDetail = Business.GetCommodityDetailBusiness().GetByCodeTitle(storeOrderDetail.IdCommodity, Constants.CodeTitle.CommodityTitle); // SetUnitCountComboBox(storeOrderDetail.IdCommodity); // txtCommodityCode.Text = commodityDetail.CDName; // cmbUnitCount.SelectedValue = storeOrderDetail.ODCountingUnit; // txtCount.Text = storeOrderDetail.ODCount.ToString(); // var commodity = Business.GetCommodityBusiness().GetByName(txtCommodityCode.Text); // var company = Business.GetCompanyBusiness().GetByName(txtCompany.Text.Trim()); // txtUnitPrice.Text = Business.GetCommodityBusiness().SetPrice(cmbUnitCount.SelectedValue.ToGUID(), commodity, company).ToString(); // txtDicountPrice.Text = storeOrderDetail.ODDiscount.ToString(Localize.DoubleMaskType); // txtBillDescription.Text = storeOrderDetail.ODDescription; // } // catch // { // throw; // } //} //private void btnRegisterCommodity_Click(object sender, RoutedEventArgs e) //{ // try // { // var storeOrder = new StoreOrder(); // var storeOrderDetails = new List<StoreOrderDetail>(); // using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() // { // IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted, // Timeout = new TimeSpan(2, 0, 0) // })) // { // storeOrder = RegisterStoreOrder(); // RegisterStoreDetail(storeOrder); // storeOrderDetails = Business.GetStoreOrderDetailBusiness().GetByStoreOrderId(storeOrder.Id).ToList(); // SetTotalInformations(storeOrder, storeOrderDetails); // scope.Complete(); // } // SetFooter(storeOrder, storeOrderDetails); // SetDataGrid(); // this.StoreOrderId = storeOrder.Id; // } // catch (Exception ex) // { // AccountingKernel.Forms.Base.BaseWindow.ShowError(ex); // } //} //private void SetTotalInformations(StoreOrder storeOrder, List<StoreOrderDetail> storeOrderDetails) //{ // try // { // var sumDetails = storeOrderDetails.Sum(r => r.ODMoney); // storeOrder.OMunicipalTax = sumDetails * txtTotalMunicipalTax.Text.ToDecimal() / (decimal)100; // storeOrder.OTax = sumDetails * txtTotalTax.Text.ToDecimal() / (decimal)100; // storeOrder.OSumMoney = sumDetails + storeOrder.OMunicipalTax + storeOrder.OTax - // storeOrderDetails.Sum(r => r.ODDiscount) * sumDetails / (decimal)100 - txtDicountPrice.Text.ToDecimal(); // storeOrder.ODiscount = txtTotalDiscount.Text.ToDecimal(); // Business.GetStoreOrderBusiness().Save(storeOrder); // } // catch // { // throw; // } //} private void SetFooter(StoreOrder storeOrder, List <StoreOrderDetail> storeOrderDetails) { try { //var sumDetails = storeOrderDetails.Sum(r => r.ODMoney.ToDecimal()); //txtTotalMunicipalTax.Text = sumDetails == 0 ? "0" : (storeOrder.OMunicipalTax.ToDecimal() * (decimal)100 / sumDetails).ToString(Localize.DoubleMaskType); //txtTotalTax.Text = sumDetails == 0 ? "0" : (storeOrder.OTax.ToDecimal() * (decimal)100 / sumDetails).ToString(Localize.DoubleMaskType); //txtTotalDiscount.Text = storeOrder.ODiscount.ToDecimal().ToString(); //txtTotalPrice.Text = storeOrder.OSumMoney.ToDecimal().ToString(); } catch { throw; } }
/// <summary> /// 取货 /// </summary> /// <returns></returns> public async Task <dynamic> PickProductIce(StoreOrder order) { var url = order.NoticeUrl; if (url.IsNullOrWhiteSpace() || order.Key.IsNullOrWhiteSpace()) { throw new UserFriendlyException("该订单无效,没有回调地址"); } var result = HttpHandler.PostMoths(url, JsonConvert.SerializeObject(new { payStatus = "0", key = order.Key })); return(result); }
public async Task <Purchase> CreatePurchase(CreateStoreOrdersModel model, int currentUserId) { var storeOrder = new StoreOrder { StoreId = model.StoreId, IsSubmitted = false }; var purchase = new Purchase { Type = PurchaseType.Store, CreatorId = currentUserId, IsPayedOff = false, Name = model.Name, CreatedAt = DateTime.Now, StoreOrder = storeOrder }; _db.Purchases.Add(purchase); await _db.SaveChangesAsync(); var userPurchases = model.Users .Union(new List <int> { currentUserId }) .Select(u => new UserPurchase { PurchaseId = purchase.Id, UserId = u, Status = PurchaseStatus.New }); _db.UserPurchases.AddRange(userPurchases); await _db.SaveChangesAsync(); return(await _db.Purchases .Include(up => up.StoreOrder) .Include(up => up.UserPurchases) .ThenInclude(p => p.User) .Include(up => up.UserPurchases) .ThenInclude(p => p.Items) .Where(p => p.Id == purchase.Id) .FirstOrDefaultAsync()); }
private void btnRegisterCommodity_Click(object sender, RoutedEventArgs e) { try { var errorMessage = string.Empty; if (!ValidateForm(out errorMessage)) { throw new Exception(errorMessage); } var storeOrder = new StoreOrder(); var storeOrderDetails = new List <StoreOrderDetail>(); using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted, Timeout = new TimeSpan(2, 0, 0) })) { storeOrder = RegisterStoreOrder(); RegisterStoreDetail(storeOrder); storeOrderDetails = Business.GetStoreOrderDetailBusiness().GetByStoreOrderId(storeOrder.Id).ToList(); SetTotalInformations(storeOrder, storeOrderDetails); scope.Complete(); } SetFooter(storeOrder, storeOrderDetails); SetDataGrid(); this.StoreOrderId = storeOrder.Id; } catch (Exception ex) { AccountingKernel.Forms.Base.BaseWindow.ShowError(ex); } }
private void SetTotalInformations(StoreOrder storeOrder, List <StoreOrderDetail> storeOrderDetails) { try { var sumDetails = storeOrderDetails.Sum(r => r.ODMoney); storeOrder.OMunicipalTax = sumDetails * txtTotalMunicipalTax.Text.ToDecimal() / (decimal)100; storeOrder.OTax = sumDetails * txtTotalTax.Text.ToDecimal() / (decimal)100; storeOrder.OSumMoney = sumDetails + storeOrder.OMunicipalTax + storeOrder.OTax - storeOrderDetails.Sum(r => r.ODDiscount) * sumDetails / (decimal)100 - txtDicountPrice.Text.ToDecimal(); storeOrder.ODiscount = txtTotalDiscount.Text.ToDecimal(); Business.GetStoreOrderBusiness().Save(storeOrder); } catch { throw; } }
public void Dispatch(StoreOrder dataObject) { using (IDAL dal = this.DAL) { dal.BeginTransaction(); try { dal.Update(dataObject); IUniParameter prmStoreOrderId = dal.CreateParameter("StoreOrderId", dataObject.StoreOrderId); dal.ExecuteNonQuery("WHS_INS_WAYBILL_SP", prmStoreOrderId); dal.CommitTransaction(); } catch (Exception ex) { dal.RollbackTransaction(); throw ex; } } }