public async Task <IHttpActionResult> WithdrawAsync(string cardId, AmountModel amountModel) { var amountInfo = Mapper.Map <AmountModel, AmountInfo>(amountModel); await _accountApplicationService.WithdrawAsync(cardId, amountInfo); return(Ok()); }
public ActionResult SavePurchaseInvoice(AmountModel model) { try { var products = Session["productlist"] as List <DATA.Domains.PurchaseItem>; var UserInfo = (Dashboard.Models.UserInfo)Session["UserInfo"]; var purchase = productprovider.GeneratePurchase(); products.ForEach(x => x.PurchaseId = purchase.Id); products.ForEach(x => x.CreatedOn = DateTime.Now); productprovider.SavePurchaseItems(products); var ledgerForBuyer = BuildLedger(purchase.Id, model.InsertionTypeId, UserInfo.UserId, model.AmountIn, model.AmountOut, model.Balance, model.Total, model.AccountHolderId); ledgerProvider.SaveLedger(ledgerForBuyer); var trademarkaccountholder = productprovider.gettrademarakaccountholder(UserInfo.TrademarkID); var ledgerFortradeMark = BuildLedger(purchase.Id, model.InsertionTypeId, UserInfo.UserId, model.AmountOut, model.AmountIn, -model.Balance, model.Total, trademarkaccountholder.Id); ledgerProvider.SaveLedger(ledgerFortradeMark); var Buyerledger = ledgerProvider.GetLedgerByPurchaseId(purchase.Id); TempData["ledger"] = Buyerledger; Session["productlist"] = null; return(RedirectToAction("ShowPurchaseInvoice")); } catch (Exception ex) { return(View("Views/Product/Error.cshtml", ex.Message)); } }
public ActionResult SaveSaleInvoice(AmountModel model) { try { var product = Session["soldproductlist"] as List <SoldItems>; var UserInfo = (Dashboard.Models.UserInfo)Session["UserInfo"]; var sale = productprovider.GenerateSale(); product.ForEach(x => x.SaleId = sale.Id); product.ForEach(x => x.CreatedOn = DateTime.Now); productprovider.SaveSoldItems(product); var ledgerForBuyer = BuildSaleLedger(sale.Id, model.InsertionTypeId, UserInfo.UserId, model.AmountIn, model.AmountOut, model.Balance, model.Total, model.AccountHolderId); ledgerProvider.SaveLedger(ledgerForBuyer); var trademarkaccountholder = productprovider.gettrademarakaccountholder(UserInfo.TrademarkID); var ledgerFortradeMark = BuildSaleLedger(sale.Id, model.InsertionTypeId, UserInfo.UserId, model.AmountOut, model.AmountIn, -model.Balance, model.Total, trademarkaccountholder.Id); ledgerProvider.SaveLedger(ledgerFortradeMark); Session["productlist"] = null; return(RedirectToAction("ShowPurchaseInvoice")); } catch (Exception ex) { return(View("Views/Product/Error.cshtml", ex.Message)); } }
public ActionResult SearchResult(string r) { try { var t = new Stopwatch(); t.Start(); var culture = new CultureInfo("ru-RU"); var result = _api.Fares(r); var e1 = t.Elapsed; int did = 0; // Additional info (start and end time and date, flight number, time in air) foreach (var airline in result.Airlines) { foreach (var fare in airline.Fare) { fare.Additional = _api.FareDetails(r, fare.Id); fare.Additional.Airline = airline.Name; //fare.Price = AmountModel.CalculateAmount(decimal.Parse(fare.Price)); fare.PriceWithComission = AmountModel.CalculateAmount(decimal.Parse(fare.Price)); fare.Comission = AmountModel.CalculateComission(decimal.Parse(fare.Price)); foreach (var dir in fare.Additional.Dirs) { dir.Id = did.ToString(); did++; foreach (var fareDetailsVariant in dir.Variants) { fareDetailsVariant.Legs[0].Departure.Date = DateTime.Parse(fareDetailsVariant.Legs[0].Departure.Date).ToShortDateString(); fareDetailsVariant.Legs[0].Arrival.Date = DateTime.Parse(fareDetailsVariant.Legs[0].Arrival.Date).ToShortDateString(); var day = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), fareDetailsVariant.Legs[0].Departure.DayOfWeek); fareDetailsVariant.Legs[0].Departure.DayOfWeek = culture.DateTimeFormat.GetDayName(day); day = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), fareDetailsVariant.Legs[0].Arrival.DayOfWeek); fareDetailsVariant.Legs[0].Arrival.DayOfWeek = culture.DateTimeFormat.GetDayName(day); } } } } var totalFares = result.Airlines.SelectMany(c => c.Fare).OrderBy(c => c.PriceWithComission); var e2 = t.Elapsed; return(Success(totalFares)); } catch (AwadException e) { return(Error(e.Message)); } }
public ActionResult AddExpense(AmountModel model) { var UserInfo = (Dashboard.Models.UserInfo)Session["UserInfo"]; var ledgerForAccountHolder = ExpenseLedger(model.InsertionTypeId, UserInfo.UserId, model.AmountIn, model.AmountOut, model.AccountHolderId); ledgerProvider.SaveLedger(ledgerForAccountHolder); var trademarkaccountholder = productprovider.gettrademarakaccountholder(UserInfo.TrademarkID); var ledgerFortradeMark = ExpenseLedger(model.InsertionTypeId, UserInfo.UserId, model.AmountOut, model.AmountIn, trademarkaccountholder.Id); ledgerProvider.SaveLedger(ledgerFortradeMark); return(RedirectToAction("AddExpense")); }
public EmpleadosYPromedioViewModel() { Repo = new Repositorio(); ObtenerEmpleados(); CalcularPromerdio = new AmountModel(); }
/// <summary> /// 计算佣金 /// </summary> /// <param name="model">订单对象</param> /// <returns></returns> public AmountModel GetCommission(OrderEntity model) { var con = new CommissionRatioSearchCondition { Page = 1, PageSize = 1 }; //获取佣金分成比例 var commissionRatio = _commissionRatioService.GetCommissionRatioCondition(con) .Select(p => new Models.Trading.CommissionRatio.CommissionRatio { Id = p.Id, RecCfbScale = p.RecCfbScale, RecAgentScale = p.RecAgentScale, TakeCfbScale = p.TakeCfbScale, TakeAgentScale = p.TakeAgentScale, RecPartnerScale = p.RecPartnerScale, TakePartnerScale = p.TakePartnerScale }).FirstOrDefault(); if (commissionRatio == null) { return(null); } var ode = model.OrderDetail; var amount = new AmountModel(); var broker = _brokerService.GetBrokerById(model.AgentId); if (GetPartner(broker.UserId) == null) { switch (model.Ordertype) { case EnumOrderType.推荐订单: //如果是推荐订单; if (model.Shipstatus == 3) { amount.CFBamount = ode.Dealcommission * commissionRatio.RecCfbScale; amount.Agentamount = ode.Dealcommission * commissionRatio.RecAgentScale + ode.RecCommission; } else { amount.Agentamount = ode.RecCommission; } break; case EnumOrderType.带客订单: if (model.Shipstatus == 3) { amount.CFBamount = ode.Dealcommission * commissionRatio.TakeCfbScale; amount.Agentamount = ode.Dealcommission * commissionRatio.TakeAgentScale + ode.Commission; } else { amount.Agentamount = ode.Commission; } break; } } else { switch (model.Ordertype) { case EnumOrderType.推荐订单: //如果是推荐订单; if (model.Shipstatus == 3) { amount.CFBamount = ode.Dealcommission * commissionRatio.RecCfbScale; amount.Agentamount = (ode.Dealcommission * commissionRatio.RecAgentScale - ode.Dealcommission * commissionRatio.RecAgentScale * commissionRatio.RecPartnerScale) + ode.RecCommission; amount.Partneramount = ode.Dealcommission * commissionRatio.RecAgentScale * commissionRatio.RecPartnerScale; } else { amount.Agentamount = ode.RecCommission; } break; case EnumOrderType.带客订单: if (model.Shipstatus == 3) { amount.CFBamount = ode.Dealcommission * commissionRatio.TakeCfbScale; amount.Agentamount = (ode.Dealcommission * commissionRatio.TakeAgentScale - ode.Dealcommission * commissionRatio.TakeAgentScale * commissionRatio.TakePartnerScale) + ode.Commission; amount.Partneramount = ode.Dealcommission * commissionRatio.TakeAgentScale * commissionRatio.TakePartnerScale; } else { amount.Agentamount = ode.Commission; } break; } } return(amount); }
public override int GetHashCode() { int hash = 1; if (Price != 0F) { hash ^= Price.GetHashCode(); } if (Date.Length != 0) { hash ^= Date.GetHashCode(); } if (Datetime.Length != 0) { hash ^= Datetime.GetHashCode(); } if (SendingTime.Length != 0) { hash ^= SendingTime.GetHashCode(); } if (TransactTime.Length != 0) { hash ^= TransactTime.GetHashCode(); } if (Amount != 0F) { hash ^= Amount.GetHashCode(); } if (Towards != 0L) { hash ^= Towards.GetHashCode(); } if (Code.Length != 0) { hash ^= Code.GetHashCode(); } if (User.Length != 0) { hash ^= User.GetHashCode(); } if (Strategy.Length != 0) { hash ^= Strategy.GetHashCode(); } if (Type.Length != 0) { hash ^= Type.GetHashCode(); } if (BidModel.Length != 0) { hash ^= BidModel.GetHashCode(); } if (AmountModel.Length != 0) { hash ^= AmountModel.GetHashCode(); } if (OrderId.Length != 0) { hash ^= OrderId.GetHashCode(); } if (TradeId.Length != 0) { hash ^= TradeId.GetHashCode(); } if (Status.Length != 0) { hash ^= Status.GetHashCode(); } return(hash); }