//Maternal Leave public int getMaternalLeave(string empId, DateTime fromdate, DateTime todate) { int count = 0; try { //DataTable dt = b.SelectByQuery("SELECT UsedLeave FROM vw_UsedLeave WHERE FromDate >='" + fromdate.ToShortDateString() + "' AND TODATE <='" + todate.ToShortDateString() + "' AND EMPID=" + empId + " AND LeaveName='Maternal Leave'"); // DataTable dt = b.SelectByQuery("SELECT SUM(UsedLeave) AS UsedLeave FROM vw_UsedLeave WHERE FromDate <='" + todate.ToShortDateString() + "' AND TODATE >='" + fromdate.ToShortDateString() + "' AND EMPID=" + empId + " AND LeaveName='Maternal Leave'"); LeaveVO LeaveVo = new LeaveDAO().GetByLeaveName("Maternal Leave"); DataTable dt = b.SelectByQuery("execute [LeaveDateRangeByEmpIDAndLeaveID] '" + fromdate.Date + "','" + todate.Date + "'," + empId + "," + LeaveVo.Id); foreach (DataRow dr in dt.Rows) { if (dr["UsedLeave"].ToString() != "") { count = int.Parse(dr["UsedLeave"].ToString()); } } } catch (Exception ex) { throw ex; } return(count); }
//Medical Leave public int getMedicalLeave(string empId, DateTime fromdate, DateTime todate) { int count = 0; try { LeaveVO LeaveVo = new LeaveDAO().GetByLeaveName("Medical Leave"); DataTable dt = b.SelectByQuery("execute [LeaveDateRangeByEmpIDAndLeaveID] '" + fromdate.Date + "','" + todate.Date + "'," + empId + "," + LeaveVo.Id); foreach (DataRow dr in dt.Rows) { if (dr["UsedLeave"].ToString() != "") { count = int.Parse(dr["UsedLeave"].ToString()); } } } catch (Exception ex) { throw ex; } return(count); }