public void populatingCustomerDb() { EstablishConnection(); OracleCommand command = new OracleCommand(); command.Connection = conn; List <int> idList = jsonQueryList(); foreach (var temp in idList) { ProfilePullHelper helper = new ProfilePullHelper(); ProfilePull customerPull = ProfilePullHelper.PullProfile(Convert.ToString(temp)); command.CommandText = "INSERT INTO fin_customer_data VALUES(:customerIDP, :firstNameP, :lastNameP, :customerStatusP, :streetNameP, :zipCodeP, :cityP, :stateP, :countryP, :emailP, :contactNumberP, :dateOfBirthP)"; command.Parameters.Add(":customerIDP", customerPull.customerdetails.customerid); command.Parameters.Add(":firstNameP", customerPull.customerdetails.fname); command.Parameters.Add(":lastNameP", customerPull.customerdetails.lname); command.Parameters.Add(":customerStatusP", customerPull.customerdetails.customerstatus); command.Parameters.Add(":streetNameP", customerPull.customerdetails.connectionaddress.streetname); command.Parameters.Add(":zipCodeP", customerPull.customerdetails.connectionaddress.zipcode); command.Parameters.Add(":cityP", customerPull.customerdetails.connectionaddress.city); command.Parameters.Add(":stateP", customerPull.customerdetails.connectionaddress.state); command.Parameters.Add(":countryP", customerPull.customerdetails.connectionaddress.country); command.Parameters.Add(":emailP", customerPull.customerdetails.email); command.Parameters.Add(":contactNumberP", customerPull.customerdetails.contactnumber); command.Parameters.Add(":dateOfBirthP", customerPull.customerdetails.dateofbirth); //command.Parameters.Add(":billAmountP", customerPull.) command.ExecuteNonQuery(); } conn.Close(); }
public void populatingCustomerDb() { List <int> idList = jsonQueryList(); foreach (var temp in idList) { ProfilePull customerPull = ProfilePullHelper.PullProfile(Convert.ToString(temp)); if (customerPull != null) { try { OracleCommand command = new OracleCommand(); command.Connection = conn; EstablishConnection(); command.CommandText = @"INSERT INTO fincustomerdata VALUES(:customerIDP, :firstNameP, :lastNameP, :customerStatusP, :streetNameP, :zipCodeP, :cityP, :stateP, :countryP, :emailP, :contactNumberP, TO_DATE(:dateOfBirthP,'YYYY-MM-DD'))"; command.Parameters.Add(":customerIDP", customerPull.customerdetails.customerid); command.Parameters.Add(":firstNameP", customerPull.customerdetails.fname); command.Parameters.Add(":lastNameP", customerPull.customerdetails.lname); command.Parameters.Add(":customerStatusP", customerPull.customerdetails.customerstatus); command.Parameters.Add(":streetNameP", customerPull.customerdetails.connectionaddress.streetname); command.Parameters.Add(":zipCodeP", customerPull.customerdetails.connectionaddress.zipcode); command.Parameters.Add(":cityP", customerPull.customerdetails.connectionaddress.city); command.Parameters.Add(":stateP", customerPull.customerdetails.connectionaddress.state); command.Parameters.Add(":countryP", customerPull.customerdetails.connectionaddress.country); command.Parameters.Add(":emailP", customerPull.customerdetails.email); command.Parameters.Add(":contactNumberP", customerPull.customerdetails.contactnumber); command.Parameters.Add(":dateOfBirthP", customerPull.customerdetails.dateofbirth); command.ExecuteNonQuery(); conn.Close(); } catch (Exception e) { Console.WriteLine(e.Message); } } } }