Example #1
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);
        }
Example #2
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));
        }
Example #3
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));
        }
Example #4
0
        public void GetVacationBalances(string EndOfServiceID, out string TotalDeservedBalance, out string TotalConsumedBalance, out string TotalRemainingBalance, out string TotalDeservedRemainingBalance)
        {
            int endOfServiceID             = int.Parse(EndOfServiceID);
            EndOfServicesBLL EndOfServices = new EndOfServicesBLL().GetByEndOfServiceID(endOfServiceID);
            //--======== Culculate Noraml vacation .
            var Vacation = GenericFactoryPattern <BaseVacationsBLL, NormalVacationsBLL> .CreateInstance();

            Vacation.VacationStartDate = Convert.ToDateTime(EndOfServices.EndOfServiceDate.ToString(ConfigurationManager.AppSettings["DateFormat"]), new CultureInfo("ar-SA")); //EndOfServices.EndOfServiceDate;
            int UmAlQuraYear, UmAlQuraMonth, UmAlQuraDay;

            UmAlQuraYear  = Globals.Calendar.GetUmAlQuraYear(EndOfServices.EndOfServiceDate);
            UmAlQuraMonth = Globals.Calendar.GetUmAlQuraMonth(EndOfServices.EndOfServiceDate);
            UmAlQuraDay   = Globals.Calendar.GetUmAlQuraDay(EndOfServices.EndOfServiceDate);
            ((NormalVacationsBLL)Vacation).GetVacationBalances(EndOfServices.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID, UmAlQuraYear, UmAlQuraMonth, UmAlQuraDay);

            //--======== Culculate EndOfService Vacation .
            int TotalEndOfServiceVacationsConsumedBalance = 0;
            List <EndOfServicesVacationsBLL> EndOfServicesVacationsList = new EndOfServicesVacationsBLL().GetByEndOfServiceID(endOfServiceID);

            foreach (EndOfServicesVacationsBLL EndOfServiceVacation in EndOfServicesVacationsList)
            {
                if (EndOfServiceVacation.VacationType.VacationTypeID == (int)VacationsTypesEnum.Normal)
                {
                    TotalEndOfServiceVacationsConsumedBalance += EndOfServiceVacation.VacationPeriod;
                }
            }
            int MaxNormalCompensation = new EndOfServicesVacationsBLL().MaxNormalCompensation;

            TotalDeservedBalance          = (Vacation as NormalVacationsBLL).TotalDeservedBalance.ToString();
            TotalConsumedBalance          = ((Vacation as NormalVacationsBLL).TotalConsumedBalance + TotalEndOfServiceVacationsConsumedBalance).ToString();
            TotalRemainingBalance         = ((Vacation as NormalVacationsBLL).TotalRemainingBalance - TotalEndOfServiceVacationsConsumedBalance).ToString();
            TotalDeservedRemainingBalance = int.Parse(TotalRemainingBalance) >= MaxNormalCompensation?MaxNormalCompensation.ToString() : TotalRemainingBalance;
        }
Example #5
0
        public HttpResponseMessage GetEmployeesEndOfServices()
        {
            List <EndOfServicesBLL> lstEos = new EndOfServicesBLL().GetEndOfServices();

            if (lstEos != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, lstEos));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Employees EndOfServices no data!"));
            }
        }
Example #6
0
        public JsonResult GetAllEndOfServices()
        {
            var data = new EndOfServicesBLL().GetEndOfServices().Select(item => new
            {
                EndOfServiceID           = item.EndOfServiceID,
                EndOfServiceDate         = Globals.Calendar.GetUmAlQuraDate(item.EndOfServiceDate),
                EndOfServiceDecisionDate = Globals.Calendar.GetUmAlQuraDate(item.EndOfServiceDecisionDate),
                EndOfServiceDecisionNo   = item.EndOfServiceDecisionNo,
                EndOfServiceReason       = item.EndOfServiceReason.EndOfServiceReason,
                EndOfServiceCase         = item.EndOfServiceReason.EndOfServiceCase.EndOfServiceCase,
                EmployeeNameAr           = item.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeNameAr,
                EmployeeCodeNo           = item.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo,
            });

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
Example #7
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"));
        }
Example #8
0
        public JsonResult GetEndOfServices()
        {
            var data = new EndOfServicesBLL()
            {
                Search   = Search,
                Order    = Order,
                OrderDir = OrderDir,
                StartRec = StartRec,
                PageSize = PageSize
            }.GetEndOfServices(out TotalRecordsOut, out RecFilterOut).Select(item => new
            {
                EndOfServiceID           = item.EndOfServiceID,
                EndOfServiceDate         = item.EndOfServiceDate,
                EndOfServiceDecisionDate = item.EndOfServiceDecisionDate,
                EndOfServiceDecisionNo   = item.EndOfServiceDecisionNo,
                EndOfServiceReason       = item.EndOfServiceReason.EndOfServiceReason,
                EndOfServiceCase         = item.EndOfServiceReason.EndOfServiceCase.EndOfServiceCase,
                EmployeeNameAr           = item.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeNameAr,
                EmployeeCodeNo           = item.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo,
            });

            return(Json(new { draw = Convert.ToInt32(Draw), recordsTotal = TotalRecordsOut, recordsFiltered = RecFilterOut, data = data }, JsonRequestBehavior.AllowGet));
        }