コード例 #1
0
        private void updatedish_Click(object sender, RoutedEventArgs e)
        {
            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "update  dish " +
                             "set dishname = " + dishName.Text.ToString() + "," +
                             "dishsize =" + sizecomboBox.SelectedValue.ToString() + "," +
                             "price = " + int.Parse(dishPrice.Text.ToString()) + "," +
                             "category = " + categorycomboBox.SelectedValue.ToString()
                             + " where dishnum = " + int.Parse(updatedishcombobox.SelectedValue.ToString());

            InsertCommand.CommandText = insertC;


            try
            {
                MessageBox.Show("The dish was updated!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        private void addDishButton_Click(object sender, RoutedEventArgs e)
        {
            if (oracleConnection1 == null || oracleConnection1.State == ConnectionState.Closed)
            {
                oracleConnection1.Open();
            }


            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "insert into dish (dishnum,dishname,dishsize,price,category) values ( " + int.Parse(dishNum.Text) + " ,'" + dishName.Text.ToString() + " ','" + SizeCombobox.SelectedValue.ToString() + " '," + int.Parse(pricetextbox.Text) + " ,'" + CategoryCombobox.SelectedValue.ToString() + "')";

            InsertCommand.CommandText = insertC;


            try
            {
                InsertCommand.ExecuteNonQuery();
                MessageBox.Show("dish added!");
                this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error!");
            }
        }
コード例 #3
0
        private void addButton_Click(object sender, RoutedEventArgs e) //boutton add orange
        {
            if (oracleConnection1 == null || oracleConnection1.State == ConnectionState.Closed)
            {
                oracleConnection1.Open();
            }



            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "insert into orderr (ordernum,customername,orderdate) values ( " + int.Parse(orderNum.Text) + " ,'" + nameclientTextBox.Text.ToString() + " ','" + dateDatePicker.SelectedDate.ToString() + "')";

            InsertCommand.CommandText = insertC;


            try
            {
                MessageBox.Show("The Order was Added!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #4
0
        private void removeButton_Click(object sender, RoutedEventArgs e)
        {
            string[] branchDetails = removewaitercombobox.SelectedValue.ToString().Split(',');
            string   waiterid      = branchDetails[0];


            OracleCommand DeleteCommand = new OracleCommand();

            DeleteCommand.Connection = DBSingleton.getConnection();

            string deleteR = "delete from waiter where waiterid=" + waiterid;

            DeleteCommand.CommandText = deleteR;

            try
            {
                DeleteCommand.ExecuteNonQuery();
                MessageBox.Show("waiter was deleted succefuly!");
                this.Close();
            }

            catch
            {
                MessageBox.Show("ERROE: waiter was not deleted!");
            }
        }
コード例 #5
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            if (oracleConnection1 == null || oracleConnection1.State == ConnectionState.Closed)
            {
                oracleConnection1.Open();
            }

            OracleCommand AddCommand = new OracleCommand();

            AddCommand.Connection = DBSingleton.getConnection();
            string insertC = "insert into waiter (waiterid,waitername,waiterphone) values ( " + idtextbox.Text.ToString() + " ,'" + nametextbox.Text.ToString() + "' , '" + phonetextbox.Text.ToString() + "')";

            AddCommand.CommandText = insertC;

            try
            {
                AddCommand.ExecuteNonQuery();
                MessageBox.Show("waiter added succesfuly!");
                this.Close();
            }

            catch
            {
                MessageBox.Show("ERROR: waiter was not added!");
            }
        }
コード例 #6
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            //oracleConnection1.Open();
            OracleCommand AddCommand = new OracleCommand();

            AddCommand.Connection = DBSingleton.getConnection();
            string insertC = "insert into dishinbrunch (brunchnum,dishnum) values ( " + branchnumberCombobox.Text.ToString() + " ,'" + dishnumberCombobox.Text.ToString() + "')";

            AddCommand.CommandText = insertC;
            try
            {
                AddCommand.ExecuteNonQuery();
                MessageBox.Show("dish in branch added succesfuly!");
                this.Close();
            }
            catch { MessageBox.Show("ERROR: dish in branch was not added!"); }
        }
コード例 #7
0
        private void removedish_Click(object sender, RoutedEventArgs e)
        {
            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "delete from dish where dishnum = " + int.Parse(removedishcombobox.SelectedValue.ToString());

            InsertCommand.CommandText = insertC;

            try
            {
                MessageBox.Show("The Dish was Removed!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #8
0
        private void remove_Click(object sender, RoutedEventArgs e)
        {
            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "delete from tableorder where ordernum = " + int.Parse(ordercombobox.SelectedValue.ToString()) + " and tablenumber =" + int.Parse(tablecombobox.SelectedValue.ToString()) + " and waiterid = " + waitercombobox.SelectedValue.ToString();

            InsertCommand.CommandText = insertC;


            try
            {
                MessageBox.Show("The Table and the Waiter was removed from the Order!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #9
0
        private void removeButton_Click(object sender, RoutedEventArgs e)
        {
            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "delete from dishinorder where ordernum =" + int.Parse(orderNumComboBox.SelectedValue.ToString()) + "& dishnum =" + int.Parse(numDish.ToString()) + ")";

            InsertCommand.CommandText = insertC;


            try
            {
                MessageBox.Show("The Dish was removed to the Order!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #10
0
        //Boutton pour rajouter une table et un waiter a la order
        private void addWaiterOrTableToTheOrder_Click(object sender, RoutedEventArgs e) //Qd on clique sur le boutton Add
        {
            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "insert into tableorder (ordernum,tablenumber,waiterid) values ( " + int.Parse(ordercombobox.SelectedValue.ToString()) + " ," + int.Parse(tablecombobox.SelectedValue.ToString()) + " ,'" + waitercombobox.SelectedValue.ToString() + "')";

            InsertCommand.CommandText = insertC;


            try
            {
                MessageBox.Show("The Table and the Waiter was added to the Order!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #11
0
        //Button pour rajouter des dishes a une order
        private void addButton_Click(object sender, RoutedEventArgs e) //boutton add orange
        {
            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "insert into dishinorder (ordernum,dishnum) values ( " + int.Parse(orderNumComboBox.SelectedValue.ToString()) + " ," + int.Parse(num.ToString()) + ")";

            InsertCommand.CommandText = insertC;


            try
            {
                MessageBox.Show("The Dish was added to the Order!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #12
0
        private void updatebranch_Click(object sender, RoutedEventArgs e)
        {
            string[] branchDetails = updatebranchcombobox.SelectedValue.ToString().Split(',');
            string   branchnum     = branchDetails[0];


            OracleCommand UpdateCommand = new OracleCommand();

            UpdateCommand.Connection = DBSingleton.getConnection();
            // UPDATE branch set brunchcity = 'givataym', brunchadress = 'hagiva 44', brunchphone = '043356577', brunchkashrut = 'mehadrin' where brunchnum = '5'
            string updateB = "UPDATE branch set brunchcity ='" + cityTextBox.Text.ToString() + "', brunchadress = '" + adressBranchTextBox.Text.ToString() + "', brunchphone = '" + telephoneBranchTextBox.Text.ToString() + "', brunchkashrut = '" + kashrutComboBox.Text.ToString() + "' where brunchnum = '" + branchnum + "'";

            UpdateCommand.CommandText = updateB;

            try
            {
                UpdateCommand.ExecuteNonQuery();
                MessageBox.Show("branch was update succefuly!");
            }
            catch { MessageBox.Show("ERROE: branch was not update!"); }
        }
コード例 #13
0
        private void updatewaiter_Click(object sender, RoutedEventArgs e)
        {
            string[] Details   = updatewaitercombobox.SelectedValue.ToString().Split(',');
            string   waiternum = Details[0];


            OracleCommand UpdateCommand = new OracleCommand();

            UpdateCommand.Connection = DBSingleton.getConnection();

            string update = "UPDATE waiter set waitername ='" + waiternameTextBox.Text.ToString() + "', waiterphone = '" + waiterphoneTextBox.Text.ToString() + "' where waiterid = '" + waiternum + "'";

            UpdateCommand.CommandText = update;

            try
            {
                UpdateCommand.ExecuteNonQuery();
                MessageBox.Show("waiter was update succefuly!");
            }
            catch { MessageBox.Show("ERROE: waiter was not update!"); }
        }
コード例 #14
0
        private void updatehomeorder_Click(object sender, RoutedEventArgs e)
        {
            string[] branchDetails = updatehomeordercombobox.SelectedValue.ToString().Split(',');
            string   ordernum      = branchDetails[0];
            string   adress        = branchDetails[1];

            OracleCommand UpdateCommand = new OracleCommand();

            UpdateCommand.Connection = DBSingleton.getConnection();

            string updateB = "UPDATE homeorder set addres ='" + adreessTextBox.Text.ToString() + "' where ordernum = '" + ordernum + "' and addres='" + adress + "'";

            UpdateCommand.CommandText = updateB;

            try
            {
                UpdateCommand.ExecuteNonQuery();
                MessageBox.Show("home order was update succefuly!");
            }
            catch { MessageBox.Show("ERROE: home order was not update!"); }
        }
コード例 #15
0
        private void addHomeOrderButton_Click(object sender, RoutedEventArgs e)
        {
            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string C = "insert into homeorder (ordernum,addres) values (" + int.Parse(ordernumberCombobox.SelectedValue.ToString()) + ",'" + adresstextbox.Text.ToString() + "');";

            InsertCommand.CommandText = C;


            try
            {
                InsertCommand.ExecuteNonQuery();
                MessageBox.Show("home order was added succesfuly!");
                this.Close();
            }
            catch
            {
                MessageBox.Show("ERROR:home order was not added!");
            }
        }
コード例 #16
0
        //Quand on clique sur le button : Update
        private void updateorder_Click(object sender, RoutedEventArgs e)
        {
            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "update  dishinorder " +
                             "set dishnum = " + int.Parse(comboBox.SelectedValue.ToString()) +
                             " where ordernum = " + int.Parse(updateordercombobox.SelectedValue.ToString());

            InsertCommand.CommandText = insertC;

            try
            {
                MessageBox.Show("The dish was updated In the Order!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #17
0
        private void removeButton_Click(object sender, RoutedEventArgs e)
        {
            string[] Details   = removedishinbranchcombobox.SelectedValue.ToString().Split(',');
            string   branchnum = Details[0];
            string   dishnum   = Details[1];

            OracleCommand DeleteCommand = new OracleCommand();

            DeleteCommand.Connection = DBSingleton.getConnection();
            //delete from branch where brunchnum='301'
            string delete = "delete from dishinbrunch where brunchnum=" + branchnum + " and dishnum='" + dishnum + "'";

            DeleteCommand.CommandText = delete;

            try
            {
                DeleteCommand.ExecuteNonQuery();
                MessageBox.Show("dish in branch was deleted succefuly!");
                this.Close();
            }
            catch { MessageBox.Show("ERROE: dish in branch was not deleted!"); }
        }
コード例 #18
0
        //Quand on appuie sur le button update
        private void updateorder_Click(object sender, RoutedEventArgs e)
        {
            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "update tableorder " +
                             "set tablenumber = " + int.Parse(comboBox1.SelectedValue.ToString()) + "," +
                             " waiterid = " + int.Parse(comboBox2.SelectedValue.ToString())
                             + "where ordernum = " + int.Parse(ordercombobox.SelectedValue.ToString());

            InsertCommand.CommandText = insertC;

            try
            {
                MessageBox.Show("The Table and the Waiter were  updated In the Order!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #19
0
        private void addbranch_Click(object sender, RoutedEventArgs e)
        {
            oracleConnection1.Open();
            OracleCommand InsertCommand = new OracleCommand();

            InsertCommand.Connection = DBSingleton.getConnection();

            string insertC = "insert into branch (brunchnum,brunchcity,bruncadrees,brunchphone,brunchkashrut) values ( " + branchnumtextbox.Text.ToString() + " ,'" + citytextbox.Text.ToString() + "','" + adresstextbox.Text.ToString() + "','" + telephonetextbox.Text.ToString() + "','" + kashrutcombobox.Text.ToString() + "')";

            InsertCommand.CommandText = insertC;


            try
            {
                InsertCommand.ExecuteNonQuery();
                MessageBox.Show("Branch added!");
                this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error!");
            }
        }