Ejemplo n.º 1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            frmBan frm = new frmBan(ban, nhanvien);

            frm.Show();
            this.Close();
        }
Ejemplo n.º 2
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (txtName.Text.Equals("") || txtName.Text.Equals(""))
     {
         MetroMessageBox.Show(this, "Chưa điền thông tin đầy đủ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Question);
     }
     else
     {
         string    tenkh = txtName.Text;
         string    sdt   = txtsdt.Text;
         KhachHang kh    = new KhachHang(tenkh, sdt);
         new KhachHangBUS().addKH(kh);
         MetroMessageBox.Show(this, "Thêm Khách hàng thành công ", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Question);
         frmBan a = new frmBan(ban, nhanvien);
         a.Show();
         this.Close();
     }
 }
Ejemplo n.º 3
0
        private void getTable1()
        {
            List <Ban> a = new List <Ban>(new BanBUS().GetListBan());

            int d = 0;
            int c = 0;
            int r = 6;

            for (int i = 0; i < a.Count; i++)
            {
                Ban ban2 = a[i];
                if (ban2.KhuVuc1 == 1)
                {
                    System.Windows.Forms.Button btn = new System.Windows.Forms.Button();

                    this.Tab1.Controls.Add(btn);


                    btn.BackColor = System.Drawing.Color.White;
                    btn.FlatAppearance.BorderColor        = System.Drawing.Color.White;
                    btn.FlatAppearance.BorderSize         = 0;
                    btn.FlatAppearance.MouseDownBackColor = System.Drawing.Color.LightGray;
                    btn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.LightGray;
                    btn.FlatStyle  = System.Windows.Forms.FlatStyle.Flat;
                    btn.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
                    btn.Size       = new System.Drawing.Size(83, 147);
                    btn.TabIndex   = 2;
                    btn.Text       = "Bàn " + a[i].Maban1;
                    btn.TextAlign  = System.Drawing.ContentAlignment.BottomCenter;
                    btn.UseVisualStyleBackColor = false;
                    if (a[i].TinhTrang1 == false)
                    {
                        if (a[i].LoaiBan1 == false)
                        {
                            btn.Image = global::Bida.Properties.Resources.bidafrace;
                        }
                        else
                        {
                            btn.Image = global::Bida.Properties.Resources.bida;
                        }
                    }
                    else
                    {
                        if (a[i].LoaiBan1 == false)
                        {
                            btn.Image = global::Bida.Properties.Resources.bidafrance_s;
                        }
                        else
                        {
                            btn.Image = global::Bida.Properties.Resources.bida_s;
                        }
                    }


                    btn.Click += (s, e) =>
                    {
                        //Thread t = new Thread(() => showFormBan(ban,nhanvien));
                        //t.Start();
                        //t.Join();

                        if (ban2.TinhTrang1 == true)
                        {
                            MetroMessageBox.Show(this, "Bàn " + ban2.Maban1 + " đang được người khác chơi vui lòng chọn bàn khác ! ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Question);
                        }
                        else
                        {
                            new BanBUS().chuyenban(ban, ban2);

                            DialogResult dialogResult = MetroMessageBox.Show(this, "Bạn đã chuyễn bàn thành công ! ", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Question);

                            frmBan frm = new frmBan(ban2, nhanvien);
                            frm.Show();
                            this.Close();
                        }
                    };
                    if (r > 0)
                    {
                        btn.Left = c * 120;
                        c        = c + 1;
                        btn.Top  = d * 150;
                        r--;
                    }
                    else
                    {
                        r = 6;
                        d++;
                        c        = 0;
                        btn.Left = c * 120;
                        c++;
                        btn.Top = d * 150;
                        r--;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void getTable1()
        {
            List <Ban> a = new List <Ban>(new BanBUS().GetListBan());

            int d = 0;
            int c = 0;
            int r = 6;

            for (int i = 0; i < a.Count; i++)
            {
                Ban ban = a[i];
                if (ban.KhuVuc1 == 1)
                {
                    System.Windows.Forms.Button btn = new System.Windows.Forms.Button();

                    this.metroTabPage1.Controls.Add(btn);


                    btn.BackColor = System.Drawing.Color.White;
                    btn.FlatAppearance.BorderColor        = System.Drawing.Color.White;
                    btn.FlatAppearance.BorderSize         = 0;
                    btn.FlatAppearance.MouseDownBackColor = System.Drawing.Color.LightGray;
                    btn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.LightGray;
                    btn.FlatStyle  = System.Windows.Forms.FlatStyle.Flat;
                    btn.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
                    btn.Size       = new System.Drawing.Size(83, 147);
                    btn.TabIndex   = 2;
                    btn.Text       = "Bàn " + a[i].Maban1;
                    btn.TextAlign  = System.Drawing.ContentAlignment.BottomCenter;
                    btn.UseVisualStyleBackColor = false;
                    if (a[i].TinhTrang1 == false)
                    {
                        if (a[i].LoaiBan1 == false)
                        {
                            btn.Image = global::Bida.Properties.Resources.bidafrace;
                        }
                        else
                        {
                            btn.Image = global::Bida.Properties.Resources.bida;
                        }
                    }
                    else
                    {
                        if (a[i].LoaiBan1 == false)
                        {
                            btn.Image = global::Bida.Properties.Resources.bidafrance_s;
                        }
                        else
                        {
                            btn.Image = global::Bida.Properties.Resources.bida_s;
                        }
                    }


                    btn.Click += (s, e) =>
                    {
                        //Thread t = new Thread(() => showFormBan(ban,nhanvien));
                        //t.Start();
                        //t.Join();

                        frmBan frm = new frmBan(ban, nhanvien);
                        frm.Show();
                        this.Close();
                    };
                    if (r > 0)
                    {
                        btn.Left = c * 120;
                        c        = c + 1;
                        btn.Top  = d * 150;
                        r--;
                    }
                    else
                    {
                        r = 6;
                        d++;
                        c        = 0;
                        btn.Left = c * 120;
                        c++;
                        btn.Top = d * 150;
                        r--;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public static void showFormBan(Ban b, NhanVien nv)
        {
            frmBan frm = new frmBan(b, nv);

            frm.ShowDialog();
        }