public ActionResult Create(InternshipScholarshipsViewModel InternshipScholarshipVM) { if (InternshipScholarshipVM.InternshipScholarshipType.InternshipScholarshipTypeID == (Int32)InternshipScholarshipsTypesEnum.Internal) { InternalInternshipScholarshipsBLL InternshipScholarship = new InternalInternshipScholarshipsBLL(); InternshipScholarship.InternshipScholarshipType = new InternshipScholarshipsTypesBLL() { InternshipScholarshipTypeID = (int)InternshipScholarshipsTypesEnum.Internal }; InternshipScholarship.InternshipScholarshipStartDate = InternshipScholarshipVM.InternshipScholarshipStartDate; InternshipScholarship.InternshipScholarshipEndDate = InternshipScholarshipVM.InternshipScholarshipEndDate; InternshipScholarship.InternshipScholarshipReason = InternshipScholarshipVM.InternshipScholarshipReason; InternshipScholarship.KSACity = new KSACitiesBLL() { KSACityID = InternshipScholarshipVM.KSACity.KSACityID }; InternshipScholarship.InternshipScholarshipLocation = InternshipScholarshipVM.InternshipScholarshipLocation; InternshipScholarship.LoginIdentity = UserIdentity; InternshipScholarship.InternshipScholarshipsDetails = GetInternshipScholarshipDetailsFromSession(); Result result = InternshipScholarship.Add(); BaseInternshipScholarshipsBLL InternshipScholarshipEntity = (BaseInternshipScholarshipsBLL)result.Entity; if (result.EnumMember == InternshipScholarshipsValidationEnum.Done.ToString()) { InternshipScholarshipVM.InternshipScholarshipID = ((InternalInternshipScholarshipsBLL)result.Entity).InternshipScholarshipID; //Session["InternshipScholarshipID"] = ((InternalInternshipScholarshipsBLL)result.Entity).InternshipScholarshipID; ClearInternshipScholarshipDetailsFromSession(); } else if (result.EnumMember == InternshipScholarshipsValidationEnum.RejectedBecauseEmployeeRequired.ToString()) { throw new CustomException(Resources.Globalization.ValidationEmployeeRequiredText); } Classes.Helpers.CommonHelper.ConflictValidationMessage(result); //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithOverTime.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithOverTimeText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithDelegation.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithDelegationText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithInternshipScholarship.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithInternshipScholarshipText); //} } else if (InternshipScholarshipVM.InternshipScholarshipType.InternshipScholarshipTypeID == (Int32)InternshipScholarshipsTypesEnum.External) { ExternalInternshipScholarshipsBLL InternshipScholarship = new ExternalInternshipScholarshipsBLL(); InternshipScholarship.InternshipScholarshipType = new InternshipScholarshipsTypesBLL() { InternshipScholarshipTypeID = (int)InternshipScholarshipsTypesEnum.External }; InternshipScholarship.InternshipScholarshipStartDate = InternshipScholarshipVM.InternshipScholarshipStartDate; InternshipScholarship.InternshipScholarshipEndDate = InternshipScholarshipVM.InternshipScholarshipEndDate; InternshipScholarship.InternshipScholarshipReason = InternshipScholarshipVM.InternshipScholarshipReason; InternshipScholarship.InternshipScholarshipLocation = InternshipScholarshipVM.InternshipScholarshipLocation; InternshipScholarship.LoginIdentity = UserIdentity; InternshipScholarship.Country = new CountriesBLL() { CountryID = InternshipScholarshipVM.Country.CountryID }; InternshipScholarship.InternshipScholarshipsDetails = GetInternshipScholarshipDetailsFromSession(); Result result = InternshipScholarship.Add(); BaseInternshipScholarshipsBLL InternshipScholarshipEntity = (BaseInternshipScholarshipsBLL)result.Entity; if (result.EnumMember == InternshipScholarshipsValidationEnum.Done.ToString()) { InternshipScholarshipVM.InternshipScholarshipID = ((ExternalInternshipScholarshipsBLL)result.Entity).InternshipScholarshipID; //Session["InternshipScholarshipID"] = ((ExternalInternshipScholarshipsBLL)result.Entity).InternshipScholarshipID; ClearInternshipScholarshipDetailsFromSession(); } else if (result.EnumMember == InternshipScholarshipsValidationEnum.RejectedBecauseEmployeeRequired.ToString()) { throw new CustomException(Resources.Globalization.ValidationEmployeeRequiredText); } Classes.Helpers.CommonHelper.ConflictValidationMessage(result); //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithOverTime.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithOverTimeText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithDelegation.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithDelegationText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithInternshipScholarship.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithInternshipScholarshipText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithVacation.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithVacationText); //} } //return View(InternshipScholarshipVM); return(Json(new { InternshipScholarshipID = InternshipScholarshipVM.InternshipScholarshipID }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetInternshipScholarships() { BaseInternshipScholarshipsBLL InternshipScholarshipBLL = new InternalInternshipScholarshipsBLL(); return(Json(new { data = InternshipScholarshipBLL.GetInternshipScholarships() }, JsonRequestBehavior.AllowGet)); }