private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(tbFName.Text) || string.IsNullOrWhiteSpace(tbLName.Text) || string.IsNullOrWhiteSpace(tbPW.Text) || string.IsNullOrWhiteSpace(tbID.Text))
     {
         MessageBox.Show("You must input all fields", "Check Your Input", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         String deptCode, fName, lName, pw;
         //get data from the inputs
         deptCode = ((KeyValuePair <String, String>)comboBox1.SelectedItem).Value;
         fName    = tbFName.Text;
         lName    = tbLName.Text;
         pw       = tbPW.Text;
         //insert all data into db
         MySqlCommand command = cnn.CreateCommand();
         command.CommandText = "insert into Staff values('" + uid + "','" + fName + "','" + lName + "','" + deptCode + "','" + pw + "');";
         cnn.Open();
         command.ExecuteNonQuery();
         cnn.Close();
         if (((KeyValuePair <String, String>)comboBox1.SelectedItem).Value == "RM")
         {
             command.CommandText = "insert into StaffRestaurant values('" + uid + "','" + restNum + "');";
             cnn.Open();
             command.ExecuteNonQuery();
             cnn.Close();
         }
         //show create success message
         MessageBox.Show("Create Success!", "Created", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
         m.Show();
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     this.Close();
     if (em != null)
     {
         em.Show();
     }
     else
     {
         m.Show();
     }
 }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            switch (deptCode)
            {
            case "AM":
                this.Hide();
                EditMenu em = new EditMenu(this, 0);
                em.Show();
                break;

            case "RM":
                this.Hide();
                PurchaseRequest pr = new PurchaseRequest(this, restNo, StaffNo);
                pr.Show();
                break;

            case "PM":
                this.Hide();
                TypeofAgreementMenu tam = new TypeofAgreementMenu(staffName, this);
                tam.Show();
                break;

            case "CM":
                this.Hide();
                Category cat = new Category(this);
                cat.Show();
                break;

            case "WC":
                this.Hide();
                WHViewDPI dpi = new WHViewDPI(this);
                dpi.Show();
                break;

            case "AD":
                this.Hide();
                TypeofAgreementMenu adtam = new TypeofAgreementMenu(staffName, this);
                adtam.Show();
                break;
            }
        }
Example #4
0
        private void btn2_Click(object sender, EventArgs e)
        {
            switch (deptCode)
            {
            case "PM":
                this.Hide();
                PRMapping prm = new PRMapping(this);
                prm.Show();
                break;

            case "RM":
                this.Hide();
                ViewDeliveryNoteMenu vDN = new ViewDeliveryNoteMenu(this, "RM", restNo);
                vDN.Show();
                break;

            case "AD":
            case "WC":
                this.Hide();
                ViewDeliveryNoteMenu WHvDN = new ViewDeliveryNoteMenu(this, "WC");
                WHvDN.Show();
                break;

            case "AM":
                this.Hide();
                EditMenu em = new EditMenu(this, 1);
                em.Show();
                break;

            case "CM":
                this.Hide();
                Item itm = new Item(this);
                itm.Show();
                break;
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     this.Close();
     m.Show();
 }