Exemplo n.º 1
0
        public ActionResult Delete(EmployeesAllowancesViewModel EmployeeAllowanceVM)
        {
            EmployeesAllowancesBLL employeesAllowancesBLL = new EmployeesAllowancesBLL();

            employeesAllowancesBLL.LoginIdentity = UserIdentity;
            employeesAllowancesBLL.Remove(EmployeeAllowanceVM.EmployeeAllowanceID);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
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.º 3
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);
        }