public List<tbBill_customers> tbBill_customers_GetByTop(string Top, string Where, string Order) { List<Data.tbBill_customers> list = new List<Data.tbBill_customers>(); using (SqlCommand dbCmd = new SqlCommand("sp_tbBill_customers_GetByTop", GetConnection())) { Data.tbBill_customers obj = new Data.tbBill_customers(); dbCmd.CommandType = CommandType.StoredProcedure; dbCmd.Parameters.Add(new SqlParameter("@Top", Top)); dbCmd.Parameters.Add(new SqlParameter("@Where", Where)); dbCmd.Parameters.Add(new SqlParameter("@Order", Order)); SqlDataReader dr = dbCmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { list.Add(obj.tbBill_customersIDataReader(dr)); } dr.Close(); //conn.Close(); } else { dr.Close(); } } return list; }
public List<tbBill_customers> tbBill_customers_Paging(string CurentPage, string PageSize, string Lang) { List<Data.tbBill_customers> list = new List<Data.tbBill_customers>(); using (SqlCommand dbCmd = new SqlCommand("sp_tbBill_customers_Paging", GetConnection())) { Data.tbBill_customers obj = new Data.tbBill_customers(); dbCmd.CommandType = CommandType.StoredProcedure; dbCmd.Parameters.Add(new SqlParameter("@CurentPage", CurentPage)); dbCmd.Parameters.Add(new SqlParameter("@PageSize", PageSize)); dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang)); SqlDataReader dr = dbCmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { list.Add(obj.tbBill_customersIDataReader(dr)); } dr.Close(); //conn.Close(); } else { dr.Close(); } } return list; }
public tbBill_customers tbBill_customersIDataReader(IDataReader dr) { Data.tbBill_customers obj = new Data.tbBill_customers(); obj.billid = (dr["billid"] is DBNull) ? string.Empty : dr["billid"].ToString(); obj.userid = (dr["userid"] is DBNull) ? string.Empty : dr["userid"].ToString(); obj.totalmoney = (dr["totalmoney"] is DBNull) ? string.Empty : dr["totalmoney"].ToString(); obj.idate = (dr["idate"] is DBNull) ? string.Empty : dr["idate"].ToString(); obj.xdate = (dr["xdate"] is DBNull) ? string.Empty : dr["xdate"].ToString(); obj.request = (dr["request"] is DBNull) ? string.Empty : dr["request"].ToString();