예제 #1
0
        //private List<string> st = new List<string> { "Tất Cả", "5", "10", "15", "20" };
        private void frmHangHoa_Load(object sender, EventArgs e)
        {
            BUS_HangHoa hh = new BUS_HangHoa();

            this.FormLoad();
            //cbsoluongtrang.DataSource = st;

            cbsoluongtrang.SelectedIndex = 4;
            if (cbsoluongtrang.Text == "Tất Cả")
            {
                dgvHangHoa.DataSource = hh.DSHH();
                lbtrang.Text          = "";
                btnlui.Enabled        = false;
                btntien.Enabled       = false;
                cbtrang.Enabled       = false;
            }
            else
            {
                int t = hh.SoLuongTrang(int.Parse(cbsoluongtrang.Text));
                cbtrang.DataSource    = hh.DStrang(t);
                lbtrang.Text          = "Trang " + cbtrang.Text + "/" + t.ToString();
                dgvHangHoa.DataSource = hh.DShanghoa(int.Parse(cbtrang.Text), int.Parse(cbsoluongtrang.Text));
                if (int.Parse(cbtrang.Text) == 1)
                {
                    btnlui.Enabled = false;
                }
                else
                {
                    btnlui.Enabled = true;
                }
                if (int.Parse(cbtrang.Text) == t)
                {
                    btntien.Enabled = false;
                }
                else
                {
                    btntien.Enabled = true;
                }
            }
        }
예제 #2
0
        private void cbsoluongtrang_SelectedIndexChanged(object sender, EventArgs e)
        {
            BUS_HangHoa dl = new BUS_HangHoa();

            if (cbsoluongtrang.Text == "Tất Cả")
            {
                dgvHangHoa.DataSource = dl.DSHH();
                lbtrang.Text          = "";
                btnlui.Enabled        = false;
                btntien.Enabled       = false;
                cbtrang.Enabled       = false;
            }
            else
            {
                cbtrang.Enabled = true;
                int t = dl.SoLuongTrang(int.Parse(cbsoluongtrang.Text));
                cbtrang.DataSource = dl.DStrang(t);
                if (int.Parse(cbtrang.Text) == 1)
                {
                    btnlui.Enabled = false;
                }
                else
                {
                    btnlui.Enabled = true;
                }
                if (int.Parse(cbtrang.Text) == t)
                {
                    btntien.Enabled = false;
                }
                else
                {
                    btntien.Enabled = true;
                }
                dgvHangHoa.DataSource = dl.DShanghoa(int.Parse(cbtrang.Text), int.Parse(cbsoluongtrang.Text));
            }
        }