/// <summary>
        /// Get history paid salary for an employee
        /// </summary>
        /// <param name="empId"></param>
        /// <returns></returns>
        public ActionResult SalaryHistory(long empId)
        {
            logger.EnterMethod();
            try
            {
                var history = new VM_EmpSalaryPaying()
                {
                    ListEmpPaying = ConvertVM.Salary_To_VMSalaryPaying(this._iSalaryServices.GetSalariesForEmployee(empId))
                };
                foreach (var item in history.ListEmpPaying)
                {
                    item.SumDays = this._iSalaryServices.AttendanceInMonth(empId, item.Time);
                }
                var emp = this._iStaffServices.Get(empId);

                return(View(history));
            }
            catch (Exception e)
            {
                logger.Error("Error: [" + e.Message + "]");
                return(View("ErrorAdminPage"));
            }
            finally
            {
                logger.LeaveMethod();
            }
        }
 public ActionResult Salary(long empId, int month = -1, int year = -1)
 {
     logger.EnterMethod();
     try
     {
         if (month > 0 && month <= 12 && year > 0)
         {
             DateTime date        = new DateTime(year, month, 1);
             var      empSalaries = this._iSalaryServices.GetSalariesForStaffPreviewNearest(empId, date).ToList();
             if (empSalaries != null)
             {
                 var emp                 = this._iStaffServices.Get(empId);
                 var salaries            = empSalaries.ToList();
                 var empCountAllSalaries = this._iSalaryServices.TotalSalariesInPast(empId);
                 var model               = ConvertVM.VMSalary_Add_VMEmpSalaryPaying_Add_History(ConvertVM.Staff_To_VMSalary(emp),
                                                                                                new VM_EmpSalaryPaying()
                 {
                     ListEmpPaying = ConvertVM.Salary_To_VMSalaryPaying(salaries)
                 },
                                                                                                empCountAllSalaries);
                 return(View(model));
             }
         }
         else
         {
             var empSalaries = this._iSalaryServices.GetSalariesForStaffPreviewNearest(empId);
             if (empSalaries.ToList() != null)
             {
                 var emp                 = this._iStaffServices.Get(empId);
                 var salaries            = empSalaries.ToList();
                 var empCountAllSalaries = this._iSalaryServices.TotalSalariesInPast(empId);
                 var model               = ConvertVM.VMSalary_Add_VMEmpSalaryPaying_Add_History(ConvertVM.Staff_To_VMSalary(emp),
                                                                                                new VM_EmpSalaryPaying()
                 {
                     ListEmpPaying = ConvertVM.Salary_To_VMSalaryPaying(salaries)
                 },
                                                                                                empCountAllSalaries);
                 return(View(model));
             }
         }
         return(View("ErrorAdminPage"));
     }
     catch (Exception e)
     {
         logger.Error("Error: [" + e.Message + "]");
         return(View("ErrorAdminPage"));
     }
     finally
     {
         logger.LeaveMethod();
     }
 }