public HttpResponseMessage RemoveEmployeeFromDB(int id)
        {
            InternshipScholarshipsDetailsBLL internshipScholarshipsDetailsBLL = new InternshipScholarshipsDetailsBLL();

            internshipScholarshipsDetailsBLL.LoginIdentity = UserIdentity;
            internshipScholarshipsDetailsBLL.Remove(id);
            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
Example #2
0
        public static InternshipScholarshipsViewModel GetInternshipScholarshipDetail(this InternshipScholarshipsDetailsViewModel InternshipScholarshipVM)
        {
            InternshipScholarshipsDetailsBLL InternshipScholarshipDetailBLL = new InternshipScholarshipsDetailsBLL().GetInternshipScholarshipsDetailsByInternshipScholarshipDetailID(InternshipScholarshipVM.InternshipScholarshipDetailID.Value);

            return(new InternshipScholarshipsViewModel()
            {
                InternshipScholarshipStartDate = InternshipScholarshipDetailBLL.InternshipScholarship.InternshipScholarshipStartDate,
                InternshipScholarshipEndDate = InternshipScholarshipDetailBLL.InternshipScholarship.InternshipScholarshipEndDate,
                InternshipScholarshipType = InternshipScholarshipDetailBLL.InternshipScholarship.InternshipScholarshipType,
                InternshipScholarshipLocation = InternshipScholarshipDetailBLL.InternshipScholarship.InternshipScholarshipLocation,
                InternshipScholarshipReason = InternshipScholarshipDetailBLL.InternshipScholarship.InternshipScholarshipReason,
                InternshipScholarshipDetailRequest = InternshipScholarshipDetailBLL,
            });
        }
        public HttpResponseMessage CreateInternshipScholarshipDetailDB(InternshipScholarshipsViewModel InternshipScholarshipVM)
        {
            if (string.IsNullOrEmpty(InternshipScholarshipVM.InternshipScholarshipDetailRequest.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo))
            {
                throw new CustomException(Resources.Globalization.RequiredEmployeeCodeNoText);
            }

            Result result = new InternshipScholarshipsDetailsBLL().Add(new InternshipScholarshipsDetailsBLL()
            {
                LoginIdentity = new EmployeesCodesBLL()
                {
                    EmployeeCodeID = int.Parse(Session["EmployeeCodeID"].ToString())
                },
                EmployeeCareerHistory = InternshipScholarshipVM.InternshipScholarshipDetailRequest.EmployeeCareerHistory,
                //EmployeeCode = InternshipScholarshipVM.InternshipScholarshipDetailRequest.EmployeeCareerHistory.EmployeeCode,
                InternshipScholarship = new BaseInternshipScholarshipsBLL()
                {
                    InternshipScholarshipID        = InternshipScholarshipVM.InternshipScholarshipID,
                    InternshipScholarshipStartDate = InternshipScholarshipVM.InternshipScholarshipStartDate,
                    InternshipScholarshipEndDate   = InternshipScholarshipVM.InternshipScholarshipEndDate,
                    InternshipScholarshipLocation  = InternshipScholarshipVM.InternshipScholarshipLocation,
                    InternshipScholarshipReason    = InternshipScholarshipVM.InternshipScholarshipReason,
                },
                IsPassengerOrderCompensation = InternshipScholarshipVM.InternshipScholarshipDetailRequest.IsPassengerOrderCompensation
            });

            if (result.EnumMember == InternshipScholarshipsValidationEnum.RejectedBecauseAlreadyExist.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationEmployeeAlreadyExistText);
            }
            //else if (result.EnumMember == InternshipScholarshipsValidationEnum.RejectedBecauseOfMaxLimit.ToString())
            //{
            //    throw new CustomException(Resources.Globalization.ValidationAlreadyReachTheInternshipScholarshipLimitText);
            //}
            //else if (result.EnumMember == InternshipScholarshipsValidationEnum.RejectedBecauseOfConflictWithOverTime.ToString())
            //{
            //    throw new CustomException(Resources.Globalization.ValidationInternshipScholarshipConflictWithOverTimeText);
            //}
            //else if (result.EnumMember == InternshipScholarshipsValidationEnum.RejectedBecauseOfConflictWithInternshipScholarship.ToString())
            //{
            //    throw new CustomException(Resources.Globalization.ValidationInternshipScholarshipConflictWithInternshipScholarshipText);
            //}

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }