Beispiel #1
0
        public ActionResult Cancel(int id)
        {
            ScholarshipsCancelViewModel ScholarshipVM = new ScholarshipsCancelViewModel();
            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.Qualification = Scholarship.Qualification;
                ScholarshipVM.ScholarshipStartDate = Scholarship.ScholarshipStartDate.Date;
                ScholarshipVM.ScholarshipEndDate   = Scholarship.ScholarshipEndDate.Date;
                ScholarshipVM.ScholarshipPeriod    = Scholarship.ScholarshipPeriod;
                //ScholarshipVM.ScholarshipReason = Scholarship.ScholarshipReason;
            }
            return(View(ScholarshipVM));
        }
Beispiel #2
0
        public ActionResult Cancel(ScholarshipsCancelViewModel 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.ScholarshipStartDate.Value.Date;
            Scholarship.ScholarshipEndDate   = ScholarshipVM.ScholarshipEndDate.Value.Date;
            Scholarship.Notes         = ScholarshipVM.Notes;
            Scholarship.LoginIdentity = this.UserIdentity;
            Result result = Scholarship.Cancel();

            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);
            }
            else
            {
                return(Json(new { ScholarshipID = Scholarship.ScholarshipID }, JsonRequestBehavior.AllowGet));
            }
        }