public List <Retention> GetClaimTypes(string RetentionType) { List <Retention> claimList = new List <Retention>(); using (SqlConnection con = new SqlConnection(GetStringConnect())) { string sql = "usp_getRetentionType"; using (SqlCommand cmd = new SqlCommand(sql, con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@RetentionType", RetentionType); con.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr != null) { while (dr.Read()) { Retention claim = new Retention(); claim.IDRetentionTask = Convert.ToInt32(dr["IDRetentionTask"]); claim.RetentionStatus = dr["RetentionStatus"].ToString(); claimList.Add(claim); } con.Close(); } return(claimList); } } } }
public Retention GetClaim(int IDClient) { try { using (SqlConnection con = new SqlConnection(GetStringConnect())) { string sql = "usp_GetRetentions"; using (SqlCommand cmd = new SqlCommand(sql, con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ClientID", IDClient); con.Open(); Retention retention = new Retention(); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr != null) { while (dr.Read()) { retention.IDClient = Convert.ToInt32(dr["IDClient"]); retention.Make = dr["Make"].ToString(); retention.Status1 = dr["Status1"].ToString(); retention.Comments = dr["Comments"].ToString(); retention.UnpaidReason = dr["UnpaidReason"].ToString(); retention.Make = dr["Make"].ToString(); } con.Close(); } } return(retention); } } } catch { throw; } }