private void IntoDataTodtgv()
 {
     if (comb_danhmuc.SelectedIndex == 0)
     {
         dtgv.DataSource = LoaiHang_BUL.getDataTable(txt_search.Text);
     }
     else if (comb_danhmuc.SelectedIndex == 1)
     {
         dtgv.DataSource = HangHoa_BUL.getDataTable(txt_search.Text);
     }
     else if (comb_danhmuc.SelectedIndex == 2)
     {
         dtgv.DataSource = KhachHang_BUL.getDataTable(txt_search.Text);
     }
     else if (comb_danhmuc.SelectedIndex == 3)
     {
         dtgv.DataSource = NhaCungCap_BUL.getDataTable(txt_search.Text);
     }
     else if (comb_danhmuc.SelectedIndex == 4)
     {
         dtgv.DataSource = NhanVien_BUL.getDataTable(txt_search.Text);
     }
     else if (comb_danhmuc.SelectedIndex == 5)
     {
         dtgv.DataSource = DoiTacQuangCao_BUL.getDataTable(txt_search.Text);
     }
 }
Beispiel #2
0
        private void btn_them_Click(object sender, EventArgs e)
        {
            List <String> listError = new List <String>();

            if (txt_tenNCC.Text == "")
            {
                listError.Add("Tên nhà cung cấp không được rỗng");
            }
            if (listError.Count == 0)
            {
                bool rs = this.NhaCungCap == null?NhaCungCap_BUL.Them(txt_tenNCC.Text) : NhaCungCap_BUL.ChinhSua(this.NhaCungCap.ID, txt_tenNCC.Text);

                if (rs == true)
                {
                    MessageSucess();
                }
                else
                {
                    MesageFaild();
                }
            }
            else
            {
                MessageValidate(listError);
            }
        }
Beispiel #3
0
 private void fr_NhanVien_TraHang_Load(object sender, EventArgs e)
 {
     comb_NCC.DataSource    = NhaCungCap_BUL.getList();
     comb_NCC.SelectedIndex = 0;
     comb_NCC.DisplayMember = "TenNCC";
     getDonHang();
     CheckListDS();
 }
 private void fr_NhanVien_NhapHang_Load(object sender, EventArgs e)
 {
     comb_ncc.DataSource    = NhaCungCap_BUL.getList();
     comb_ncc.SelectedIndex = 0;
     comb_ncc.DisplayMember = "TenNCC";
     txt_HangHoa.Enabled    = false;
     checkList();
     chinhsuaChiTiet();
 }
        private void btn_sua_Click(object sender, EventArgs e)
        {
            Form fr_lh = null;

            if (comb_danhmuc.SelectedIndex == 0)
            {
                int       pos = dtgv.CurrentRow.Index;
                int       ID  = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value);
                LoaiHoang lh  = LoaiHang_BUL.TimLoaiHang(ID);
                fr_lh = new fr_QuanLy_LoaiHang(lh);
            }
            else if (comb_danhmuc.SelectedIndex == 1)
            {
                int     pos = dtgv.CurrentRow.Index;
                int     ID  = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value);
                HangHoa hh  = HangHoa_BUL.TimLoaiHang(ID);
                fr_lh = new fr_QuanLy_HangHoa(hh);
            }
            else if (comb_danhmuc.SelectedIndex == 2)
            {
                int       pos = dtgv.CurrentRow.Index;
                int       ID  = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value);
                KhachHang hh  = KhachHang_BUL.TimKhachHang(ID);
                fr_lh = new fr_QuanLy_KhachHang(hh);
            }
            else if (comb_danhmuc.SelectedIndex == 3)
            {
                int        pos = dtgv.CurrentRow.Index;
                int        ID  = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value);
                NhaCungCap hh  = NhaCungCap_BUL.TimNCC(ID);
                fr_lh = new fr_QuanLy_NhaCungCap(hh);
            }
            else if (comb_danhmuc.SelectedIndex == 4)
            {
                int      pos = dtgv.CurrentRow.Index;
                int      ID  = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value);
                NhanVien hh  = NhanVien_BUL.TimNhanVien(ID);
                fr_lh = new fr_QuanLy_NhanVien(hh);
            }
            else if (comb_danhmuc.SelectedIndex == 5)
            {
                int            pos = dtgv.CurrentRow.Index;
                int            ID  = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value);
                DoiTacQuangCao hh  = DoiTacQuangCao_BUL.TimLoaiHang(ID);
                fr_lh = new fr_QuanLy_DoiTacQuanCao(hh);
            }
            if (fr_lh != null)
            {
                fr_lh.FormClosing += Frm2_Closing;
                fr_lh.ShowDialog();
                resetAfterHandle();
            }
        }
        private void init()
        {
            List <LoaiHoang> listLoaihang = LoaiHang_BUL.getList();

            comb_loaihang.DataSource    = listLoaihang;
            comb_loaihang.DisplayMember = "TenLoai";
            List <NhanVien> listQuanLy = NhanVien_BUL.getListNhanVien();

            comb_quanly.DataSource    = listQuanLy;
            comb_quanly.DisplayMember = "HoTen";
            List <NhaCungCap> listNCC = NhaCungCap_BUL.getList();

            comb_ncc.DataSource    = listNCC;
            comb_ncc.DisplayMember = "TenNCC";
            txt_sltra.Enabled      = false;
            txt_sltra.Text         = "0";
        }
        private void btn_xoa_Click(object sender, EventArgs e)
        {
            int          pos          = dtgv.CurrentRow.Index;
            int          ID           = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value);
            DialogResult dialogResult = MessageBox.Show("Bạn chắc chắn muốn xóa ?", "Thông báo", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                if (comb_danhmuc.SelectedIndex == 0)
                {
                    if (LoaiHang_BUL.Xoa(ID))
                    {
                        MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK);
                        IntoDataTodtgv();
                    }
                    else
                    {
                        MessageBox.Show("Thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (comb_danhmuc.SelectedIndex == 1)
                {
                    if (HangHoa_BUL.Xoa(ID))
                    {
                        MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK);
                        IntoDataTodtgv();
                    }
                    else
                    {
                        MessageBox.Show("Thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (comb_danhmuc.SelectedIndex == 2)
                {
                    if (KhachHang_BUL.Xoa(ID))
                    {
                        MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK);
                        IntoDataTodtgv();
                    }
                    else
                    {
                        MessageBox.Show("Thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (comb_danhmuc.SelectedIndex == 3)
                {
                    if (NhaCungCap_BUL.Xoa(ID))
                    {
                        MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK);
                        IntoDataTodtgv();
                    }
                    else
                    {
                        MessageBox.Show("Thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (comb_danhmuc.SelectedIndex == 4)
                {
                    if (NhanVien_BUL.Xoa(ID))
                    {
                        MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK);
                        IntoDataTodtgv();
                    }
                    else
                    {
                        MessageBox.Show("Thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (comb_danhmuc.SelectedIndex == 5)
                {
                    if (DoiTacQuangCao_BUL.Xoa(ID))
                    {
                        MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK);
                        IntoDataTodtgv();
                    }
                    else
                    {
                        MessageBox.Show("Thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }