public ActionResult EditHolidaySetting(HolidaysSettingsViewModel HolidaySettingVM)
        {
            HolidaysSettingsBLL HolidaySetting = new HolidaysSettingsBLL();

            HolidaySetting.HolidaySettingID        = (int)HolidaySettingVM.HolidaySettingID;
            HolidaySetting.HolidaySettingStartDate = (DateTime)HolidaySettingVM.HolidaySettingStartDate;
            HolidaySetting.HolidaySettingEndDate   = (DateTime)HolidaySettingVM.HolidaySettingEndDate;
            HolidaySetting.HolidayType             = HolidaySettingVM.HolidayType;
            HolidaySetting.MaturityYear            = HolidaySettingVM.MaturityYearBalance;
            HolidaySetting.LoginIdentity           = UserIdentity;
            Result result = HolidaySetting.Update();

            if (result.EnumMember == HolidaySettingValidationEnum.RejectedBecauseOfHolidaysDurationShouldBeInTheSameHijriYear.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationHolidaysDurationShouldBeInTheSameHijriYearText);
            }
            if (result.EnumMember == HolidaySettingValidationEnum.RejectedBecauseOfEmployeeAssignToThisHolidaySetting.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationEmployeeAssignToThisHolidaySettingText);
            }
            if (result.EnumMember == HolidaySettingValidationEnum.RejectedBecauseOfConflictWithHolidaySetting.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationConflictWithHolidaySetting);
            }
            HolidaysSettingsBLL HolidaySettingEntity = (HolidaysSettingsBLL)result.Entity;

            return(View(HolidaySettingVM));
        }
        public ActionResult Delete(HolidaysSettingsViewModel HolidaySettingVM)
        {
            HolidaysSettingsBLL HolidaySettingBll = new HolidaysSettingsBLL();

            HolidaySettingBll.LoginIdentity = UserIdentity;
            HolidaySettingBll.Remove((int)HolidaySettingVM.HolidaySettingID);
            return(Json(new { HolidaySettingID = HolidaySettingVM.HolidaySettingID, MaturityYearID = HolidaySettingVM.MaturityYearBalance.MaturityYearID }, JsonRequestBehavior.AllowGet));
        }
        private HolidaysSettingsViewModel GetByHolidaySettingID(int id)
        {
            HolidaysSettingsBLL       HolidaySettingBLL = new HolidaysSettingsBLL().GetByHolidaySettingID(id);
            HolidaysSettingsViewModel HolidaySettingVM  = new HolidaysSettingsViewModel();

            if (HolidaySettingBLL != null)
            {
                HolidaySettingVM.HolidaySettingID        = HolidaySettingBLL.HolidaySettingID;
                HolidaySettingVM.HolidaySettingStartDate = HolidaySettingBLL.HolidaySettingStartDate.Date;
                HolidaySettingVM.HolidaySettingEndDate   = HolidaySettingBLL.HolidaySettingEndDate;
                HolidaySettingVM.HolidaySettingPeriod    = HolidaySettingBLL.HolidaySettingPeriod;
                HolidaySettingVM.MaturityYearBalance     = HolidaySettingBLL.MaturityYear;
                HolidaySettingVM.HolidayType             = HolidaySettingBLL.HolidayType;
                HolidaySettingVM.CreatedDate             = HolidaySettingBLL.CreatedDate;
                HolidaySettingVM.CreatedBy = HolidaySettingVM.GetCreatedByDisplayed(HolidaySettingBLL.CreatedBy);
            }
            return(HolidaySettingVM);
        }
        public ActionResult Create(HolidaysSettingsViewModel HolidaySettingVM)
        {
            //--== HolidaySetting Master DataBind ===
            HolidaysSettingsBLL HolidaySetting = new HolidaysSettingsBLL();

            HolidaySetting.HolidaySettingEndDate   = (DateTime)HolidaySettingVM.HolidaySettingEndDate;
            HolidaySetting.HolidaySettingStartDate = (DateTime)HolidaySettingVM.HolidaySettingStartDate;
            HolidaySetting.MaturityYear            = HolidaySettingVM.MaturityYearBalance;
            HolidaySetting.HolidayType             = HolidaySettingVM.HolidayType;
            HolidaySetting.LoginIdentity           = UserIdentity;
            Result result = HolidaySetting.Add();

            if (result.EnumMember == HolidaySettingValidationEnum.RejectedBecauseOfHolidaysDurationShouldBeInTheSameHijriYear.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationHolidaysDurationShouldBeInTheSameHijriYearText);
            }

            if (result.EnumMember == HolidaySettingValidationEnum.RejectedBecauseOfConflictWithHolidaySetting.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationConflictWithHolidaySetting);
            }
            return(Json(new { HolidaySettingID = HolidaySetting.HolidaySettingID, MaturityYearID = HolidaySetting.MaturityYear.MaturityYearID }, JsonRequestBehavior.AllowGet));
        }