public void RemoveCustomer(Customer customer) { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); connection.Delete(CustomerTableName, new KeyValuePair<string, object>("客户号", customer.客户号)); } }
public void AddCustomer(Customer customer) { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); connection.Insert(CustomerTableName, ToKeyValuePairs(customer)); } }
public void UpdateCustomer(Customer customer) { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); connection.Update(CustomerTableName, new KeyValuePair<string, object>("客户号", customer.客户号), ToKeyValuePairs(customer)); } }
public static IEnumerable<CustomerContact> GetCustomerContacts(this IClientInfoManager manager, Customer customer) { return manager.GetCustomerContacts(customer.客户号); }
private static IEnumerable<KeyValuePair<string, object>> ToKeyValuePairs(Customer customer) { return new Dictionary<string, object> { {"客户号", customer.客户号}, {"类型", customer.类型}, {"地址", customer.地址}, {"邮编", customer.邮编} }; }