Пример #1
0
 private void Button2_Click(object sender, EventArgs e)
 {
     if (user.employee_position.ToString() == "เจ้าของร้าน")
     {
         FormCollection fc        = Application.OpenForms;
         bool           FormFound = false;
         foreach (Form form in fc)
         {
             if (form.Name == "emForm1")
             {
                 FormFound = true;
                 form.Focus();
                 break;
             }
         }
         if (FormFound == false)
         {
             emForm1 employee = new emForm1(this);
             employee.MdiParent = this;
             employee.Show();
         }
     }
     else
     {
         MessageBox.Show("คุณไม่มีสิทธิ์ในการเข้าถึงฟังก์ชันนี้");
     }
 }
Пример #2
0
 private void HomePage_Load(object sender, EventArgs e)
 {
     label1.Text       = user.employee_user.ToString();
     label2.Text       = user.employee_position.ToString();
     pictureBox1.Image = byteArrayToImage(user.employee_picture);
     if (user.employee_position.ToString() == "เจ้าของร้าน")
     {
         emForm1 em = new emForm1(this);
         em.MdiParent = this;
         em.Show();
     }
     else if (user.employee_position.ToString() == "พนักงานคลังสินค้า")
     {
         proForm1 pro = new proForm1(this);
         pro.MdiParent = this;
         pro.Show();
     }
     else if (user.employee_position.ToString() == "พนักงานขายหน้าร้าน")
     {
         sellProduct pro = new sellProduct(user, this);
         pro.MdiParent = this;
         pro.Show();
     }
 }