コード例 #1
0
        private void OnSaveInfo()
        {
            try
            {
                _xetNghiem.Status = (byte)Status.Actived;

                if (_isNew)
                {
                    _xetNghiem.CreatedDate = DateTime.Now;
                    _xetNghiem.CreatedBy   = Guid.Parse(Global.UserGUID);
                }
                else
                {
                    _xetNghiem.UpdatedDate = DateTime.Now;
                    _xetNghiem.UpdatedBy   = Guid.Parse(Global.UserGUID);
                }

                MethodInvoker method = delegate
                {
                    _xetNghiem.Fullname     = txtTenXetNghiem.Text;
                    _xetNghiem.TenXetNghiem = txtTenXetNghiem.Text;
                    _xetNghiem.Type         = GetLoaiXetNghiem();
                    _xetNghiem.GroupID      = (int)numThuTuNhom.Value;
                    _xetNghiem.GroupName    = cboNhomXetNghiem.Text;
                    _xetNghiem.Order        = (int)numThuTu.Value;

                    List <ChiTietXetNghiem_Manual> ctxns = _uNormal.GetChiTietXetNghiem_ManualList();
                    if (ctxns == null)
                    {
                        ctxns = new List <ChiTietXetNghiem_Manual>();
                    }

                    Result result = XetNghiemTayBus.InsertXetNghiem(_xetNghiem, ctxns);
                    if (!result.IsOK)
                    {
                        MsgBox.Show(this.Text, result.GetErrorAsString("XetNghiemTayBus.InsertXetNghiem"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiemTayBus.InsertXetNghiem"));
                        this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                    }
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            catch (Exception e)
            {
                MsgBox.Show(this.Text, e.Message, IconType.Error);
                Utility.WriteToTraceLog(e.Message);
            }
        }
コード例 #2
0
        public bool CheckInfo()
        {
            if (txtTenXetNghiem.Text.Trim() == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng nhập tên xét nghiệm.", IconType.Information);
                txtTenXetNghiem.Focus();
                return(false);
            }

            if (cboLoaiXetNghiem.Text == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng chọn loại xét nghiệm.", IconType.Information);
                cboLoaiXetNghiem.Focus();
                return(false);
            }

            if (cboNhomXetNghiem.Text == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng nhập nhóm xét nghiệm.", IconType.Information);
                cboNhomXetNghiem.Focus();
                return(false);
            }

            string xetNghiem_ManualGUID = _isNew ? string.Empty : _xetNghiem.XetNghiem_ManualGUID.ToString();
            string groupName            = cboNhomXetNghiem.Text;
            Result result = XetNghiemTayBus.CheckTenXetNghiemExist(xetNghiem_ManualGUID, txtTenXetNghiem.Text, groupName);

            if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST)
            {
                if (result.Error.Code == ErrorCode.EXIST)
                {
                    MsgBox.Show(this.Text, "Tên xét nghiệm này đã tồn tại rồi. Vui lòng nhập tên khác.", IconType.Information);
                    txtTenXetNghiem.Focus();
                    return(false);
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("XetNghiemTayBus.CheckTenXetNghiemExist"), IconType.Error);
                return(false);
            }

            if (!_uNormal.CheckInfo())
            {
                _uNormal.Focus();
                return(false);
            }

            return(true);
        }
コード例 #3
0
        private void InitData()
        {
            Result result = XetNghiemTayBus.GetDonViList();

            if (result.IsOK)
            {
                DataTable dt = result.QueryResult as DataTable;
                _uNormal_Chung.DonViList = dt;
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("XetNghiemTayBus.GetDonViList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiemTayBus.GetDonViList"));
            }
        }
コード例 #4
0
        private void InitData()
        {
            Result result = XetNghiemTayBus.GetXetNghiemList();

            if (result.IsOK)
            {
                _dtXetNghiem = result.QueryResult as DataTable;
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiemTayBus.GetXetNghiemList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiemTayBus.GetXetNghiemList"));
            }

            dtpkNgayXetNghiem.Value = DateTime.Now;
        }
コード例 #5
0
        private void OnDelete()
        {
            if (_dataSource == null)
            {
                return;
            }
            //UpdateChecked();
            List <string>  deletedServiceList = new List <string>();
            List <DataRow> deletedRows        = new List <DataRow>();
            DataTable      dt = _dataSource;

            foreach (DataRow row in dt.Rows)
            {
                if (Boolean.Parse(row["Checked"].ToString()))
                {
                    deletedServiceList.Add(row["ServiceGUID"].ToString());
                    deletedRows.Add(row);
                }
            }

            if (deletedServiceList.Count > 0)
            {
                if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những xét nghiệm mà bạn đã đánh dấu ?") == DialogResult.Yes)
                {
                    Result result = XetNghiemTayBus.DeleteXetNghiem(deletedServiceList);
                    if (result.IsOK)
                    {
                        foreach (DataRow row in deletedRows)
                        {
                            _dictXetNghiemTay.Remove(row["XetNghiem_ManualGUID"].ToString());
                            _dataSource.Rows.Remove(row);
                        }

                        OnSearchXetNghiem();
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiemTayBus.DeleteXetNghiem"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiemTayBus.DeleteXetNghiem"));
                    }
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những xét nghiệm cần xóa.", IconType.Information);
            }
        }
コード例 #6
0
        private void OnAdd()
        {
            DataTable dtChiTietKQXN = dgChiTiet.DataSource as DataTable;

            if (dtChiTietKQXN == null)
            {
                return;
            }
            dlgAddNhomXetNghiemTay dlg = new dlgAddNhomXetNghiemTay();

            if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                List <string> nhomXNList = dlg.NhomXetNghiemList;
                foreach (string nhomXN in nhomXNList)
                {
                    Result result = XetNghiemTayBus.GetDanhSachXetNghiemTheoNhom(nhomXN);
                    if (!result.IsOK)
                    {
                        MsgBox.Show(this.Text, result.GetErrorAsString("XetNghiemTayBus.GetDanhSachXetNghiemTheoNhom"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiemTayBus.GetDanhSachXetNghiemTheoNhom"));
                        return;
                    }

                    List <XetNghiem_Manual> xetNghiemList = result.QueryResult as List <XetNghiem_Manual>;
                    foreach (var xn in xetNghiemList)
                    {
                        DataRow newRow = dtChiTietKQXN.NewRow();
                        newRow["Checked"] = false;
                        newRow["ChiTietKetQuaXetNghiem_ManualGUID"] = Guid.NewGuid();
                        newRow["XetNghiem_ManualGUID"] = xn.XetNghiem_ManualGUID.ToString();
                        newRow["TenXetNghiem"]         = xn.Fullname;
                        newRow["Fullname"]             = xn.Fullname;
                        newRow["GroupName"]            = xn.GroupName;
                        newRow["TestResult"]           = string.Empty;
                        newRow["TinhTrang"]            = (byte)TinhTrang.BinhThuong;
                        newRow["LamThem"]       = false;
                        newRow["NgayXetNghiem"] = dlg.NgayXetNghiem;
                        newRow["NgayXNStr"]     = dlg.NgayXetNghiem.ToString("dd/MM/yyyy HH:mm:ss");
                        newRow["HasHutThuoc"]   = false;
                        dtChiTietKQXN.Rows.Add(newRow);
                    }
                }
            }
        }
コード例 #7
0
        private void InitData()
        {
            Cursor.Current = Cursors.WaitCursor;
            Result result = XetNghiemTayBus.GetNhomXetNghiemList();

            if (result.IsOK)
            {
                DataTable dt = result.QueryResult as DataTable;
                foreach (DataRow row in dt.Rows)
                {
                    lvNhomXN.Items.Add(row[0].ToString());
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiemTayBus.GetNhomXetNghiemList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiemTayBus.GetNhomXetNghiemList"));
            }

            dtpkNgayXetNghiem.Value = DateTime.Now;
        }
コード例 #8
0
        private void OnDisplayXetNghiemList()
        {
            Result result = XetNghiemTayBus.GetXetNghiemList();

            if (result.IsOK)
            {
                MethodInvoker method = delegate
                {
                    ClearData();
                    _dataSource = result.QueryResult as DataTable;

                    if (_dictXetNghiemTay == null)
                    {
                        _dictXetNghiemTay = new Dictionary <string, DataRow>();
                    }
                    foreach (DataRow row in _dataSource.Rows)
                    {
                        string xetNghiem_ManualGUID = row["XetNghiem_ManualGUID"].ToString();
                        _dictXetNghiemTay.Add(xetNghiem_ManualGUID, row);
                    }

                    OnSearchXetNghiem();
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiemTayBus.GetXetNghiemList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiemTayBus.GetXetNghiemList"));
            }
        }
コード例 #9
0
        private void InitData()
        {
            Result result = XetNghiemTayBus.GetDonViList();

            if (result.IsOK)
            {
                DataTable dt = result.QueryResult as DataTable;
                _uNormal.DonViList = dt;
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("XetNghiemTayBus.GetDonViList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiemTayBus.GetDonViList"));
            }

            result = XetNghiemTayBus.GetNhomXetNghiemList();
            if (result.IsOK)
            {
                DataTable dt = result.QueryResult as DataTable;
                //cboNhomXetNghiem.Items.Add(string.Empty);
                foreach (DataRow row in dt.Rows)
                {
                    string nhomXetNghiem = row[0].ToString().Trim();
                    if (nhomXetNghiem == string.Empty)
                    {
                        continue;
                    }
                    cboNhomXetNghiem.Items.Add(nhomXetNghiem);
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("XetNghiemTayBus.GetNhomXetNghiemList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiemTayBus.GetNhomXetNghiemList"));
            }
        }
コード例 #10
0
        private void DisplayInfo()
        {
            try
            {
                txtTenXetNghiem.Text  = _drXetNghiem["Fullname"] as string;
                cboLoaiXetNghiem.Text = Utility.GetLoaiXetNghiem(_drXetNghiem["Type"].ToString());
                numThuTuNhom.Value    = Convert.ToInt32(_drXetNghiem["GroupID"]);
                numThuTu.Value        = Convert.ToInt32(_drXetNghiem["Order"]);
                if (_drXetNghiem["GroupName"] != null && _drXetNghiem["GroupName"] != DBNull.Value)
                {
                    cboNhomXetNghiem.Text = _drXetNghiem["GroupName"].ToString();
                }

                _xetNghiem.XetNghiem_ManualGUID = Guid.Parse(_drXetNghiem["XetNghiem_ManualGUID"].ToString());

                if (_drXetNghiem["CreatedDate"] != null && _drXetNghiem["CreatedDate"] != DBNull.Value)
                {
                    _xetNghiem.CreatedDate = Convert.ToDateTime(_drXetNghiem["CreatedDate"]);
                }

                if (_drXetNghiem["CreatedBy"] != null && _drXetNghiem["CreatedBy"] != DBNull.Value)
                {
                    _xetNghiem.CreatedBy = Guid.Parse(_drXetNghiem["CreatedBy"].ToString());
                }

                if (_drXetNghiem["UpdatedDate"] != null && _drXetNghiem["UpdatedDate"] != DBNull.Value)
                {
                    _xetNghiem.UpdatedDate = Convert.ToDateTime(_drXetNghiem["UpdatedDate"]);
                }

                if (_drXetNghiem["UpdatedBy"] != null && _drXetNghiem["UpdatedBy"] != DBNull.Value)
                {
                    _xetNghiem.UpdatedBy = Guid.Parse(_drXetNghiem["UpdatedBy"].ToString());
                }

                if (_drXetNghiem["DeletedDate"] != null && _drXetNghiem["DeletedDate"] != DBNull.Value)
                {
                    _xetNghiem.DeletedDate = Convert.ToDateTime(_drXetNghiem["DeletedDate"]);
                }

                if (_drXetNghiem["DeletedBy"] != null && _drXetNghiem["DeletedBy"] != DBNull.Value)
                {
                    _xetNghiem.DeletedBy = Guid.Parse(_drXetNghiem["DeletedBy"].ToString());
                }

                _xetNghiem.Status = Convert.ToByte(_drXetNghiem["Status"]);

                Result result = XetNghiemTayBus.GetChiTietXetNghiemList2(_xetNghiem.XetNghiem_ManualGUID.ToString());
                if (result.IsOK)
                {
                    List <ChiTietXetNghiem_Manual> ctxns = result.QueryResult as List <ChiTietXetNghiem_Manual>;
                    _uNormal.SetChiTietXetNghiem_ManualList(ctxns);

                    if (!_allowEdit)
                    {
                        gbXetNghiem.Enabled = _allowEdit;
                        btnOK.Enabled       = _allowEdit;
                    }
                }
                else
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiemTayBus.GetChiTietXetNghiemList"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiemTayBus.GetChiTietXetNghiemList"));
                }
            }
            catch (Exception e)
            {
                MsgBox.Show(this.Text, e.Message, IconType.Error);
                Utility.WriteToTraceLog(e.Message);
            }
        }