Beispiel #1
0
 private void cartButton_Click(object sender, EventArgs e)
 {
     if (MainClass.checkControls(leftpanel).Count != 0)
     {
         MainClass.showMessage("Please enter all the required field", "error");
     }
     else
     {
         bool check = false;
         foreach (DataGridViewRow row in dataGridView1.Rows)
         {
             if (row.Cells["itemIDGV"].Value.ToString() == itemDD.SelectedValue.ToString())
             {
                 check = true;
                 break;
             }
         }
         DataRowView drvFloor = floorDD.SelectedItem as DataRowView;
         DataRowView drvTable = tableDD.SelectedItem as DataRowView;
         DataRowView drvItems = itemDD.SelectedItem as DataRowView;
         try
         {
             if (check)
             {
                 MainClass.showMessage("Item added already!", "error");
             }
             else
             {
                 catID   = RetrivalData.CATEGORYID;
                 catName = RetrivalData.CATEGORYNAME;
                 if (orderDD.SelectedIndex == 0)
                 {
                     totalAmount    += Convert.ToSingle(priceTxt.Text) * Convert.ToSingle(numericUpDown1.Value);
                     totalLabel.Text = totalAmount.ToString();
                     dataGridView1.Rows.Add(null, Convert.ToInt32(tableDD.SelectedValue.ToString()),
                                            Convert.ToInt32(floorDD.SelectedValue.ToString()),
                                            catID, catName,
                                            Convert.ToInt32(itemDD.SelectedValue.ToString()),
                                            drvItems["Menu Name"],
                                            Convert.ToSingle(priceTxt.Text),
                                            Convert.ToInt32(numericUpDown1.Text),
                                            orderDD.SelectedItem.ToString(),
                                            drvFloor["Floor"],
                                            drvTable["Table Number"],
                                            null);
                 }
                 else if (orderDD.SelectedIndex == 1 || orderDD.SelectedIndex == 2)
                 {
                     totalAmount    += Convert.ToSingle(priceTxt.Text) * Convert.ToSingle(numericUpDown1.Value);
                     totalLabel.Text = totalAmount.ToString();
                     dataGridView1.Rows.Add(null, null, null, catID, catName, Convert.ToInt32(itemDD.SelectedValue.ToString()), drvItems["Menu Name"],
                                            Convert.ToSingle(priceTxt.Text),
                                            Convert.ToInt32(numericUpDown1.Text),
                                            orderDD.SelectedItem.ToString(), null,
                                            null, phonetxt.Text);
                 }
             }
         }
         catch (Exception)
         {
             MainClass.showMessage("Please enter all the fields.", "error");
         }
     }
     MainClass.sno(dataGridView1, "snoGV");
 }
Beispiel #2
0
        private void savebtn_Click(object sender, EventArgs e)
        {
            if (iscb.Checked)
            {
                if (serverTxt.Text == "")
                {
                    serverErrorLabel.Visible = true;
                }
                else
                {
                    serverErrorLabel.Visible = false;
                }

                if (databaseTxt.Text == "")
                {
                    DbErrorLabel.Visible = true;
                }
                else
                {
                    DbErrorLabel.Visible = false;
                }


                if (serverErrorLabel.Visible || DbErrorLabel.Visible)
                {
                    MainClass.showMessage("Fields with * are mandatory.", "error");
                }
                else
                {
                    connection = "Data Source=" + serverTxt.Text +
                                 ";Initial Catalog=" + databaseTxt.Text +
                                 ";Integrated Security=true;MultipleActiveResultSets=true";
                    saveConnection();
                    DialogResult dr = MessageBox.Show("Settings saved succesfully.");
                    if (dr == DialogResult.OK)
                    {
                        LoginScreen ls = new LoginScreen();
                        MainClass.showWindow(ls, this, MDI.ActiveForm);
                    }
                }
            }
            else
            {
                if (serverTxt.Text == "")
                {
                    serverErrorLabel.Visible = true;
                }

                else
                {
                    serverErrorLabel.Visible = false;
                }



                if (databaseTxt.Text == "")
                {
                    DbErrorLabel.Visible = true;
                }
                else
                {
                    DbErrorLabel.Visible = false;
                }



                if (userTxt.Text == "")
                {
                    UserErrorLabel.Visible = true;
                }
                else
                {
                    UserErrorLabel.Visible = false;
                }


                if (passTxt.Text == "")
                {
                    PassErrorLabel.Visible = true;
                }
                else
                {
                    PassErrorLabel.Visible = false;
                }



                if (serverErrorLabel.Visible || DbErrorLabel.Visible || UserErrorLabel.Visible || PassErrorLabel.Visible)
                {
                    MainClass.showMessage("Fields with * are mandatory.", "error");
                }
                else
                {
                    connection = "Data Source=" + serverTxt.Text +
                                 ";Initial Catalog=" + databaseTxt.Text +
                                 ";User Id=" + userTxt.Text + ";Password="******";MultipleActiveResultSets=true";
                    saveConnection();
                    DialogResult dr = MessageBox.Show("Settings saved succesfully.");
                    if (dr == DialogResult.OK)
                    {
                        LoginScreen ls = new LoginScreen();
                        MainClass.showWindow(ls, this, MDI.ActiveForm);
                    }
                }
            }
        }
Beispiel #3
0
 private void loadButton_Click(object sender, EventArgs e)
 {
     RetrivalData.getPendingOrders(dataGridView1, orderIDGV, statusGV);
     MainClass.sno(dataGridView1, "snoGV");
 }
        private void backBTN_Click(object sender, EventArgs e)
        {
            adminHomeScreenWindow obj = new adminHomeScreenWindow();

            MainClass.showWindow(obj, this, MDI.ActiveForm);
        }
Beispiel #5
0
        public override void button6_Click(object sender, EventArgs e)
        {
            HomeScreen2 hs = new HomeScreen2();

            MainClass.showWindow(hs, this, MDI.ActiveForm);
        }