Exemple #1
0
 private void gridControl_DonViCoSo_ProcessGridKey(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete && gridView_DonViCoSo.State != DevExpress.XtraGrid.Views.Grid.GridState.Editing)
     {
         if (XtraMessageBox.Show("Bạn có muốn xóa danh mục này hay không?", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.No)
         {
             try
             {
                 if (BioBLL.DelDonViCS(gridView_DonViCoSo.GetRowCellValue(gridView_DonViCoSo.FocusedRowHandle, "MaDVCS").ToString()))
                 {
                     this.gridControl_DonViCoSo.DataSource = BioBLL.GetListDonViCoSo();
                 }
                 else
                 {
                     XtraMessageBox.Show("Xóa danh mục thất bại!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             catch
             {
                 XtraMessageBox.Show("Xóa danh mục thất bại!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
         }
     }
 }
Exemple #2
0
        private void FrmDMGoiDichVuDonVi_Load(object sender, EventArgs e)
        {
            this.repositoryItemLookUpEdit_DonViCoSo.DataSource    = BioBLL.GetListDonViCoSo();
            this.repositoryItemLookUpEdit_DonViCoSo.ValueMember   = "MaDVCS";
            this.repositoryItemLookUpEdit_DonViCoSo.DisplayMember = "TenDVCS";

            this.repositoryItemLookUpEdit_GoiDVChung.DataSource    = BioBLL.GetListGoiDichVuChung();
            this.repositoryItemLookUpEdit_GoiDVChung.ValueMember   = "IDGoiDichVuChung";
            this.repositoryItemLookUpEdit_GoiDVChung.DisplayMember = "TenGoiDichVuChung";

            this.gridControl_GoiDVDonvi.DataSource = BioBLL.GetListGoiDichVuCoSo();
        }
Exemple #3
0
        private void FrmDMDonViCoSo_Load(object sender, EventArgs e)
        {
            this.repositoryItemLookUpEdit_ChiCuc.DataSource    = BioBLL.GetListChiCuc();
            this.repositoryItemLookUpEdit_ChiCuc.ValueMember   = "MaChiCuc";
            this.repositoryItemLookUpEdit_ChiCuc.DisplayMember = "TenChiCuc";

            DataTable dtkq = new DataTable();

            dtkq.Columns.Add("id", typeof(int));
            dtkq.Columns.Add("name", typeof(string));
            dtkq.Rows.Add(1, "Theo trung tâm");
            dtkq.Rows.Add(2, "Theo đơn vị");
            dtkq.Rows.Add(3, "Theo đơn vị kiểu 2");
            this.repositoryItemLookUpEdit_KieuTraKetQua.DataSource    = dtkq;
            this.repositoryItemLookUpEdit_KieuTraKetQua.DisplayMember = "name";
            this.repositoryItemLookUpEdit_KieuTraKetQua.ValueMember   = "id";

            this.gridControl_DonViCoSo.DataSource = BioBLL.GetListDonViCoSo();
        }
Exemple #4
0
        private void gridView_DonViCoSo_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            try
            {
                GridView view     = sender as GridView;
                int      rowfocus = e.RowHandle;
                if (string.IsNullOrEmpty(Convert.ToString(view.GetRowCellValue(rowfocus, col_th_TenDVCS))))
                {
                    e.Valid = false;
                    view.SetColumnError(col_th_TenDVCS, "Tên đơn vị cơ sở không được để trống!");
                }
                if (string.IsNullOrEmpty(Convert.ToString(view.GetRowCellValue(rowfocus, col_th_MaChiCuc))))
                {
                    e.Valid = false;
                    view.SetColumnError(col_th_MaChiCuc, "Chi cục không được để trống!");
                }
                if (e.Valid)
                {
                    byte[]             byteNull = ASCIIEncoding.ASCII.GetBytes("");
                    PSDanhMucDonViCoSo donVi    = new PSDanhMucDonViCoSo();
                    if (string.IsNullOrEmpty(gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "RowIDDVCS").ToString()))
                    {
                        donVi.RowIDDVCS = 0;
                    }
                    else
                    {
                        donVi.RowIDDVCS = Convert.ToInt16(gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "RowIDDVCS").ToString());
                    }
                    donVi.MaDVCS     = gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "MaDVCS").ToString();
                    donVi.TenDVCS    = gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "TenDVCS").ToString();
                    donVi.DiaChiDVCS = gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "DiaChiDVCS").ToString();
                    donVi.SDTCS      = gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "SDTCS").ToString();
                    if (string.IsNullOrEmpty(gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "Logo").ToString()))
                    {
                        donVi.Logo = new Binary(byteNull);
                    }
                    else
                    {
                        donVi.Logo = (Binary)gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "Logo");
                    }
                    if (string.IsNullOrEmpty(gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "HeaderReport").ToString()))
                    {
                        donVi.HeaderReport = new Binary(byteNull);
                    }
                    else
                    {
                        donVi.HeaderReport = (Binary)gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "HeaderReport");
                    }
                    if (string.IsNullOrEmpty(gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "Stt").ToString()))
                    {
                        donVi.Stt = 0;
                    }
                    else
                    {
                        donVi.Stt = Convert.ToInt16(gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "Stt").ToString());
                    }
                    if (string.IsNullOrEmpty(gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "isLocked").ToString()))
                    {
                        donVi.isLocked = false;
                    }
                    else
                    {
                        donVi.isLocked = Convert.ToBoolean(gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "isLocked").ToString());
                    }

                    donVi.MaChiCuc = gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "MaChiCuc").ToString();
                    if (string.IsNullOrEmpty(gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "KieuTraKetQua").ToString()))
                    {
                        donVi.KieuTraKetQua = 1;
                    }
                    else
                    {
                        donVi.KieuTraKetQua = int.Parse(gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "KieuTraKetQua").ToString());
                    }
                    donVi.TenBacSiDaiDien = gridView_DonViCoSo.GetRowCellValue(e.RowHandle, "TenBacSiDaiDien").ToString();
                    donVi.isDongBo        = false;
                    if (e.RowHandle < 0)
                    {
                        string codeGen = BioBLL.GetCodeDonViCoSo(donVi.MaChiCuc);
                        this.codeGenOld = codeGen.ToString();
                        if (XtraMessageBox.Show("Danh mục đơn vị cs bạn thêm có mã tự động là " + codeGen + " bạn có muốn thay đổi không?", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.No)
                        {
                            int result = 0;
                            do
                            {
                                codeGen = this.InputForm(codeGen);
                                if (CheckCodeExist(codeGen))
                                {
                                    donVi.MaDVCS = codeGen;
                                    result       = 0;
                                }
                                else
                                {
                                    result  = 1;
                                    codeGen = this.codeGenOld;
                                }
                            } while (result == 1);
                        }
                        else
                        {
                            donVi.MaDVCS = codeGen;
                        }
                        if (BioBLL.InsDonViCS(donVi))
                        {
                            XtraMessageBox.Show("Thêm mới đơn vị cơ sở thành công!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            if (XtraMessageBox.Show("Hệ thống tự động thêm dịch vụ vào đơn vị này. \nBạn có muốn thực hiện tác vụ này không?", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.No)
                            {
                                List <PSDanhMucGoiDichVuChung>     lstGoiDV        = BioBLL.GetListGoiDichVuChung();
                                List <PSDanhMucGoiDichVuTheoDonVi> lstGoiTT        = new List <PSDanhMucGoiDichVuTheoDonVi>();
                                List <PSChiTietGoiDichVuChung>     lstChiTietGoiGV = BioBLL.GetListChiTietGoiDichVuChung();
                                foreach (var dv in lstGoiDV)
                                {
                                    PSDanhMucGoiDichVuTheoDonVi tt = new PSDanhMucGoiDichVuTheoDonVi();
                                    tt.IDGoiDichVuChung     = dv.IDGoiDichVuChung;
                                    tt.MaDVCS               = donVi.MaDVCS;
                                    tt.TenGoiDichVuTrungTam = dv.TenGoiDichVuChung;
                                    tt.DonGia               = dv.DonGia ?? 0;
                                    tt.ChietKhau            = dv.ChietKhau ?? 0;
                                    tt.isXoa    = false;
                                    tt.isDongBo = false;
                                    lstGoiTT.Add(tt);
                                }
                                if (!BioBLL.InsMultiGoiDichVuCoSo(lstGoiTT))
                                {
                                    XtraMessageBox.Show("Tự động thêm dịch vụ vào đơn vị thất bại!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                        }
                        else
                        {
                            XtraMessageBox.Show("Thêm mới đơn vị cơ sở thất bại!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        PSDanhMucDonViCoSo dvOld = BioBLL.GetDonViCoSoById(donVi.RowIDDVCS);
                        if (BioBLL.UpdDonViCS(donVi))
                        {
                            PSDanhMucDonViCoSo dvNew = BioBLL.GetDonViCoSoById(donVi.RowIDDVCS);
                            if (dvOld.MaChiCuc != donVi.MaChiCuc)
                            {
                                XtraMessageBox.Show("Thay đổi mã đơn vị " + donVi.MaDVCS + " thành " + dvNew.MaDVCS + " thành công!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            XtraMessageBox.Show("Cập nhật đơn vị cơ sở thành công!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            XtraMessageBox.Show("Cập nhật đơn vị cơ sở thất bại!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    this.gridControl_DonViCoSo.DataSource = BioBLL.GetListDonViCoSo();
                }
            }
            catch { XtraMessageBox.Show("Thao tác thất bại!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }