Example #1
0
        public ActionResult Save(CashVoucherInputModel inputModel)
        {
            inputModel.SchoolId       = CurrentUser.Teacher.Yoh_SchoolId;
            inputModel.SchoolType     = 1;
            inputModel.ExpireType     = (int)ExpireTypeEnum.截止日期;
            inputModel.ApplyScopeType = (int)CashApplyScopeTypeEnum.指定课程;
            inputModel.VoucherType    = (int)VoucherTypeEnum.校区券;
            CashVoucherBll cashVoucherBll = new CashVoucherBll();
            var            request        = inputModel.ConvertTo <DtoCashVoucherRequest>();

            request.Grade      = 0;
            request.CourseType = 0;
            var success = false;

            if (inputModel.Id > 0)
            {
                success = cashVoucherBll.Update(request);
            }
            else
            {
                request.Creator = CurrentUser.Teacher.Yoh_Id;
                request.Editor  = CurrentUser.Teacher.Yoh_Id;
                success         = cashVoucherBll.Add(request) > 0;
            }
            return(SimpleResult(success));
        }
Example #2
0
        public ActionResult UpdateStatus(int id, int status)
        {
            CashVoucherBll cashVoucherBll = new CashVoucherBll();
            var            result         = cashVoucherBll.UpdateStatus(id, status);

            return(SimpleResult(result));
        }
Example #3
0
        /// <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 ActionResult UpdateStatus(int id, int status)
        {
            CashVoucherBll cashVoucherBll = new CashVoucherBll();
            var            result         = cashVoucherBll.UpdateStatus(id, status);

            return(Json(new SuccessJsonResponse(result)));
        }
Example #5
0
        /// <summary>
        /// 领取注册券部分视图
        /// </summary>
        /// <returns></returns>
        public ActionResult GetHaveRegisterVoucherView()
        {
            CashVoucherBll cashVoucherBll     = new CashVoucherBll();
            var            studentCashVoucher = cashVoucherBll.GetHaveRegisterVoucher(GetCurrentUser().StudentId);

            studentCashVoucher = studentCashVoucher.OrderByDescending(s => s.Ycv_Amount).Take(4).ToList();
            return(PartialView(studentCashVoucher));
        }
Example #6
0
        public ActionResult GetCashVoucheres(CashVoucherSearch search)
        {
            CashVoucherBll cashVoucherBll = new CashVoucherBll();
            var            viewModels     = cashVoucherBll.GetPagingCashVoucherForSchool(search.Pagination, search.Id, search.Name, search.Status, search.SchoolId);
            var            table          = AbhsTableFactory.Create(viewModels, search.Pagination.TotalCount);

            return(Json(table, JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public ActionResult GetStudentCashVoucheres(CahsVoucherDetailsSearch search)
        {
            CashVoucherBll cashVoucherBll = new CashVoucherBll();
            var            viewModels     = cashVoucherBll.GetPagingStudentCashVoucher(search.Pagination, search.CashVoucherId, search.Status, search.UsedReferNo);
            var            table          = AbhsTableFactory.Create(viewModels, search.Pagination.TotalCount);

            return(Json(table, JsonRequestBehavior.AllowGet));
        }
Example #8
0
        /// <summary>
        /// 查询课程可使用的所有现金券
        /// </summary>
        /// <param name="studentId"></param>
        /// <param name="schoolId"></param>
        /// <returns></returns>
        public ActionResult GetAllCashVoucher(StudentCashVoucherSearch search)
        {
            CashVoucherBll cashVoucherBll     = new CashVoucherBll();
            var            studentCashVoucher = cashVoucherBll.GetStudentUseCashVoucher(GetCurrentUser().StudentId, search.OrderAmountLimit, search.Grade, search.CourseType, search.CourseId);

            return(Json(new JsonResponse <List <DtoOwnCashVoucher> >()
            {
                Data = studentCashVoucher, State = true
            }, JsonRequestBehavior.AllowGet));
        }
Example #9
0
        /// <summary>
        /// 查询已领取注册券
        /// </summary>
        /// <param name="studentId"></param>
        /// <returns></returns>
        public ActionResult GetHaveRegisterVoucher()
        {
            CashVoucherBll cashVoucherBll     = new CashVoucherBll();
            var            studentCashVoucher = cashVoucherBll.GetHaveRegisterVoucher(GetCurrentUser().StudentId);

            return(Json(new JsonResponse <List <DtoOwnCashVoucher> >()
            {
                Data = studentCashVoucher, State = true
            }, JsonRequestBehavior.AllowGet));
        }
Example #10
0
        /// <summary>
        /// 查询已下单的现金券
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public ActionResult GetCashVoucherByOrderId(int orderId)
        {
            CashVoucherBll cashVoucherBll = new CashVoucherBll();
            var            cashVoucher    = cashVoucherBll.GetCashVoucherByOrderId(GetCurrentUser().StudentId, orderId);

            return(Json(new JsonResponse <List <DtoOwnCashVoucher> >()
            {
                Data = cashVoucher, State = true
            }, JsonRequestBehavior.AllowGet));
        }
Example #11
0
        public ActionResult TakeStudentCashVoucher(StudentCashVoucherInputModel inputModel)
        {
            CashVoucherBll cashVoucherBll     = new CashVoucherBll();
            var            studentCashVoucher = cashVoucherBll.TakeStudentCashVoucher(GetCurrentUser().StudentId, inputModel.CashVoucherId, inputModel.GotType, inputModel.GotReferId);

            return(Json(new JsonResponse <bool>()
            {
                Data = studentCashVoucher, State = true
            }));
        }
Example #12
0
        /// <summary>
        /// 查看—现金券明细
        /// </summary>
        /// <returns></returns>
        public ActionResult CashVoucherDetails(int cashVoucherId = 0)
        {
            if (cashVoucherId == 0)
            {
                return(View());
            }
            CashVoucherBll cashVoucherBll = new CashVoucherBll();
            var            viewModel      = cashVoucherBll.GetCashVoucherDetail(cashVoucherId);

            return(View(viewModel));
        }
        /// <summary>
        /// 注册券
        /// </summary>
        /// <returns></returns>
        public ActionResult RegisterVoucher(int?id)
        {
            if (id == null || id.Value == 0)
            {
                return(View());
            }
            CashVoucherBll cashVoucherBll = new CashVoucherBll();
            var            voucher        = cashVoucherBll.GetVoucherById(id.Value);

            return(View(voucher));
        }
        public ActionResult AddVoucher(CashVoucherInputModel inputModel)
        {
            CashVoucherBll cashVoucherBll = new CashVoucherBll();
            var            request        = inputModel.ConvertTo <DtoCashVoucherRequest>();
            var            result         = 0;

            if (inputModel.Id > 0)
            {
                cashVoucherBll.Update(request);
            }
            else
            {
                request.Creator = CurrentUserID;
                request.Editor  = CurrentUserID;
                result          = cashVoucherBll.Add(request);
            }
            return(Json(new SuccessJsonResponse(result)));
        }