public HttpResponseMessage RemoveEmployeeFromDB(int id) { DelegationsDetailsBLL delegationsDetailsBLL = new DelegationsDetailsBLL(); delegationsDetailsBLL.LoginIdentity = UserIdentity; delegationsDetailsBLL.Remove(id); return(new HttpResponseMessage(HttpStatusCode.OK)); }
public HttpResponseMessage CreateDelegationDetailDB(DelegationsViewModel DelegationVM) { if (string.IsNullOrEmpty(DelegationVM.DelegationDetailRequest.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo)) { throw new CustomException(Resources.Globalization.RequiredEmployeeCodeNoText); } Result result = new DelegationsDetailsBLL().Add(new DelegationsDetailsBLL() { LoginIdentity = UserIdentity, EmployeeCareerHistory = DelegationVM.DelegationDetailRequest.EmployeeCareerHistory, Delegation = new BaseDelegationsBLL() { DelegationID = DelegationVM.DelegationID, DelegationStartDate = DelegationVM.DelegationStartDate, DelegationEndDate = DelegationVM.DelegationEndDate, DelegationKind = new DelegationsKindsBLL() { DelegationKindID = DelegationVM.DelegationKind.DelegationKindID } }, IsPassengerOrderCompensation = DelegationVM.DelegationDetailRequest.IsPassengerOrderCompensation }); //result = new EmployeeDelegationBLL(StartDate, EndDate, DelegationVM.DelegationKind.DelegationKindID, new EmployeesCodesBLL() { EmployeeCodeID = DelegationVM.DelegationDetailRequest.EmployeeCode.EmployeeCodeID }).IsValid(); //if ((System.Type)result.EnumType == typeof(DelegationsValidationEnum)) //{ if (result.EnumMember == DelegationsValidationEnum.RejectedBecauseAlreadyExist.ToString()) { throw new CustomException(Resources.Globalization.ValidationEmployeeAlreadyExistText); } else if (result.EnumMember == DelegationsValidationEnum.RejectedBecauseOfMaxLimit.ToString()) { throw new CustomException(Resources.Globalization.ValidationAlreadyReachTheDelegationLimitText); } 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(new HttpResponseMessage(HttpStatusCode.OK)); }
public static DelegationsViewModel GetDelegationDetail(this DelegationsDetailsViewModel DelagationVM) { DelegationsDetailsBLL DelegationDetailBLL = new DelegationsDetailsBLL().GetDelegationsDetailsByDelegationDetailID(DelagationVM.DelegationDetailID.Value); return(new DelegationsViewModel() { DelegationStartDate = DelegationDetailBLL.Delegation.DelegationStartDate, DelegationEndDate = DelegationDetailBLL.Delegation.DelegationEndDate, DelegationKind = DelegationDetailBLL.Delegation.DelegationKind, DelegationType = DelegationDetailBLL.Delegation.DelegationType, DelegationDestination = DelegationDetailBLL.Delegation.DelegationDestination, DelegationReason = DelegationDetailBLL.Delegation.DelegationReason, DelegationDetailRequest = DelegationDetailBLL, }); }