Пример #1
0
        private void btnBan_Click(object sender, EventArgs e)
        {
            Button btnBan = sender as Button;

            lblTenBan.Text   = btnBan.Text;
            maBan            = btnBan.Name.ToString();
            lblMaHoaDon.Text = bllBanHang.GetMaHoaDonOfBan(maBan);
            lblTongTien.Text = GetTongTien(lblMaHoaDon.Text);
            if (lblMaHoaDon.Text != "")
            {
                LoadChiTietHoaDon(lblMaHoaDon.Text);
                lblGioVao.Text = GetGioVao(lblMaHoaDon.Text);
            }
            else
            {
                grcChiTietHoaDon.DataSource = null;
                lblGioVao.Text = "";
            }

            if (btnBan.BackColor == Color.DarkGreen)
            {
                lblTrangThai.Text    = "Trống";
                btnMoBan.Visible     = true;
                btnDongBan.Visible   = false;
                btnThanhToan.Enabled = false;
                btnDoiBan.Visible    = false;
            }
            else
            {
                if (grvChiTietHoaDon.FocusedRowHandle < 0)
                {
                    btnDongBan.Visible = true;
                }
                else
                {
                    btnDongBan.Visible = false;
                }
                lblTrangThai.Text    = "Có khách";
                btnMoBan.Visible     = false;
                btnThanhToan.Enabled = true;
                btnDoiBan.Visible    = true;
            }
        }