public static IEnumerable <Vehicle> GetCustomerVehicles(string vehicleNo = "", string customerId = "", string lastVisit = "") { var reader = CustomerDb.GetCustomerPayments(vehicleNo, customerId, lastVisit).CreateDataReader(); while (reader.Read()) { yield return(new Vehicle( reader["VehicleNo"].ToString(), int.Parse(reader["Customer_ID"].ToString()), DateTime.Parse(reader["LastVisit"].ToString()) )); } }
public static IEnumerable <CustomerPayment> GetCustomerPayments(string id = "%", string customerId = "%", string amount = "", string dateTime = "", string userId = "%") { var reader = CustomerDb.GetCustomerPayments(id, customerId, amount, dateTime, userId).CreateDataReader(); while (reader.Read()) { yield return(new CustomerPayment( int.Parse(reader["Payment_ID"].ToString()), int.Parse(reader["Customer_ID"].ToString()), decimal.Parse(reader["Amount"].ToString()), DateTime.Parse(reader["DateTime"].ToString()), int.Parse(reader["User_ID"].ToString()) )); } }