Esempio n. 1
0
    // placing orders
    // this populates the menu for the selected restaurant
    #region Bind Menu GridView
    private void BindMenuGridView(string restaurant)
    {
        DataTable     dt         = new DataTable();
        SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["OrderistaConnectionString"].ConnectionString);

        try
        {
            connection.Open();
            SqlCommand cmd = new SqlCommand("SELECT RestaurantName, Name, Price FROM Menu_Items WHERE Visible = 1 AND InStock = 1 AND RestaurantName = @restaurant");
            cmd.Parameters.AddWithValue("@restaurant", restaurant);
            cmd.Connection = connection;
            SqlDataAdapter sqlData = new SqlDataAdapter(cmd);

            sqlData.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                MenuGridView.DataSource = dt;
                MenuGridView.DataBind();
            }
        }
        catch (SqlException ex)
        {
            string msg = "Fetch Error: ";
            msg += ex.Message;
            throw new Exception(msg);
        }
        finally
        {
            connection.Close();
        }
    } // BindMenuGridView
Esempio n. 2
0
        internal void SelectMenuEntry(string ipAddressString)
        {
            int noOfUsers = SocketCommService.GetUserInfoCount();

            while (SendMenuSourceDataTable.Rows.Count < noOfUsers)
            {
                //Wait
                Thread.Sleep(100);
            }
            string filterExpression = string.Format("{0} = '{1}'", IPAddress, ipAddressString);

            DataRow[] dataRows = SendMenuSourceDataTable.Select(filterExpression);
            if (dataRows == null || dataRows.Length == 0)
            {
                return;
            }
            MenuGridView.ClearSelection();
            foreach (DataRow dataRow in dataRows)
            {
                foreach (DataGridViewRow dataGridViewRow in MenuGridView.Rows)
                {
                    if ((dataGridViewRow.DataBoundItem as DataRowView).Row == dataRow)
                    {
                        dataGridViewRow.Selected = true;
                    }
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         MenuController controller = new MenuController();
         var            stuff      = controller.GetRestaurantMenu();
         MenuGridView.DataSource = stuff;
         MenuGridView.DataBind();
         MenuRepeter.DataSource = stuff;
         MenuRepeter.DataBind();
     }
 }
Esempio n. 4
0
 private void bunifuFlatButton1_Click(object sender, EventArgs e)
 {
     clicknumb++;
     if (clicknumb % 2 != 0)
     {
         MainWindow.form.Width  = 463;
         MainWindow.form.Height = 689;
     }
     else
     {
         MainWindow.form.Width  = 463;
         MainWindow.form.Height = 480;
     }
     MenuGridView.Refresh();
 }
Esempio n. 5
0
        private void AddBTN_Click(object sender, EventArgs e)
        {
            string name  = NameBox?.Text;
            string type  = TypeBox.selectedValue?.ToString();
            int    ID    = new int();
            double price = new double();

            try
            {
                price = double.Parse(PriceBox.Text);
                ID    = int.Parse(IDBox.Text);
            }
            catch (Exception)
            {
                cMessageBox.Show("პროდუქტი ვერ დაემატა!");
            }


            bool yesorno = false;

            foreach (var item in Menu.MenuItems)
            {
                if (name == item.Name)
                {
                    yesorno = true;
                }
            }

            if (yesorno == false)
            {
                if (name != null && price != 0 && type != null && ID != 0)
                {
                    Menu.AddInMenu(new MenuItem(NameBox.Text, price, type, ID));
                    cMessageBox.Show("პროდუქტი დაემატა!");
                    MenuGridView.Refresh();
                    NameBox.Text  = "";
                    PriceBox.Text = "";
                    IDBox.Text    = "";
                    TypeBox.Text  = "";
                }
            }
            else
            {
                cMessageBox.Show("მსგავსი პროდუქტი დამატებულია!");
            }
        }