Esempio n. 1
0
        public ActionResult Extend(ScholarshipsExtentionViewModel ScholarshipVM)
        {
            BaseScholarshipsBLL Scholarship = null;

            if (ScholarshipVM.ScholarshipTypeID == (int)ScholarshipsTypesEnum.Internal)
            {
                Scholarship = GenericFactoryPattern <BaseScholarshipsBLL, InternalScholarshipsBLL> .CreateInstance();
            }
            else if (ScholarshipVM.ScholarshipTypeID == (int)ScholarshipsTypesEnum.External)
            {
                Scholarship = GenericFactoryPattern <BaseScholarshipsBLL, ExternalScholarshipsBLL> .CreateInstance();
            }

            Scholarship.ScholarshipID        = ScholarshipVM.ScholarshipID;
            Scholarship.ScholarshipStartDate = ScholarshipVM.FromDate.Value.Date;
            Scholarship.ScholarshipEndDate   = ScholarshipVM.ToDate.Value.Date;
            Scholarship.Notes         = ScholarshipVM.Notes;
            Scholarship.LoginIdentity = this.UserIdentity;
            Result result = Scholarship.Extend();

            if (result.EnumMember == ScholarshipsValidationEnum.RejectedBecauseOfAlreadyCanceled.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationScholarshipsAlreadyCanceledText);
            }
            else if (result.EnumMember == ScholarshipsValidationEnum.RejectedBecauseOfAlreadyPassed.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationScholarshipsAlreadyPassedText);
            }
            else if (result.EnumMember == ScholarshipsValidationEnum.RejectedBecauseOfAlreadyJoinedBefore.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationScholarshipsAlreadyJoinedDateText);
            }

            Classes.Helpers.CommonHelper.ConflictValidationMessage(result);

            return(Json(new { ScholarshipID = Scholarship.ScholarshipID }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult Extend(int id)
        {
            ScholarshipsExtentionViewModel ScholarshipVM = new ScholarshipsExtentionViewModel();
            BaseScholarshipsBLL            Scholarship   = this.GetByScholarshipID(id);

            if (Scholarship != null && Scholarship.ScholarshipID > 0)
            {
                Scholarship = Scholarship.GetByScholarshipID(id);
                ScholarshipVM.ScholarshipTypeID = (int)Scholarship.ScholarshipTypeEnum;
                if ((int)Scholarship.ScholarshipTypeEnum == (Int16)ScholarshipsTypesEnum.External)
                {
                    ScholarshipVM.Country = ((ExternalScholarshipsBLL)Scholarship).Country;
                }
                if ((int)Scholarship.ScholarshipTypeEnum == (Int16)ScholarshipsTypesEnum.Internal)
                {
                    ScholarshipVM.KSACity = ((InternalScholarshipsBLL)Scholarship).KSACity;
                }
                ScholarshipVM.ScholarshipID = Scholarship.ScholarshipID;
                ScholarshipVM.FromDate      = Scholarship.ScholarshipEndDate.AddDays(1);
                ScholarshipVM.ToDate        = null;
            }

            return(View(ScholarshipVM));
        }