public LeaveRespond CheckLeaveStatus(int leaveRequestId, RequestsProcessedByEnum en) { SqlConnection conn = null; SqlCommand cmd = null; try { conn = DALHelper.CreateSqlDbConnection(); cmd = new SqlCommand("usp_CheckLeaveStatus", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@LeaveRequestId", leaveRequestId); cmd.Parameters.AddWithValue("@RequestProcessedBy", en); SqlDataReader rdr = cmd.ExecuteReader(); LeaveRespond respond = new LeaveRespond(); if (rdr.Read()) { respond.Id = Convert.ToInt32(rdr["Id"]); respond.LeaveRequestId = leaveRequestId; } return(respond); } catch (Exception) { throw; } finally { conn.Close(); cmd.Dispose(); conn.Dispose(); } }
public LeaveRespond CheckLeaveStatus(int leaveRequestId, RequestsProcessedByEnum en) { SqlConnection conn = null; SqlCommand cmd = null; try { conn = DALHelper.CreateSqlDbConnection(); cmd = new SqlCommand("usp_CheckLeaveStatus", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@LeaveRequestId", leaveRequestId); cmd.Parameters.AddWithValue("@RequestProcessedBy", en); SqlDataReader rdr = cmd.ExecuteReader(); LeaveRespond respond = new LeaveRespond(); if(rdr.Read()) { respond.Id = Convert.ToInt32(rdr["Id"]); respond.LeaveRequestId = leaveRequestId; } return respond; } catch (Exception) { throw; } finally { conn.Close(); cmd.Dispose(); conn.Dispose(); } }