Exemplo n.º 1
0
 private void LayDanhSachCacPhieuCanCapMa()
 {
     this.lstCanDanhMa.Clear();
     this.lstDonViCanCapMa.Clear();
     this.lstCanDanhMaFull.Clear();
     int[] lstChecked = this.GVDanhSachCho.GetSelectedRows();
     foreach (var index in lstChecked)
     {
         if (index >= 0)
         {
             string maChiDinh = this.GVDanhSachCho.GetRowCellValue(index, this.col_MaChiDinh_GCDanhSachCho).ToString();
             string maGoiXN   = this.GVDanhSachCho.GetRowCellValue(index, this.col_MaGoiXN).ToString();
             var    cd        = BioNet_Bus.GetThongTinhChiDinh(maChiDinh);
             if (cd != null)
             {
                 this.lstCanDanhMaFull.Add(cd);
                 if (!maChiDinh.Substring(0, 2).Equals("XN"))
                 {
                     this.lstCanDanhMa.Add(cd);
                 }
             }
         }
     }
     if (this.lstCanDanhMa.Count > 0)
     {
         var lst = this.lstCanDanhMa.GroupBy(p => p.MaDonVi).Select(r => new { maDonVi = r.Key, soLuong = r.Count(), soBatDau = 0 }).ToList();
         this.lstCapMaTheoDonVi.Clear();
         int bd = 1;
         try
         {
             bd = int.Parse(BioNet_Bus.GetMaXNTrongBangGhi()) + 1;
         }
         catch
         {
         }
         foreach (var item in lst)
         {
             PsDanhSachCapMa cm = new PsDanhSachCapMa();
             cm.maDonVi   = item.maDonVi;
             cm.soLuong   = item.soLuong;
             cm.soBatDau  = bd;
             cm.soKetThuc = bd + item.soLuong - 1;
             bd          += item.soLuong;
             this.lstDonViCanCapMa.Add(item.maDonVi);
             this.lstCapMaTheoDonVi.Add(cm);
         }
         this.maKT = bd - 1;
     }
     //for (int i = 0; i < this.GVDanhSachCho.RowCount; i++)
     //{
     //        try
     //        {
     //           // if(this.GVDanhSachCho.GetRowCellValue(i))
     //        }
     //        catch { }
     //    }
 }
Exemplo n.º 2
0
 private void CapMaXetNghiemCho1PhieuTuDong()
 {
     if (this.KiemTraDieuKienLamMoiDanhSach())
     {
         if (this.lstCanDanhMa.Count <= 0 && this.GVDanhSachDaCapMa.RowCount <= 0)
         {
             int bd = 1;
             try
             {
                 bd = int.Parse(BioNet_Bus.GetMaXNTrongBangGhi()) + 1;
             }
             catch { }
             this.lstDaDanhMaXN.Clear();
             if (this.maChiDinhFocusHandle.Substring(0, 2).Equals("XN"))
             {
                 PSXN_KetQua ds = new PSXN_KetQua();
                 ds.MaChiDinh        = this.maChiDinhFocusHandle;
                 ds.MaDonVi          = this.maDonviFocusHandle;
                 ds.MaPhieu          = this.maPhieuFocusHandle;
                 ds.NgayTiepNhan     = this.ngayTiepNhanFocusHandle;
                 ds.NgayChiDinh      = this.ngayChiDinhFocusHandle;
                 ds.NgayLamXetNghiem = DateTime.Now.Date;
                 ds.MaTiepNhan       = this.maTiepNhanFocusHandle;
                 ds.MaGoiXN          = this.maGoiXNFocusHandle;
                 ds.MaXetNghiem      = BioNet_Bus.GetMaXN(this.maTiepNhanFocusHandle) + "_L2";
                 this.lstDaDanhMaXN.Add(ds);
                 this.maKT = bd - 1;
                 this.LuuDanhSachDaCapMa();
             }
             else
             {
                 if (bd < 10)
                 {
                     XtraMessageBox.Show("Lỗi khi cấp mã xét nghiệm: không lấy được mã phiếu tự động. Vui lòng thử lại.", "BioNet - Chương trình sàng lọc sơ sinh!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
                 else
                 {
                     var tttrungtam = BioNet_Bus.GetThongTinTrungTam();
                     if (tttrungtam != null)
                     {
                         if (!tttrungtam.isCapMaXNTheoMaPhieu ?? true) //chọn cấp mã tự động
                         {
                             PSXN_KetQua ds = new PSXN_KetQua();
                             ds.MaChiDinh        = this.maChiDinhFocusHandle;
                             ds.MaDonVi          = this.maDonviFocusHandle;
                             ds.MaPhieu          = this.maPhieuFocusHandle;
                             ds.NgayLamXetNghiem = DateTime.Now.Date;
                             ds.NgayTiepNhan     = this.ngayTiepNhanFocusHandle;
                             ds.NgayChiDinh      = this.ngayChiDinhFocusHandle;
                             ds.MaTiepNhan       = this.maTiepNhanFocusHandle;
                             ds.MaGoiXN          = this.maGoiXNFocusHandle;
                             ds.MaXetNghiem      = bd.ToString();
                             this.lstDaDanhMaXN.Add(ds);
                             this.maKT = bd;
                             this.LuuDanhSachDaCapMa();
                         }
                         else //cấp mã xét nghiệm = mã phiếu
                         {
                             PSXN_KetQua ds = new PSXN_KetQua();
                             ds.MaChiDinh        = this.maChiDinhFocusHandle;
                             ds.MaDonVi          = this.maDonviFocusHandle;
                             ds.MaPhieu          = this.maPhieuFocusHandle;
                             ds.NgayLamXetNghiem = DateTime.Now.Date;
                             ds.NgayTiepNhan     = this.ngayTiepNhanFocusHandle;
                             ds.NgayChiDinh      = this.ngayChiDinhFocusHandle;
                             ds.MaTiepNhan       = this.maTiepNhanFocusHandle;
                             ds.MaXetNghiem      = this.maPhieuFocusHandle;
                             ds.MaGoiXN          = this.maGoiXNFocusHandle;
                             this.lstDaDanhMaXN.Add(ds);
                             this.maKT = bd - 1;
                             this.LuuDanhSachDaCapMa();
                         }
                     }
                     else
                     {
                         XtraMessageBox.Show("Lỗi khi cấp mã xét nghiệm: Không lấy được thông tin cấu hình của trung tâm.\r\n Vui lòng thử lại  hoặc liên hệ với quản trị viên kiểm tra lại thông tin cấu hình!", "BioNet - Chương trình sàng lọc sơ sinh!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     }
                 }
             }
         }
     }
     else
     {
         XtraMessageBox.Show("Đưa danh sách đã cấp mã vào phòng xét nghiệm hoặc hủy danh sách đã cấp mã và làm lại từ đầu", "BioNet - Chương trình sàng lọc sơ sinh!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }