示例#1
0
        public HttpResponseMessage AddEndOfServiceVacations(EndOfServicesViewModel EndOfServiceVM)
        {
            EndOfServicesVacationsBLL EndOfServiceVacation = new EndOfServicesVacationsBLL()
            {
                EndOfService = new EndOfServicesBLL()
                {
                    EndOfServiceID = EndOfServiceVM.EndOfServiceID
                },
                VacationStartDate = (DateTime)EndOfServiceVM.EndOfServiceVacationStartDate,
                VacationEndDate   = (DateTime)EndOfServiceVM.EndOfServiceVacationEndDate,
                VacationType      = EndOfServiceVM.EndOfServiceVacationType,
                LoginIdentity     = UserIdentity
            };

            Result result = EndOfServiceVacation.Add();

            if ((System.Type)result.EnumType == typeof(EndOfServicesVacationsValidationEnum))
            {
                if (result.EnumMember == EndOfServicesVacationsValidationEnum.RejectedBecauseOfVacationEndDateBiggerThanEndOfServiceDate.ToString())
                {
                    throw new CustomException(Resources.Globalization.ValidationVacationStartDateBiggerThanEndOfServiceDateText);
                }
            }
            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
示例#2
0
        private EndOfServicesViewModel GetByEndOfServiceID(int id)
        {
            EndOfServicesBLL       EndOfServiceBLL = new EndOfServicesBLL().GetByEndOfServiceID(id);
            EndOfServicesViewModel EndOfServiceVM  = new EndOfServicesViewModel();

            if (EndOfServiceBLL != null)
            {
                EndOfServiceVM.EndOfServiceID           = EndOfServiceBLL.EndOfServiceID;
                EndOfServiceVM.EmployeeCareerHistoryID  = EndOfServiceBLL.EmployeeCareerHistory.EmployeeCareerHistoryID;
                EndOfServiceVM.EndOfServiceDate         = EndOfServiceBLL.EndOfServiceDate.Date;
                EndOfServiceVM.EndOfServiceDecisionNo   = EndOfServiceBLL.EndOfServiceDecisionNo;
                EndOfServiceVM.EndOfServiceDecisionDate = EndOfServiceBLL.EndOfServiceDecisionDate.Date;
                EndOfServiceVM.EndOfServiceReasonID     = EndOfServiceBLL.EndOfServiceReason.EndOfServiceReasonID;
                EndOfServiceVM.EndOfServiceReason       = EndOfServiceBLL.EndOfServiceReason;
                EndOfServiceVM.EndOfServiceCaseID       = EndOfServiceBLL.EndOfServiceReason.EndOfServiceCase.EndOfServiceCaseID;

                EndOfServiceVM.EmployeeVM = new EmployeesViewModel()
                {
                    EmployeeCareerHistoryID = EndOfServiceBLL.EmployeeCareerHistory.EmployeeCareerHistoryID,
                    EmployeeCodeID          = EndOfServiceBLL.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID,
                    EmployeeCodeNo          = EndOfServiceBLL.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo,
                    EmployeeNameAr          = EndOfServiceBLL.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeNameAr
                };

                EndOfServiceVM.CreatedDate = EndOfServiceBLL.CreatedDate;
                EndOfServiceVM.CreatedBy   = EndOfServiceVM.GetCreatedByDisplayed(EndOfServiceBLL.CreatedBy);
            }
            return(EndOfServiceVM);
        }
示例#3
0
        public ActionResult Edit(EndOfServicesViewModel EndOfServicesVM)
        {
            EndOfServicesBLL EndOfServiceBLL = new EndOfServicesBLL();

            EndOfServiceBLL.EndOfServiceID           = EndOfServicesVM.EndOfServiceID;
            EndOfServiceBLL.EndOfServiceDate         = EndOfServicesVM.EndOfServiceDate;
            EndOfServiceBLL.EndOfServiceDecisionNo   = EndOfServicesVM.EndOfServiceDecisionNo;
            EndOfServiceBLL.EndOfServiceDecisionDate = EndOfServicesVM.EndOfServiceDecisionDate;
            EndOfServiceBLL.EndOfServiceReason       = new EndOfServicesReasonsBLL()
            {
                EndOfServiceReasonID = EndOfServicesVM.EndOfServiceReasonID
            };
            EndOfServiceBLL.LoginIdentity = UserIdentity;

            Result result = EndOfServiceBLL.Update();

            if (result.EnumMember == EndOfServicesValidationEnum.Done.ToString())
            {
            }
            else if (result.EnumMember == EndOfServicesValidationEnum.RejectedBecauseOfConflictWithStopWorks.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationConflictWithStopWorkText);
            }
            else if (result.EnumMember == EndOfServicesValidationEnum.RejectedBecauseOfEndOfServicesDateIsPassedAway.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfEndOfServicesDateIsPassedAwayText);
            }

            return(Json(new { EndOfServiceID = EndOfServiceBLL.EndOfServiceID }, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        public ActionResult Create(EndOfServicesViewModel EndOfServicesVM)
        {
            EndOfServicesBLL EndOfServiceBLL = new EndOfServicesBLL();

            EndOfServiceBLL.EmployeeCareerHistory = new EmployeesCareersHistoryBLL()
            {
                EmployeeCareerHistoryID = EndOfServicesVM.EmployeeCareerHistoryID
            };
            EndOfServiceBLL.EndOfServiceDate         = EndOfServicesVM.EndOfServiceDate;
            EndOfServiceBLL.EndOfServiceDecisionNo   = EndOfServicesVM.EndOfServiceDecisionNo;
            EndOfServiceBLL.EndOfServiceDecisionDate = EndOfServicesVM.EndOfServiceDecisionDate;
            EndOfServiceBLL.EndOfServiceReason       = new EndOfServicesReasonsBLL()
            {
                EndOfServiceReasonID = EndOfServicesVM.EndOfServiceReasonID
            };
            EndOfServiceBLL.LoginIdentity = UserIdentity;
            Result result = EndOfServiceBLL.Add();

            if (result.EnumMember == EndOfServicesValidationEnum.Done.ToString())
            {
            }
            else if (result.EnumMember == EndOfServicesValidationEnum.RejectedBecauseOfConflictWithStopWorks.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationConflictWithStopWorkText);
            }
            //else if (result.EnumMember == EndOfServicesValidationEnum.RejectedBecauseOfMonthlyDeductionAmountShouldNotGreaterThanTotalDeductionAmount.ToString())
            //{
            //    throw new CustomException(Resources.Globalization.ValidationDeductionAmountShouldNotGreaterThenTotalDeductionAmountText);
            //}

            return(Json(new { EndOfServiceID = EndOfServiceBLL.EndOfServiceID }, JsonRequestBehavior.AllowGet));
        }
示例#5
0
        public ActionResult Delete(EndOfServicesViewModel EndOfServicesVM)
        {
            EndOfServicesBLL EndOfService = new EndOfServicesBLL();

            EndOfService.LoginIdentity = UserIdentity;
            Result result = EndOfService.Remove(EndOfServicesVM.EndOfServiceID);

            if (result.EnumMember == EndOfServicesValidationEnum.Done.ToString())
            {
            }
            else if (result.EnumMember == EndOfServicesValidationEnum.RejectedBecauseOfEndOfServicesDateIsPassedAway.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfEndOfServicesDateIsPassedAwayText);
            }
            return(RedirectToAction("Index"));
        }