/// <summary> /// Saves the customer to the database /// </summary> public void Save() { try { ZIP = tbx_cust_Zip.Text; STATE = cbo_cust_State.SelectedItem.ToString(); CITY = tbx_cust_City.Text; STREETADDRESS = tbx_cust_Street.Text; LASTNAME = tbx_cust_CustomerLName.Text; FIRSTNAME = tbx_cust_CustomerFName.Text; DACustomer.Save(this); } catch (Exception ex) { Exceptions.Spool(ex); } }
/// <summary> /// Customer Constructor pulls from database /// </summary> /// <param name="cnumber"> Customer name</param> public Customer(int cnumber) { try { states = new List <string>(new string[] { "AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI", "WV", "WY" }); CUSTOMERNUMBER = cnumber; //DACustomer and get customer info from database. This will create a temp customer and copy back the attributes Customer tempcust = DACustomer.GetCustomer(cnumber); this.FIRSTNAME = tempcust.FIRSTNAME; this.LASTNAME = tempcust.LASTNAME; this.STREETADDRESS = tempcust.STREETADDRESS; this.CITY = tempcust.CITY; this.STATE = tempcust.STATE; this.ZIP = tempcust.ZIP; } catch (Exception ex) { Exceptions.Spool(ex); } }