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); } }
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; } } }
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())); }
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); }
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 }); }
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); } }
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; } } }