private void btnDialogOk_Click(object sender, RoutedEventArgs e) { Items item = new Items(-1, (lbParent.SelectedItem as Products).Id, txtName.Text, Convert.ToDouble(txtPrice.Text)); DBController.AddItem(item); this.DialogResult = true; this.Close(); }
internal static void AddItem(Items item) { DBOpenClose(() => { //string sql = "insert into users (name, password) values ('" + name + "', '" + password + "')"; string sql = "insert into items (name,parent_id,price) values ('" + item.Name + "', '" + item.Parent_id + "', " + item.Price.ToString(CultureInfo.InvariantCulture) + ")"; SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection); command.ExecuteNonQuery(); }); }