Example #1
0
        private void SaveIntroduction(
            DtoCoursePricing price,
            int currentUser)
        {
            bool exist        = false;
            var  introduction = CourseIntroductionRespository.GetCourseIntroduction(
                price.CourseId);

            if (introduction != null)
            {
                introduction.EnableAudit();
                exist = true;
            }
            else
            {
                introduction = new Yw_CourseIntroduction();
                introduction.Yci_CourseId   = price.CourseId;
                introduction.Yci_CreateTime = Clock.Now;
                introduction.Yci_Creator    = currentUser;
            }

            introduction.Yci_Introduction = price.Introduction;
            introduction.Yci_Arrange      = price.Arrange;
            introduction.Yci_Editor       = currentUser;
            introduction.Yci_UpdateTime   = Clock.Now;
            if (exist)
            {
                CourseIntroductionRespository.Update(introduction);
            }
            else
            {
                CourseIntroductionRespository.Insert(introduction);
            }
        }
Example #2
0
        public void UpdateStatus(
            int courseId,
            CourseStatusEnum status,
            CourseActionEnum action,
            int currentUser)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    var pricing = new DtoCoursePricing
                    {
                        CourseId   = courseId,
                        NextStatus = status
                    };
                    UpdateProcess(pricing, currentUser, action);
                    UpdateStatus(pricing, currentUser);

                    scope.Complete();
                }
                catch
                {
                    RollbackTran();
                    throw;
                }
            }
        }
Example #3
0
 private void SaveAllPrice(DtoCoursePricing price, int currentUser)
 {
     if (price.Pricings != null)
     {
         foreach (var pricing in price.Pricings)
         {
             SavePrice(price.CourseId, pricing.Price, pricing.SchoolLevelId, currentUser);
         }
     }
 }
        public ActionResult Pricing(CoursePricingInputModel input)
        {
            CourseBll bll = new CourseBll();

            input.CoverIamge = UeditorContentFactory.FetchUrl(
                input.CoverIamge, UeditorType.Image);
            DtoCoursePricing price = input.ConvertTo <DtoCoursePricing>();

            bll.Pricing(price, CurrentUserID);
            return(Json(new SuccessJsonResponse()));
        }
Example #5
0
        public void CourseBll_Pricing_ShouldSuccess2()
        {
            var price = new DtoCoursePricing
            {
                Arrange      = "arrange" + Clock.Now.ToString(),
                CourseId     = 20000,
                Introduction = "Introduction" + Clock.Now.ToString(),
                NextStatus   = CourseStatusEnum.待上架,
                Pricings     = new List <DtoPricing>(),
                Sort         = 2
            };

            bll.Pricing(price, 10000);
        }
Example #6
0
 private void UpdateProcess(
     DtoCoursePricing price,
     int currentUser,
     CourseActionEnum action)
 {
     CourseProcessRepository.Insert(new Yw_CourseProcess
     {
         Ycp_CourseId   = price.CourseId,
         Ycp_Action     = (int)action,
         Ycp_Status     = (int)price.NextStatus,
         Ycp_Operator   = currentUser,
         Ycp_Remark     = "",
         Ycp_CreateTime = Clock.Now
     });
 }
Example #7
0
        private void UpdateStatus(DtoCoursePricing price, int currentUser)
        {
            var course = CourseRepository.GetCourse(price.CourseId);

            if (course == null)
            {
                throw new AbhsException(
                          ErrorCodeEnum.NotFoundEntity,
                          AbhsErrorMsg.NotFoundEntity);
            }
            else
            {
                course.EnableAudit();
                course.Ycs_Status     = (int)price.NextStatus;
                course.Ycs_UpdateTime = Clock.Now;
                course.Ycs_Editor     = currentUser;
                CourseRepository.Update(course);
            }
        }
Example #8
0
        public void Pricing(DtoCoursePricing price, int currentUser)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    SaveAllPrice(price, currentUser);
                    SaveIntroduction(price, currentUser);
                    UpdateProcess(price, currentUser, CourseActionEnum.定价);
                    UpdateStatus(price, currentUser);

                    scope.Complete();
                }
                catch
                {
                    RollbackTran();
                    throw;
                }
            }
        }