private InternshipScholarshipsViewModel GetByInternshipScholarshipID(int id)
        {
            BaseInternshipScholarshipsBLL   InternshipScholarshipBLL = new BaseInternshipScholarshipsBLL().GetByInternshipScholarshipID(id);
            InternshipScholarshipsViewModel InternshipScholarshipVM  = new InternshipScholarshipsViewModel();

            if (InternshipScholarshipBLL != null)
            {
                if (InternshipScholarshipBLL.InternshipScholarshipType.InternshipScholarshipTypeID == (Int32)InternshipScholarshipsTypesEnum.Internal)
                {
                    InternshipScholarshipVM.KSARegion = ((InternalInternshipScholarshipsBLL)InternshipScholarshipBLL).KSACity.KSARegion;
                    InternshipScholarshipVM.KSACity   = ((InternalInternshipScholarshipsBLL)InternshipScholarshipBLL).KSACity;
                }
                else if (InternshipScholarshipBLL.InternshipScholarshipType.InternshipScholarshipTypeID == (Int32)InternshipScholarshipsTypesEnum.External)
                {
                    InternshipScholarshipVM.Country = ((ExternalInternshipScholarshipsBLL)InternshipScholarshipBLL).Country;
                }

                InternshipScholarshipVM.InternshipScholarshipType = new InternshipScholarshipsTypesBLL()
                {
                    InternshipScholarshipTypeID = InternshipScholarshipBLL.InternshipScholarshipType.InternshipScholarshipTypeID, InternshipScholarshipTypeName = InternshipScholarshipBLL.InternshipScholarshipType.InternshipScholarshipTypeName
                };
                InternshipScholarshipVM.InternshipScholarshipID        = InternshipScholarshipBLL.InternshipScholarshipID;
                InternshipScholarshipVM.InternshipScholarshipStartDate = InternshipScholarshipBLL.InternshipScholarshipStartDate.Date;
                InternshipScholarshipVM.InternshipScholarshipEndDate   = InternshipScholarshipBLL.InternshipScholarshipEndDate;
                InternshipScholarshipVM.InternshipScholarshipReason    = InternshipScholarshipBLL.InternshipScholarshipReason;
                InternshipScholarshipVM.InternshipScholarshipPeriod    = InternshipScholarshipBLL.InternshipScholarshipPeriod;
                InternshipScholarshipVM.InternshipScholarshipLocation  = InternshipScholarshipBLL.InternshipScholarshipLocation;
                InternshipScholarshipVM.CreatedDate = InternshipScholarshipBLL.CreatedDate;
                InternshipScholarshipVM.CreatedBy   = InternshipScholarshipVM.GetCreatedByDisplayed(InternshipScholarshipBLL.CreatedBy);
            }
            return(InternshipScholarshipVM);
        }
        public ActionResult Delete(InternshipScholarshipsViewModel InternshipScholarshipVM)
        {
            BaseInternshipScholarshipsBLL baseInternshipScholarshipsBLL = new BaseInternshipScholarshipsBLL();

            baseInternshipScholarshipsBLL.LoginIdentity = UserIdentity;
            baseInternshipScholarshipsBLL.Remove(InternshipScholarshipVM.InternshipScholarshipID);
            //return View(InternshipScholarshipVM);
            return(RedirectToAction("Index"));
        }
        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));
        }