private void frmCustomerSearch_Load(object sender, EventArgs e) { _customerId = ""; _customerDataSet = CustomerGateway.list(); RefreshCustomerList(); }
private void Initialise() { DataSet ds = CustomerGateway.Find(_customerId); if (ds.Tables[0].Rows.Count > 0) { _name = ds.Tables[0].Rows[0]["Name"].ToString(); _address = ds.Tables[0].Rows[0]["Address"].ToString(); _town = ds.Tables[0].Rows[0]["Town"].ToString(); _postcode = ds.Tables[0].Rows[0]["PostCode"].ToString(); _telephone = ds.Tables[0].Rows[0]["Tel"].ToString(); _mobile = ds.Tables[0].Rows[0]["Mob"].ToString(); _registered = ds.Tables[0].Rows[0]["registered"].ToString(); } }
public void Save() { // Validate the data before attempting to insert/update // Any errors will throw exceptions and handled by the presenter ValidateData(); // Data is valid at this point so we can safely attempt to save in DB if (_isNewCustomer) { _customerId = CustomerGateway.Insert(_name, _address, _town, _postcode, _telephone, _mobile); } else { CustomerGateway.Update(_customerId, _name, _address, _town, _postcode, _telephone, _mobile); } }