Exemplo n.º 1
0
        public JsonResult GetEmployeesAllowances()
        {
            EmployeesAllowancesBLL EmployeesAllowancesBLL = new EmployeesAllowancesBLL()
            {
                Search   = Search,
                Order    = Order,
                OrderDir = OrderDir,
                StartRec = StartRec,
                PageSize = PageSize
            };
            var data = EmployeesAllowancesBLL.GetEmployeesAllowances(out TotalRecordsOut, out RecFilterOut)
                       .Select(x => new
            {
                EmployeeAllowanceID   = x.EmployeeAllowanceID,
                Allowance             = x.Allowance,
                EmployeeCareerHistory = x.EmployeeCareerHistory,
                //EmployeeCareerHistory = new EmployeesCareersHistoryBLL().GetEmployeeCareerHistoryByEmployeeCareerHistoryID(item.EmployeeCareerHistoryID),
                AllowanceStartDate = x.AllowanceStartDate,
                IsActive           = x.IsActive,
                CreatedBy          = x.CreatedBy,
                CreatedDate        = x.CreatedDate,
            });

            return(Json(new { draw = Convert.ToInt32(Draw), recordsTotal = TotalRecordsOut, recordsFiltered = RecFilterOut, data = data }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult Delete(EmployeesAllowancesViewModel EmployeeAllowanceVM)
        {
            EmployeesAllowancesBLL employeesAllowancesBLL = new EmployeesAllowancesBLL();

            employeesAllowancesBLL.LoginIdentity = UserIdentity;
            employeesAllowancesBLL.Remove(EmployeeAllowanceVM.EmployeeAllowanceID);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public JsonResult GetAllEmployeesAllowances()
        {
            var data = new EmployeesAllowancesBLL().GetEmployeesAllowances()
                       .Select(x => new
            {
                EmployeeAllowanceID = x.EmployeeAllowanceID,
                AllowanceName       = x.Allowance.AllowanceName,
                EmployeeCodeNo      = x.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo,
                EmployeeNameAr      = x.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeNameAr,
                JobName             = x.EmployeeCareerHistory.OrganizationJob.Job.JobName,
                //EmployeeCareerHistory = new EmployeesCareersHistoryBLL().GetEmployeeCareerHistoryByEmployeeCareerHistoryID(item.EmployeeCareerHistoryID),
                AllowanceStartDate = Globals.Calendar.GetUmAlQuraDate(x.AllowanceStartDate),
                IsActive           = x.IsActive
            });

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        private EmployeesAllowancesViewModel GetByEmployeeAllowanceID(int id)
        {
            EmployeesAllowancesBLL       EmployeeAllowanceBLL = (new EmployeesAllowancesBLL()).GetByEmployeeAllowanceID(id);
            EmployeesAllowancesViewModel EmployeeAllowanceVM  = new EmployeesAllowancesViewModel();

            if (EmployeeAllowanceBLL != null)
            {
                EmployeeAllowanceVM.EmployeeAllowanceID    = EmployeeAllowanceBLL.EmployeeAllowanceID;
                EmployeeAllowanceVM.AllowanceStartDate     = EmployeeAllowanceBLL.AllowanceStartDate.Date;
                EmployeeAllowanceVM.Allowance              = EmployeeAllowanceBLL.Allowance;
                EmployeeAllowanceVM.EmployeeCareersHistory = EmployeeAllowanceBLL.EmployeeCareerHistory;
                EmployeeAllowanceVM.IsActive    = EmployeeAllowanceBLL.IsActive;
                EmployeeAllowanceVM.CreatedDate = EmployeeAllowanceBLL.CreatedDate;
                EmployeeAllowanceVM.CreatedBy   = EmployeeAllowanceVM.GetCreatedByDisplayed(EmployeeAllowanceBLL.CreatedBy);
            }
            return(EmployeeAllowanceVM);
        }
Exemplo n.º 5
0
        public ActionResult EditEmployeeAllowance(EmployeesAllowancesViewModel EmployeeAllowanceVM)
        {
            EmployeesAllowancesBLL EmployeeAllowance = new EmployeesAllowancesBLL();

            EmployeeAllowance.EmployeeAllowanceID = EmployeeAllowanceVM.EmployeeAllowanceID;
            EmployeeAllowance.Allowance           = new AllowancesBLL()
            {
                AllowanceID = EmployeeAllowanceVM.AllowanceID
            };
            EmployeeAllowance.AllowanceStartDate    = EmployeeAllowanceVM.AllowanceStartDate;
            EmployeeAllowance.EmployeeCareerHistory = new EmployeesCareersHistoryBLL()
            {
                EmployeeCareerHistoryID = EmployeeAllowanceVM.EmployeeCareerHistoryID
            };
            EmployeeAllowance.IsActive      = EmployeeAllowanceVM.IsActive;
            EmployeeAllowance.LoginIdentity = new EmployeesCodesBLL()
            {
                EmployeeCodeID = int.Parse(Session["EmployeeCodeID"].ToString())
            };
            Result result = EmployeeAllowance.Update();

            if ((System.Type)result.EnumType == typeof(AllowanceValidationEnum))
            {
                EmployeesAllowancesBLL EmployeeAllowanceEntity = (EmployeesAllowancesBLL)result.Entity;
                if (result.EnumMember == AllowanceValidationEnum.Done.ToString())
                {
                    Session["EmployeeAllowanceID"] = ((EmployeesAllowancesBLL)result.Entity).EmployeeAllowanceID;
                }
                else if (result.EnumMember == AllowanceValidationEnum.RejectedBecauseOfNotAllowedForJob.ToString())     //not in jobAllowance table
                {
                    throw new CustomException(Resources.Globalization.ValidationAllowanceNotAllowedForJobText);
                }
                else if (result.EnumMember == AllowanceValidationEnum.RejectedBecauseOfStoped.ToString())               //allowance inactive
                {
                    throw new CustomException(Resources.Globalization.ValidationAllowanceStopedText);
                }
                else if (result.EnumMember == AllowanceValidationEnum.RejectedBecauseOfStopedForJob.ToString())     // job inactive
                {
                    throw new CustomException(Resources.Globalization.ValidationAllowanceStopedForJobText);
                }
            }

            return(View(this.GetByEmployeeAllowanceID(EmployeeAllowanceVM.EmployeeAllowanceID)));     //View(EmployeeAllowanceVM);
        }