public IEnumerable <LeaveBalance> LeaveBalanceList(int?YearId, int EmpCode)
        {
            List <sp_LeaveApplicationEmployeeBalance_Result> result = new List <sp_LeaveApplicationEmployeeBalance_Result>();
            int CurrentYear          = _unitOfWork.LeaveYearRepository.All().Where(x => x.YearCurrent == true).Select(x => x.YearId).FirstOrDefault();
            List <LeaveType> LeaveId = _unitOfWork.LeaveTypeRepository.All().Where(x => x.LeaveType1 == "General").ToList();

            for (int i = 0; i < LeaveId.Count; i++)
            {
                var P_YearId = new SqlParameter("leaveYearId", SqlDbType.BigInt)
                {
                    Value = (YearId == null ? CurrentYear : YearId)
                };
                var P_EmpCode = new SqlParameter("empCode", SqlDbType.BigInt)
                {
                    Value = EmpCode
                };
                var P_LeaveTypeId = new SqlParameter("leaveTypeId", SqlDbType.BigInt)
                {
                    Value = LeaveId[i].LeaveTypeId
                };
                sp_LeaveApplicationEmployeeBalance_Result single = _unitOfWork.LeaveBalanceRepository.ExecuteSPwithParameterForList("sp_LeaveApplicationEmployeeBalance @empCode,@leaveYearId,@leaveTypeId", new[] { P_EmpCode, P_YearId, P_LeaveTypeId }).FirstOrDefault();
                single.LeaveTypeAssignment = LeaveId[i].LeaveType1;
                single.LeaveTypeName       = LeaveId[i].LeaveTypeName;
                result.Add(single);
                P_YearId = P_EmpCode = P_LeaveTypeId = null;
            }
            return(LeaveBalanceMapper.SpLeaveBalanceListToLeaveBalanceList(result, EmpCode, Convert.ToInt32(YearId)));
        }
Example #2
0
        public static LeaveBalance SpLeaveBalanceToLeaveBalance(sp_LeaveApplicationEmployeeBalance_Result Record, int Empcode, int YearId)
        {
            LeaveBalance Result = new LeaveBalance
            {
                LeaveTypeId         = Convert.ToInt32(Record.LeaveTypeId),
                LeaveTypeName       = Record.LeaveTypeName,
                Leave_Balance       = Convert.ToDecimal(Record.BalanceDays),
                LeaveTypeAssignment = Record.LeaveTypeAssignment,
                TotalTaken          = Convert.ToDecimal(Record.TotalTaken),
                TotalLeaveAssigned  = Convert.ToDecimal(Record.TotalLeaveDays),
                EmpCode             = Empcode,
                LeaveYearId         = YearId,
            };

            return(Result);
        }
        public LeaveYearlyReportViewModel YearlyOfficewiseLeaveReport(int empCode, int LeaveTypeId, int LeaveYearId)
        {
            var P_YearId = new SqlParameter("leaveYearId", SqlDbType.BigInt)
            {
                Value = LeaveYearId
            };
            var P_EmpCode = new SqlParameter("empCode", SqlDbType.BigInt)
            {
                Value = empCode
            };
            var P_LeaveTypeId = new SqlParameter("leaveTypeId", SqlDbType.BigInt)
            {
                Value = LeaveTypeId
            };
            sp_LeaveApplicationEmployeeBalance_Result single = _unitOfWork.LeaveBalanceRepository.ExecuteSPwithParameterForList("sp_LeaveApplicationEmployeeBalance @empCode,@leaveYearId,@leaveTypeId", new[] { P_EmpCode, P_YearId, P_LeaveTypeId }).FirstOrDefault();

            return(LeaveBalanceMapper.SpLeaveBalanceListToYearlyLeaveBalanceList(single, empCode, Convert.ToInt32(LeaveYearId)));
        }
        public LeaveBalance LeavebalanceIndividual(int?YearId, int EmpCode, int leaveid)
        {
            List <sp_LeaveApplicationEmployeeBalance_Result> result = new List <sp_LeaveApplicationEmployeeBalance_Result>();
            int       CurrentYear = _unitOfWork.LeaveYearRepository.All().Where(x => x.YearCurrent == true).Select(x => x.YearId).FirstOrDefault();
            LeaveType LeaveId     = _unitOfWork.LeaveTypeRepository.All().Where(x => x.LeaveTypeId == leaveid).FirstOrDefault();
            var       P_YearId    = new SqlParameter("leaveYearId", SqlDbType.BigInt)
            {
                Value = (YearId == null ? CurrentYear : YearId)
            };
            var P_EmpCode = new SqlParameter("empCode", SqlDbType.BigInt)
            {
                Value = EmpCode
            };
            var P_LeaveTypeId = new SqlParameter("leaveTypeId", SqlDbType.BigInt)
            {
                Value = LeaveId.LeaveTypeId
            };
            sp_LeaveApplicationEmployeeBalance_Result Result = _unitOfWork.LeaveBalanceRepository.ExecuteSPwithParameterForList("sp_LeaveApplicationEmployeeBalance @empCode,@leaveYearId,@leaveTypeId", new[] { P_EmpCode, P_YearId, P_LeaveTypeId }).FirstOrDefault();

            Result.LeaveTypeName       = LeaveId.LeaveTypeName;
            Result.LeaveTypeAssignment = LeaveId.LeaveType1;
            return(LeaveBalanceMapper.SpLeaveBalanceToLeaveBalance(Result, EmpCode, Convert.ToInt32(YearId)));
        }
Example #5
0
        public static LeaveYearlyReportViewModel SpLeaveBalanceListToYearlyLeaveBalanceList(sp_LeaveApplicationEmployeeBalance_Result Record, int Empcode, int YearId)
        {
            LeaveYearlyReportViewModel single = new LeaveYearlyReportViewModel
            {
                LeaveTypeId = Convert.ToInt32(Record.LeaveTypeId),

                BalanceDays = Convert.ToDecimal(Record.BalanceDays),

                TotalTaken      = Convert.ToDecimal(Record.TotalTaken),
                TotalLeaveDays  = Convert.ToDecimal(Record.TotalLeaveDays),
                EmpCode         = Empcode,
                LeaveYearId     = YearId,
                PrevYearBalance = Convert.ToDecimal(Record.PrevYearBalance),
                ThisYearEarned  = Convert.ToDecimal(Record.ThisYearEarned)
            };

            return(single);
        }