public static DataTable FetchLeaveConfigById(Entity.LeaveManagement.LeaveConfiguration objLeaveManagement) { using (DataTable dt = new DataTable()) { using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString())) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandText = "usp_HR_LeaveConfig_GetById"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@LeaveConfigId", objLeaveManagement.LeaveConfigId); if (con.State == ConnectionState.Closed) { con.Open(); } using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } con.Close(); } } return(dt); } }
public static int LeaveConfigurations_Save(Entity.LeaveManagement.LeaveConfiguration objLeaveManagement) { int retValue = 0; using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString())) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "usp_HR_LeaveConfig_Save"; cmd.Parameters.AddWithValue("@LeaveConfigId", objLeaveManagement.LeaveConfigId); cmd.Parameters.AddWithValue("@LeaveTypeId", objLeaveManagement.LeaveTypeId); cmd.Parameters.AddWithValue("@LeaveFrequency", objLeaveManagement.LeaveFrequency); cmd.Parameters.AddWithValue("@LeaveAccrueDate", objLeaveManagement.LeaveAccrueDate); cmd.Parameters.AddWithValue("@Encashable", objLeaveManagement.Encashable); if (con.State == ConnectionState.Closed) { con.Open(); } retValue = cmd.ExecuteNonQuery(); con.Close(); } } return(retValue); }
public static DataTable LeaveConfigurations_GetAll(Entity.LeaveManagement.LeaveConfiguration lmLeaveConfig) { using (DataTable dt = new DataTable()) { using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString())) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "usp_HR_LeaveConfig_GetAll"; using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } con.Close(); } } return(dt); } }