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))); }
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))); }