/// <summary> /// 编辑 /// </summary> /// <returns></returns> public ActionResult Edit(int id = 0) { if (id > 0)//禁止编辑 { return(RedirectToAction("Index")); } CashVoucherBll cashVoucherBll = new CashVoucherBll(); CourseBll bll = new CourseBll(); DtoCashVoucher voucher = new DtoCashVoucher(); decimal CashVoucherLimit = -1; if (id > 0) { voucher = cashVoucherBll.GetVoucherById(id); if (voucher != null) { var priceModel = bll.GetCoursePrice(voucher.Ycv_CourseId, CurrentUser.School.Bsl_Level); if (priceModel != null) { CashVoucherLimit = Math.Floor(priceModel.Yce_Price * (100 - CurrentUser.School.Bhl_DividePercent) / 100); } } } ViewBag.CashVoucherLimit = CashVoucherLimit; ViewBag.DividePercent = CurrentUser.School.Bhl_DividePercent; return(View(voucher)); }
public DtoCashVoucherRequest(DtoCashVoucher dbModel) { if (dbModel != null) { this.Name = dbModel.Ycv_Name; this.VoucherType = dbModel.Ycv_VoucherType; this.SchoolId = dbModel.Ycv_SchoolId; this.PublishCount = dbModel.Ycv_PublishCount; this.Amount = dbModel.Ycv_Amount; this.LimitByPerson = dbModel.Ycv_LimitByPerson; this.OrderAmountLimit = dbModel.Ycv_OrderAmountLimit._ToInt32(); this.ExpireType = dbModel.Ycv_ExpireType; this.ExpireDate = dbModel.Ycv_ExpireDate; this.ExpireDay = dbModel.Ycv_ExpireDayCount; this.ApplyScopeType = dbModel.Ycv_ApplyScopeType; this.Grade = dbModel.Ycv_ApplyGrade; this.CourseType = dbModel.Ycv_CourseType; this.CourseId = dbModel.Ycv_CourseId; this.RelatedCourseId = dbModel.Ycv_RelatedCourseId; this.UseWithVoucherType = dbModel.Ycv_UseWithVoucherType; this.Remark = dbModel.Ycv_Remark; this.CreateTime = dbModel.Ycv_CreateTime; this.Creator = dbModel.Ycv_Creator; this.UpdateTime = dbModel.Ycv_UpdateTime; this.Editor = dbModel.Ycv_Editor; } }