コード例 #1
0
 public ControllerParent(ControllerParent callingController, ArrayList list_customers)
 {
     this.callingController = callingController;
     if (list_customers == null) this.list_customers = new ArrayList();
     else this.list_customers = list_customers;
     this.db = new Database();
     currentCustomer = null;
 }
コード例 #2
0
 public void UpdateCustomer(Customer c)
 {
     try
     {
         connection = new SQLiteConnection("Data Source=" + dbpath + ";Version=3; foreign keys=true;");
         connection.Open();
         command = new SQLiteCommand(connection);
         command.CommandText = "UPDATE customer SET name=@name, street=@street, streetnumber=@streetnumber, city=@city, zip=@zip WHERE customerNumber=@cnr ;";
         command.Parameters.AddWithValue("@cnr", c.Cnumber);
         command.Parameters.AddWithValue("@name", c.Name);
         command.Parameters.AddWithValue("@street", c.Street);
         command.Parameters.AddWithValue("@streetnumber", c.Streetnumber);
         command.Parameters.AddWithValue("@city", c.City);
         command.Parameters.AddWithValue("@zip", c.Zip);
         command.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         MessageBox.Show("Error SQL Change Customer", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log.WriteLog(e.Message);
     }
     connection.Close();
 }
コード例 #3
0
 public void SaveCustomer(Customer c)
 {
     try
     {
         connection = new SQLiteConnection("Data Source=" + dbpath + ";Version=3; foreign keys=true;");
         connection.Open();
         command = new SQLiteCommand(connection);
         command.CommandText = "INSERT INTO customer (customerNumber, name, street, streetnumber, city, zip) VALUES(@customerNumber, @name, @street, @streetnumber, @city, @zip);";
         command.Parameters.AddWithValue("@customerNumber", c.Cnumber);
         command.Parameters.AddWithValue("@name", c.Name);
         command.Parameters.AddWithValue("@street", c.Street);
         command.Parameters.AddWithValue("@streetnumber", c.Streetnumber);
         command.Parameters.AddWithValue("@city", c.City);
         command.Parameters.AddWithValue("@zip", c.Zip);
         command.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         MessageBox.Show("Error SQL Write Customer", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log.WriteLog(e.Message);
     }
     connection.Close();
 }
コード例 #4
0
 public override void AddCustomer(Customer customer)
 {
     lstCustomer.Items.Add(customer);
 }
コード例 #5
0
 //Functions
 public void AddCustomer(int nr, string name, string street, string streetnr, string city, string zip)
 {
     Customer c = new Customer(nr, name, street, streetnr, city, zip);
     list_customers.Add(c);
     db.SaveCustomer(c);
 }
コード例 #6
0
 public virtual void SelectedCustomerChanged(Object customer)
 {
     currentCustomer = (Customer)customer;
     UpdateView(false);
 }
コード例 #7
0
 public virtual void AddCustomer(Customer customer)
 {
     cmbCustomer.Items.Add(customer);
 }
コード例 #8
0
 public void SetCustomer(Customer customer)
 {
     cmbCustomer.SelectedItem = customer;
 }