public JsonResult SaveCommission(FormCollection fc) { CommissionRate cr = new CommissionRate(); string details = fc.Get("commissionRateDetails"); SomeUtils.SetFieldValueToModel(fc, cr); cr.CommissionRateDetail.AddRange(JsonConvert.DeserializeObject <List <CommissionRateDetail> >(fc.Get("commissionRateDetails"))); if (cr.id == 0) { cr.create_date = DateTime.Now; } cr.update_date = DateTime.Now; cr.user_name = currentUser.realName; string result = new CommissionSv().SaveCommission(cr, currentUser.userId); if (!string.IsNullOrEmpty(result)) { return(Json(new ResultModel() { suc = false, msg = result }, "text/html")); } return(Json(new ResultModel() { suc = true, msg = "保存成功" }, "text/html")); }
public ActionResult UpdateCommission(int id) { CommissionRate cr = new CommissionSv().GetSinggleCommission(id); ViewData["commission"] = cr; ViewData["commissionDetails"] = cr.CommissionRateDetail.OrderBy(c => c.MU).ToList(); return(View("CreateCommission")); }
public JsonResult RemoveCommission(int id) { string result = new CommissionSv().RemoveCommission(id, currentUser.userId); if (!string.IsNullOrEmpty(result)) { return(Json(new ResultModel() { suc = false, msg = result })); } return(Json(new ResultModel() { suc = true })); }
public JsonResult GetMUAndCommisson(decimal dealPrice, decimal cost, int taxRate, int feeRate, decimal exchangeRate, string productType, decimal qty, decimal unitPrice) { MUAndCommissionModel mc = new MUAndCommissionModel(); CommissionSv csv = new CommissionSv(); mc.MU = csv.GetMU(dealPrice, cost, taxRate, feeRate, exchangeRate); mc.commissionRate = csv.GetCommissionRate(mc.MU, productType); if (mc.commissionRate == -1) { return(Json(new ResultModel() { suc = false, msg = "佣金率没有维护,请联系电子市场部" })); } mc.commission = csv.GetCommissionMoney(unitPrice, qty, mc.commissionRate); return(Json(new ResultModel() { suc = true, extra = mc })); }