/*........................................... *.... Button Event Handlers * */ //....Action Button Click Event // The Action button text changes depending on the database // action of the form (INSERT, UPDATE, DELETE, or SELECT private void btnAction_Click(object sender, EventArgs e) { switch ((int)this.Tag) { //....INSERT action requested // 1. Instantiate an instance of the CRM Database Object (CrmDb) // 2. Populate the database parameters (KVP) for the insert // The CRM Database Object includes a Dictionary<TKey,TValue> Class // Object created when the object is created. // for an INSERT, all columns on the form are included, and include // NULL or Empty values for empty form fields. case (int)DbAction.INSERT: { CrmDb crmDB = new CrmDb(); crmDB.InsertCustomer(newCustomer); break; } //....UPDATE action requested // 1. Instantiate an instance of the CRM Database Object (CrmDb) // 2. Populate the database parameters (KVP) for the update. // The CRM Database Object includes a Dictionary<TKey,TValue> Class // Object created when the object is created case (int)DbAction.UPDATE: { break; } case (int)DbAction.DELETE: { break; } case (int)DbAction.SELECT: { break; } default: { throw new CrmErrors(string.Format("Invalid DbAction {0}", this.Tag)); } } }
public void InsertCustomer() { CrmDb crmCustDB = new CrmDb(); }