コード例 #1
0
        private void bteSanPham_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode != Keys.Enter)
            {
                return;
            }

            var frmLookUp = new frmLookUp_SanPham(true, String.Format("%{0}%", bteSanPham.Text));

            if (frmLookUp.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            foreach (var dmSanPhamInfo in frmLookUp.SelectedItems)
            {
                liSanPham.Add(new ItemInMaVachInfor
                {
                    IdSanPham   = dmSanPhamInfo.IdSanPham,
                    MaSanPham   = dmSanPhamInfo.MaSanPham,
                    TenSanPham  = dmSanPhamInfo.TenSanPham,
                    LoaiSanPham = dmSanPhamInfo.TenLoaiSP,
                    SoLuong     = 1,
                    Nganh       = dmSanPhamInfo.Nganh,
                    TrungMaVach = dmSanPhamInfo.TrungMaVach
                });
            }

            gSanPham.RefreshDataSource();

            this.groupBox4.Text = "Danh sách sản phẩm (" + liSanPham.Count + " sản phẩm)";
        }
コード例 #2
0
        private void bteSanPham_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            var frmLookUp = new frmLookUp_SanPham(true, String.Format("%{0}%", bteSanPham.Text));

            if (frmLookUp.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            foreach (var dmSanPhamInfo in frmLookUp.SelectedItems)
            {
                liSanPham.Add(new ItemInMaVachInfor
                {
                    IdSanPham   = dmSanPhamInfo.IdSanPham,
                    MaSanPham   = dmSanPhamInfo.MaSanPham,
                    TenSanPham  = dmSanPhamInfo.TenSanPham,
                    LoaiSanPham = dmSanPhamInfo.TenLoaiSP,
                    SoLuong     = 1,
                    Nganh       = dmSanPhamInfo.Nganh,
                    TrungMaVach = dmSanPhamInfo.TrungMaVach
                });
            }

            gSanPham.RefreshDataSource();

            this.groupBox4.Text = "Danh sách sản phẩm (" + liSanPham.Count + " sản phẩm)";
        }
コード例 #3
0
        public void TestLookUpSanPham()
        {
            frmLookUp_SanPham frm = new frmLookUp_SanPham(true, "%%");

            frm.ShowDialog();
            Assert.AreEqual(1, frm.SelectedItems.Count);
        }
コード例 #4
0
        public void TestLookUpSanPham_1()
        {
            frmLookUp_SanPham frm = new frmLookUp_SanPham();

            frm.ShowDialog();
            MessageBox.Show(frm.SelectedItem.Nganh);
        }
コード例 #5
0
        public void ChonSP()
        {
            frmLookUp_SanPham frm = new frmLookUp_SanPham();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                View.IdSanPham = frm.SelectedItem.IdSanPham;
            }
        }
コード例 #6
0
        private void btnThemSP_Click(object sender, EventArgs e)
        {
            frmLookUp_SanPham frm = new frmLookUp_SanPham();

            if (frm.ShowDialog() == DialogResult.OK)//nếu kết quả trả về là form LookUp
            {
                PickUpSanPhamInfo(frm.SelectedItem);
            }
        }
コード例 #7
0
        private void bteSanpham_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            frmLookUp_SanPham frmLookUp = new frmLookUp_SanPham(String.Format("%{0}%", bteSanpham.Text));

            if (frmLookUp.ShowDialog() == DialogResult.OK)
            {
                bteSanpham.Tag = frmLookUp.SelectedItem;
            }
        }
コード例 #8
0
        private void btnThemSP_Click(object sender, EventArgs e)
        {
            frmLookUp_SanPham frm = new frmLookUp_SanPham(((DMKhoInfo)bteKhoDi.Tag).IdKho, 0, true, true);

            if (frm.ShowDialog() == DialogResult.OK)//nếu kết quả trả về là form LookUp
            {
                PickUpSanPhamInfo(frm.SelectedItem);
            }
        }
コード例 #9
0
        private void bteSanPham_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            frmLookUp_SanPham frmLookUpSanPham = new frmLookUp_SanPham();

            if (frmLookUpSanPham.ShowDialog() == DialogResult.OK)
            {
                bteSanPham.Text = frmLookUpSanPham.SelectedItem.MaSanPham;
                idSanPham       = frmLookUpSanPham.SelectedItem.IdSanPham;
            }
        }
コード例 #10
0
 private void bteSanpham_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         frmLookUp_SanPham frmLookUp = new frmLookUp_SanPham(String.Format("%{0}%", bteSanpham.Text));
         if (frmLookUp.ShowDialog() == DialogResult.OK)
         {
             bteSanpham.Tag = frmLookUp.SelectedItem;
         }
     }
 }
コード例 #11
0
        public void SaoChep()
        {
            try
            {
                frmLookUp_SanPham frm = new frmLookUp_SanPham("%%");
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    DMSanPhamInfo dmSanPhamInfo = frm.SelectedItem;
                    if (DmCauHinhSanPhamDAO.Instance.DaCoCauHinh(View.IdSanPham))
                    {
                        if (
                            MessageBox.Show("Sản phẩm này đã có cấu hình bạn có muốn ghi đè không ?", "Xác Nhận ",
                                            MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                            MessageBoxDefaultButton.Button2) == DialogResult.No)
                        {
                            return;
                        }
                    }
                    else if (
                        MessageBox.Show("Bạn chắc chắn sẽ sao chép cấu hình cho sản phẩm ?",
                                        dmSanPhamInfo.MaSanPham, MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                        MessageBoxDefaultButton.Button2) == DialogResult.No)
                    {
                        return;
                    }
                    try
                    {
                        ConnectionUtil.Instance.BeginTransaction();
                        DmCauHinhSanPhamDAO.Instance.Delete(dmSanPhamInfo.IdSanPham);
                        List <DMCauHinhSanPhamInfo> list = new List <DMCauHinhSanPhamInfo>();
                        for (int i = 0; i < list.Count; i++)
                        {
                            DMCauHinhSanPhamInfo info = list[i];
                            DmCauHinhSanPhamDAO.Instance.Update(info.IdSanPham, info.TenCauHinh, info.GiaTri, info.SoTT);
                            ConnectionUtil.Instance.CommitTransaction();
                        }
                    }
                    catch (Exception)
                    {
                        {
                            ConnectionUtil.Instance.RollbackTransaction();
                            throw;
                        }
                    }
                }
            }
            catch (Exception ex)

            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #12
0
        private void bteSanPham_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            frmLookUp_SanPham frmLookUp = new frmLookUp_SanPham(true, String.Format("%{0}%", bteSanPham.Text));

            if (frmLookUp.ShowDialog() == DialogResult.OK)
            {
                bteSanPham.EditValue = String.Empty;
                bteSanPham.Tag       = frmLookUp.SelectedItems;
                foreach (DMSanPhamInfo selectedItem in frmLookUp.SelectedItems)
                {
                    bteSanPham.EditValue += selectedItem.MaSanPham + ",";
                }
            }
        }
コード例 #13
0
        private void btnThemSP_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(bteTrungTam.Text) || string.IsNullOrEmpty(bteKho.Text))
            {
                clsUtils.MsgCanhBao("Bạn chưa chọn trung tâm/kho!");
                return;
            }
            frmLookUp_SanPham frm = new frmLookUp_SanPham(((DMKhoInfo)bteKho.Tag).IdKho, 0, true, true);

            if (frm.ShowDialog() == DialogResult.OK)//nếu kết quả trả về là form LookUp
            {
                PickUpSanPhamInfo(frm.SelectedItem);
            }
        }
コード例 #14
0
 private void bteSanPham_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         frmLookUp_SanPham frmLookUp = new frmLookUp_SanPham(true, String.Format("%{0}%", bteSanPham.Text));
         if (frmLookUp.ShowDialog() == DialogResult.OK)
         {
             bteSanPham.Tag = frmLookUp.SelectedItems;
             foreach (DMSanPhamInfo selectedItem in frmLookUp.SelectedItems)
             {
                 bteSanPham.EditValue += selectedItem.MaSanPham + ",";
             }
         }
     }
 }
コード例 #15
0
        private void bteSanPham_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            frmLookUp_SanPham frmLookUpSanPham = new frmLookUp_SanPham(true, String.Format("%{0}%", bteSanPham.Text));

            if (frmLookUpSanPham.ShowDialog() == DialogResult.OK)
            {
                int maxDisplay = 3;

                bteSanPham.Text = ",";

                if (frmLookUpSanPham.SelectedItems.Count < maxDisplay)
                {
                    foreach (DMSanPhamInfo dmSanPhamInfo in frmLookUpSanPham.SelectedItems)
                    {
                        bteSanPham.Text += dmSanPhamInfo.MaSanPham + ",";
                    }
                }
                else
                {
                    foreach (DMSanPhamInfo dmSanPhamInfo in frmLookUpSanPham.SelectedItems)
                    {
                        if (maxDisplay < 0)
                        {
                            break;
                        }

                        bteSanPham.Text += dmSanPhamInfo.MaSanPham + ",";

                        maxDisplay -= 1;
                    }

                    bteSanPham.Text += "...";
                }

                bteSanPham.Tag = frmLookUpSanPham.SelectedItems;
            }
        }
コード例 #16
0
        //protected  void PickUpSanPhamInfo(DMSanPhamInfo sanPhamInfo)
        //{
        //    likhong[dgvSanPhamKhong.Rows.IndexOf(dgvSanPhamKhong.CurrentRow)].MaSanPham = sanPhamInfo.MaSanPham;
        //    likhong[dgvSanPhamKhong.Rows.IndexOf(dgvSanPhamKhong.CurrentRow)].TenSanPham = sanPhamInfo.TenSanPham;
        //    likhong[dgvSanPhamKhong.Rows.IndexOf(dgvSanPhamKhong.CurrentRow)].TrungMaVach = sanPhamInfo.TrungMaVach;
        //    likhong[dgvSanPhamKhong.Rows.IndexOf(dgvSanPhamKhong.CurrentRow)].IdSanPham = sanPhamInfo.IdSanPham;
        //    if (dgvSanPhamKhong.DataSource == null)
        //        dgvSanPhamKhong.DataSource = new BindingList<KiemKeChiTietKhongMaVachInfor>(likhong);
        //    else
        //    {
        //        ((BindingList<KiemKeChiTietKhongMaVachInfor>)dgvSanPhamKhong.DataSource).ResetBindings();
        //    }
        //}

        // private bool isKeyPressed;

        //void Control_KeyPress(object sender, KeyPressEventArgs e)
        //{
        //    isKeyPressed = true;
        //}

        //void Control_TextChanged(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        if (ColumnMaSanPham == null) return;
        //        if (!isKeyPressed || dgvSanPhamKhong.CurrentCell.ColumnIndex != dgvSanPhamKhong.Columns.IndexOf(ColumnMaSanPham) ||
        //            ((TextBox)sender).Text == String.Empty || ((TextBox)sender).Text == (string)dgvSanPhamKhong.CurrentCell.Value) return;

        //        frmLookUp_SanPham frm = new frmLookUp_SanPham(String.Format("%{0}%", ((TextBox)sender).Text));

        //        if (frm.ShowDialog() == DialogResult.OK)
        //        {
        //            isKeyPressed = false;
        //            PickUpSanPhamInfo(frm.SelectedItem);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        EventLogProvider.Instance.WriteLog(ex.ToString(), "frmLookUp_SanPham");
        //    }
        //}
        //private void dgvSanPhamKhong_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        //{
        //    if (ColumnMaSanPham == null) return;
        //    if (dgvSanPhamKhong.CurrentCell != null && dgvSanPhamKhong.CurrentCell.ColumnIndex == dgvSanPhamKhong.Columns.IndexOf(ColumnMaSanPham))
        //    {
        //        e.Control.KeyPress += new KeyPressEventHandler(Control_KeyPress);
        //        e.Control.TextChanged += new EventHandler(Control_TextChanged);
        //    }
        //}
        //protected  DataGridViewTextBoxColumn ColumnMaSanPham
        //{
        //    get
        //    {
        //        return clMaSanPhamKhong;
        //    }
        //}
        private void Them()
        {
            if (trangThai == 1)
            {
                throw new ManagedException("Phiếu này đã được xác nhận!");
            }

            if (txtMaVach.Text == "")
            {
                throw new ManagedException("Mã vạch không được để trống !");
            }
            if (bteDotKiemKe.Tag == null)
            {
                throw new ManagedException("Bạn chưa chọn đợt kiểm kê!");
            }

            txtMaVach.Text = txtMaVach.Text.Trim();

            List <DMSanPhamInfoEx> listsp = KiemKeDataProvider.Instance.
                                            GetLookUpSanPhamTrungMV(txtMaVach.Text, MaTrungTam, MaKho, MaNganh,
                                                                    ((DotKiemKeInfor)bteDotKiemKe.Tag).IdDotKiemKe);

            List <ChungTu_ChiTietHangHoaKiemKeInfor> frm =
                KiemKeDataProvider.Instance.GetIdSanPhamByMaVach(txtMaVach.Text, MaTrungTam, MaKho, MaNganh,
                                                                 ((DotKiemKeInfor)bteDotKiemKe.Tag).IdDotKiemKe);

            if (frm != null && frm.Count != 0)
            {
                for (int i = 0; i < frm.Count; i++)
                {
                    HangHoa.IdChiTietHangHoa = frm[i].IdChiTietHangHoa;
                    HangHoa.IdSanPham        = frm[i].IdSanPham;
                    HangHoa.MaSanPham        = frm[i].MaSanPham;
                    HangHoa.TenSanPham       = frm[i].TenSanPham;
                    HangHoa.SoLuongSS        = frm[i].SoLuong;
                    HangHoa.GhiChu           = frm[i].GhiChu;
                    HangHoa.TrungMaVach      = frm[i].TrungMaVach;
                    HangHoa.IdKho            = frm[i].IdKho;
                    HangHoa.MaKho            = frm[i].MaKho;
                    //HangHoa.DonViTinh = frm[0].TenDonViTinh;}
                }
            }

            if (frm != null && frm.Count == 0 ||
                !chkAutoRegSub.Checked || //&& HangHoa.TrungMaVach == 1 ||
                KiemKeDataProvider.Instance.CheckMaVach(MaKho, HangHoa.IdSanPham, txtMaVach.Text.Trim(), MaNganh, MaTrungTam,
                                                        ((DotKiemKeInfor)bteDotKiemKe.Tag).IdDotKiemKe) == false)
            {
                if (MessageBox.Show(
                        !chkAutoRegSub.Checked && HangHoa.TrungMaVach == 1 ?
                        "Bạn có chắc chắn là serial thừa không?" :
                        "Mã vạch hiện không tìm thấy.\nBạn có muốn thêm mã vạch này không?",
                        "Xác nhận",
                        MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    KiemKeChiTietKhongMaVachInfor matchInfo = new KiemKeChiTietKhongMaVachInfor();

                    DMTrungTamInfor trungTamInfor = DMTrungTamDataProvider.GetTrungTamByMa(((DotKiemKeInfor)bteDotKiemKe.Tag).TrungTam);


                    frmLookUp_Kho frmLookUpKho = new frmLookUp_Kho(false, String.Format("%{0}%", ((DotKiemKeInfor)bteDotKiemKe.Tag).TrungTam), trungTamInfor.IdTrungTam, -1);

                    if (frmLookUpKho.ShowDialog() == DialogResult.OK)
                    {
                        matchInfo.IdKho = frmLookUpKho.SelectedItem.IdKho;
                        matchInfo.MaKho = frmLookUpKho.SelectedItem.MaKho;
                    }
                    else
                    {
                        return;
                    }

                    frmLookUp_SanPham frmLookUpSanPham = new frmLookUp_SanPham("%%");
                    if (frmLookUpSanPham.ShowDialog() == DialogResult.OK)
                    {
                        matchInfo.IdSanPham  = frmLookUpSanPham.SelectedItem.IdSanPham;
                        matchInfo.MaSanPham  = frmLookUpSanPham.SelectedItem.MaSanPham;
                        matchInfo.TenSanPham = frmLookUpSanPham.SelectedItem.TenSanPham;
                    }
                    else
                    {
                        return;
                    }

                    foreach (KiemKeChiTietKhongMaVachInfor pt in liKhong)
                    {
                        if (pt.MaVach.ToLower() == txtMaVach.Text.Trim().ToLower() &&
                            pt.IdKho == matchInfo.IdKho && pt.IdSanPham == matchInfo.IdSanPham)
                        {
                            pt.SoLuong = pt.SoLuong + 1;

                            ((BindingList <KiemKeChiTietKhongMaVachInfor>)grvDanhSachKhong.DataSource).ResetBindings();

                            txtMaVach.Clear();

                            grvDanhSachKhong.TopRowIndex = liKhong.IndexOf(pt);

                            grvDanhSachKhong.ClearSelection();
                            grvDanhSachKhong.FocusedRowHandle = liKhong.IndexOf(pt);
                            return;
                        }
                    }

                    liKhong.Add(new KiemKeChiTietKhongMaVachInfor()
                    {
                        MaVach     = txtMaVach.Text.Trim(),
                        SoLuong    = 1,
                        IdSanPham  = matchInfo.IdSanPham,
                        MaSanPham  = matchInfo.MaSanPham,
                        TenSanPham = matchInfo.TenSanPham,
                        IdKho      = matchInfo.IdKho,
                        MaKho      = matchInfo.MaKho
                    });

                    ((BindingList <KiemKeChiTietKhongMaVachInfor>)grvDanhSachKhong.DataSource).ResetBindings();

                    txtMaVach.Clear();

                    grvDanhSachKhong.TopRowIndex = liKhong.Count - 1;

                    grvDanhSachKhong.ClearSelection();
                    grvDanhSachKhong.FocusedRowHandle = liKhong.Count - 1;
                }

                txtMaVach.Clear();
            }
            else
            {
                if (listsp.Count < 2)
                {
                    foreach (KiemKeChiTietHangHoaInfor pt in liCo)
                    {
                        if (pt.MaVach.ToLower() == txtMaVach.Text.Trim().ToLower() &&
                            pt.TrungMaVach == 1 &&
                            pt.MaKho == HangHoa.MaKho &&
                            pt.MaSanPham == HangHoa.MaSanPham)
                        {
                            pt.SoLuong   = pt.SoLuong + 1;
                            pt.SoLuongSs = pt.SoLuongSs;

                            ((BindingList <KiemKeChiTietHangHoaInfor>)grvDanhSachCo.DataSource).ResetBindings();

                            txtTenSanPham.Text = HangHoa.TenSanPham;
                            txtMaVach.Clear();

                            grvDanhSachCo.TopRowIndex = liCo.IndexOf(pt);

                            grvDanhSachCo.ClearSelection();
                            grvDanhSachCo.FocusedRowHandle = liCo.IndexOf(pt);
                            return;
                        }
                        if (pt.MaVach.ToLower() == txtMaVach.Text.Trim().ToLower() && pt.TrungMaVach == 0)
                        {
                            throw new ManagedException("Mã vạch không được trùng nhau!");
                        }
                    }
                    liCo.Add(new KiemKeChiTietHangHoaInfor
                    {
                        MaVach           = txtMaVach.Text.Trim(),
                        SoLuong          = 1,
                        TenDonViTinh     = HangHoa.DonViTinh,
                        IdSanPham        = HangHoa.IdSanPham,
                        IdChiTietHangHoa = HangHoa.IdChiTietHangHoa,
                        TenSanPham       = HangHoa.TenSanPham,
                        MaSanPham        = HangHoa.MaSanPham,
                        SoLuongSs        = HangHoa.SoLuongSS,
                        GhiChu           = HangHoa.GhiChu,
                        TrungMaVach      = HangHoa.TrungMaVach,
                        IdKho            = HangHoa.IdKho,
                        MaKho            = HangHoa.MaKho
                    });
                    ((BindingList <KiemKeChiTietHangHoaInfor>)grvDanhSachCo.DataSource).ResetBindings();

                    txtTenSanPham.Text = HangHoa.TenSanPham;
                    txtMaVach.Clear();

                    grvDanhSachCo.TopRowIndex = liCo.Count - 1;

                    grvDanhSachCo.ClearSelection();
                    grvDanhSachCo.FocusedRowHandle = liCo.Count - 1;
                }
                else
                {
                    frmLookup_SanPhamTrungMaVach frmsp = new frmLookup_SanPhamTrungMaVach(txtMaVach.Text, MaKho, MaTrungTam, MaNganh,
                                                                                          ((DotKiemKeInfor)bteDotKiemKe.Tag).IdDotKiemKe);
                    if (frmsp.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        int idsanpham = frmsp.item.IdSanPham;
                        ChungTu_ChiTietHangHoaKiemKeInfor obj = KiemKeDataProvider.Instance.
                                                                GetSanPhamById_MaVach(idsanpham, txtMaVach.Text, MaTrungTam, frmsp.item.MaKho, MaNganh,
                                                                                      ((DotKiemKeInfor)bteDotKiemKe.Tag).IdDotKiemKe);

                        foreach (KiemKeChiTietHangHoaInfor pt in liCo)
                        {
                            if (pt.MaVach.ToLower() == txtMaVach.Text.Trim().ToLower() &&
                                pt.TrungMaVach == 1 &&
                                pt.MaKho == obj.MaKho &&
                                pt.MaSanPham == obj.MaSanPham)
                            {
                                pt.SoLuong   = pt.SoLuong + 1;
                                pt.SoLuongSs = pt.SoLuongSs;

                                ((BindingList <KiemKeChiTietHangHoaInfor>)grvDanhSachCo.DataSource).ResetBindings();

                                txtTenSanPham.Text = HangHoa.TenSanPham;
                                txtMaVach.Clear();

                                grvDanhSachCo.TopRowIndex = liCo.IndexOf(pt);

                                grvDanhSachCo.ClearSelection();
                                grvDanhSachCo.FocusedRowHandle = liCo.IndexOf(pt);

                                return;
                            }
                            if (pt.MaVach.ToLower() == txtMaVach.Text.Trim().ToLower() &&
                                pt.TrungMaVach == 0 &&
                                pt.MaKho == obj.MaKho &&
                                pt.MaSanPham == obj.MaSanPham)
                            {
                                throw new ManagedException("Mã vạch không được trùng nhau!");
                            }
                        }

                        liCo.Add(new KiemKeChiTietHangHoaInfor
                        {
                            MaVach           = txtMaVach.Text.Trim(),
                            SoLuong          = 1,
                            TenDonViTinh     = obj.TenDonViTinh,
                            IdSanPham        = obj.IdSanPham,
                            IdChiTietHangHoa = obj.IdChiTietHangHoa,
                            TenSanPham       = obj.TenSanPham,
                            MaSanPham        = obj.MaSanPham,
                            //SoLuongSs = obj.SoLuongSS,
                            GhiChu      = obj.GhiChu,
                            TrungMaVach = obj.TrungMaVach,
                            IdKho       = obj.IdKho,
                            MaKho       = obj.MaKho
                        });

                        ((BindingList <KiemKeChiTietHangHoaInfor>)grvDanhSachCo.DataSource).ResetBindings();

                        txtTenSanPham.Text = obj.TenSanPham;
                        txtMaVach.Clear();

                        grvDanhSachCo.TopRowIndex = liCo.Count - 1;

                        grvDanhSachCo.ClearSelection();
                        grvDanhSachCo.FocusedRowHandle = liCo.Count - 1;
                    }
                }
            }
        }