public ActionResult Create(PromotionsPeriodsViewModel PromotionPeriodVM) { PromotionsPeriodsBLL PromotionPeriod = new PromotionsPeriodsBLL(); PromotionPeriod.Year = new MaturityYearsBalancesBLL() { MaturityYearID = PromotionPeriodVM.YearID }; PromotionPeriod.Period = new PeriodsBLL() { PeriodID = PromotionPeriodVM.PeriodID }; //QualificationsDegreesVM.QualificationDegreeName; PromotionPeriod.PromotionStartDate = PromotionPeriodVM.PromotionStartDate; PromotionPeriod.PromotionEndDate = PromotionPeriodVM.PromotionEndDate; PromotionPeriod.IsActive = PromotionPeriodVM.IsActive; PromotionPeriod.LoginIdentity = UserIdentity; Result result = PromotionPeriod.Add(); if (result.EnumMember == PromotionsPeriodsValidationEnum.Done.ToString()) { } else if (result.EnumMember == PromotionsPeriodsValidationEnum.RejectedBecauseOfPromotionStartDateIsGreaterThenPromotionEndDate.ToString()) { throw new CustomException(Resources.Globalization.ValidationPromotionStartDateIsGreaterThenPromotionEndDateText); } else if (result.EnumMember == PromotionsPeriodsValidationEnum.RejectedBecauseOfAlreadyOnePromotionPeriodIsActive.ToString()) { throw new CustomException(Resources.Globalization.ValidationAlreadyOnePromotionPeriodIsActiveText); } else if (result.EnumMember == PromotionsPeriodsValidationEnum.RejectedBecauseOfPromotionRecordExistWithThisPromotiosPeriodDates.ToString()) { throw new CustomException(Resources.Globalization.ValidationPromotionRecordExistWithThesePromotiosPeriodDatesText); } return(Json(new { PromotionPeriodID = PromotionPeriod.PromotionPeriodID }, JsonRequestBehavior.AllowGet)); }
public ActionResult Delete(PromotionsPeriodsViewModel PromotionPeriodVM) { PromotionsPeriodsBLL PromotionPeriod = new PromotionsPeriodsBLL(); PromotionPeriod.PromotionPeriodID = PromotionPeriodVM.PromotionPeriodID; PromotionPeriod.LoginIdentity = UserIdentity; Result result = PromotionPeriod.Remove(PromotionPeriod.PromotionPeriodID); if (result.EnumMember == PromotionsPeriodsValidationEnum.Done.ToString()) { } return(Json(new { PromotionPeriodID = PromotionPeriod.PromotionPeriodID }, JsonRequestBehavior.AllowGet)); }
private PromotionsPeriodsViewModel GetByPromotionPeriodID(int id) { PromotionsPeriodsBLL PromotionPeriod = new PromotionsPeriodsBLL().GetByPromotionPeriodID(id); PromotionsPeriodsViewModel PromotionPeriodVM = new PromotionsPeriodsViewModel(); if (PromotionPeriod != null) { PromotionPeriodVM.PromotionPeriodID = PromotionPeriod.PromotionPeriodID; PromotionPeriodVM.YearID = PromotionPeriod.Year.MaturityYearID; PromotionPeriodVM.PeriodID = PromotionPeriod.Period.PeriodID; PromotionPeriodVM.MaturityYear = PromotionPeriod.Year.MaturityYear; PromotionPeriodVM.PeriodName = PromotionPeriod.Period.PeriodName; PromotionPeriodVM.PromotionStartDate = PromotionPeriod.PromotionStartDate; PromotionPeriodVM.PromotionEndDate = PromotionPeriod.PromotionEndDate; PromotionPeriodVM.IsActive = PromotionPeriod.IsActive.Value; } return(PromotionPeriodVM); }