Ejemplo n.º 1
0
 /* Event Handler for Start Button:
 *  Validate if Server Name and Table Number is entered or not
 *  if Yes, GUI changes will be made*/
 private void Button_Start_Click(object sender, EventArgs e)
 {
     if (TextBox_Server_Name.Text == "")
     {
         MessageBox.Show("Please enter server name before taking order.", "Server Name Required", MessageBoxButtons.OK, MessageBoxIcon.Error);
         TextBox_Server_Name.Focus();
     }
     else if (TextBox_Table_No.Text == "")
     {
         MessageBox.Show("Please enter table number before taking order.", "Table Name Required", MessageBoxButtons.OK, MessageBoxIcon.Error);
         TextBox_Table_No.Focus();
     }
     else
     {
         //Defaulting Pizza Quantity textboxes to 0
         TextBox_Pizza1_Quantity.Text = TextBox_Pizza2_Quantity.Text = TextBox_Pizza3_Quantity.Text = "0";
         //Displaying Sult Logo at bottom
         Picture_Sult_Logo.Visible = true;
         //Hiding Sult Title Picture located at top
         Picture_Sult_Panel.Visible = false;
         //Current Panel will be getting hidden
         Panel_Start.Visible = false;
         //Pizza Menu Will be shown along with Multiple Buttons Panel, Location will be taken from Sult Title Picture
         GroupBox_Pizza_Menu.Location = new Point(Picture_Sult_Panel.Location.X, Picture_Sult_Panel.Location.Y);
         GroupBox_Pizza_Menu.Visible  = true;
         //Button such as Order, Clear will be shown as part of Panel, Location will be dynamically calculated from Pizza Menu
         Panel_Controls.Location = new Point(GroupBox_Pizza_Menu.Location.X, (GroupBox_Pizza_Menu.Location.Y + GroupBox_Pizza_Menu.Size.Height + 4));
         Panel_Controls.Visible  = true;
         //Pizza 1 Quantity will have the focus
         TextBox_Pizza1_Quantity.Focus();
         //Form Title will be changed
         MainForm.ActiveForm.Text = TextBox_Server_Name.Text + " @ Table Number " + TextBox_Table_No.Text;
     }
 }
Ejemplo n.º 2
0
 // Event Handler to validate Table Number and display the error message when the user enters invalid value for table Number
 //if input is invalid, previous input will be cleared out and Table Number texbox will be focussed
 private void TextBox_Table_No_Leave(object sender, EventArgs e)
 {
     if ((TextBox_Table_No.Text.All(char.IsDigit)) == false)
     {
         MessageBox.Show("Please enter Correct Table Number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         TextBox_Table_No.Text = "";
         TextBox_Table_No.Focus();
         TextBox_Table_No.SelectAll();
     }
     else
     {
         Button_Start.Focus();
     }
 }