public static int AddCustomerNumber(ContactDetails number) { using (SqlConnection con = new SqlConnection(connString, credentials)) { try { int retVal = -1; Dictionary <string, object> inParams = new Dictionary <string, object> { { "@CustomerId", number.CustomerId }, { "@ContactTypeId", number.ContactTypeId }, { "@ContactInfo", number.ContactInfo } }; Dictionary <string, object> outParams = new Dictionary <string, object> { { "@NewId", -1 } }; con.Open(); retVal = (int)DBActions.ExecNonReaderWithReturnSP(con, "addCustomerNumber", inParams, outParams); return(retVal); } catch (Exception ex) { MessageBox.Show(ex.Message); return(-1); } finally { con.Close(); } } }
public static int AddCustomer(Customer c) { using (SqlConnection con = new SqlConnection(connString, credentials)) { try { int retVal = -1; Dictionary <string, object> inParams = new Dictionary <string, object> { { "@FirstName", c.FirstName }, { "@LastName", c.LastName }, { "@DateOfBirth", c.DateOfBirth }, { "@CompanyId", c.CompanyId }, }; Dictionary <string, object> outParams = new Dictionary <string, object> { { "@NewId", -1 } }; con.Open(); retVal = (int)DBActions.ExecNonReaderWithReturnSP(con, "createNewCustomer", inParams, outParams); return(retVal); } catch (Exception ex) { MessageBox.Show(ex.Message); return(-1); } finally { con.Close(); } } }
public static int AddCustomerAddress(AddressDetails address) { using (SqlConnection con = new SqlConnection(connString, credentials)) { try { int retVal = -1; Dictionary <string, object> inParams = new Dictionary <string, object> { { "@CustomerId", address.CustomerId }, { "@Road", address.Road }, { "@Number", address.Number }, { "@City", address.City }, { "@PostalCode", address.PostalCode }, { "@Region", address.Region }, { "@state", address.State }, { "@Country", address.Country } }; Dictionary <string, object> outParams = new Dictionary <string, object> { { "@NewId", -1 } }; con.Open(); retVal = (int)DBActions.ExecNonReaderWithReturnSP(con, "addCustomerAddress", inParams, outParams); return(retVal); } catch (Exception ex) { MessageBox.Show(ex.Message); return(-1); } finally { con.Close(); } } }