private void OnDisplayTrieuChungList()
        {
            lock (ThisLock)
            {
                Result result = SymptomBus.GetSymptomList(_name, _type);
                if (result.IsOK)
                {
                    dgSymptom.Invoke(new MethodInvoker(delegate()
                    {
                        ClearData();

                        DataTable dt = result.QueryResult as DataTable;
                        if (_dtTemp == null)
                        {
                            _dtTemp = dt.Clone();
                        }
                        UpdateChecked(dt);
                        dgSymptom.DataSource = dt;
                    }));
                }
                else
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("ThuocBus.GetThuocList"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("ThuocBus.GetThuocList"));
                }
            }
        }
Beispiel #2
0
        private void OnSaveInfo()
        {
            try
            {
                _symptom.Code        = txtCode.Text;
                _symptom.SymptomName = txtSymptom.Text;
                _symptom.Advice      = txtAdvice.Text;
                _symptom.Status      = (byte)Status.Actived;

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

                Result result = SymptomBus.InsertSymptom(_symptom);
                if (!result.IsOK)
                {
                    MsgBox.Show(this.Text, result.GetErrorAsString("SymptomBus.InsertSymptom"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("SymptomBus.InsertSymptom"));
                    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                }
            }
            catch (Exception e)
            {
                MsgBox.Show(this.Text, e.Message, IconType.Error);
                Utility.WriteToTraceLog(e.Message);
            }
        }
Beispiel #3
0
        private void OnDeleteSymptom()
        {
            if (_dictSymptom == null)
            {
                return;
            }

            List <string>  deletedSympList = new List <string>();
            List <DataRow> deletedRows     = _dictSymptom.Values.ToList <DataRow>();

            foreach (DataRow row in deletedRows)
            {
                deletedSympList.Add(row["SymptomGUID"].ToString());
            }

            if (deletedSympList.Count > 0)
            {
                if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những triệu chứng mà bạn đã đánh dấu ?") == DialogResult.Yes)
                {
                    Result result = SymptomBus.DeleteSymptom(deletedSympList);
                    if (result.IsOK)
                    {
                        DataTable dt = dgSymptom.DataSource as DataTable;
                        if (dt == null || dt.Rows.Count <= 0)
                        {
                            return;
                        }

                        foreach (string key in deletedSympList)
                        {
                            DataRow[] rows = dt.Select(string.Format("SymptomGUID='{0}'", key));
                            if (rows == null || rows.Length <= 0)
                            {
                                continue;
                            }
                            dt.Rows.Remove(rows[0]);
                        }

                        _dictSymptom.Clear();
                        _dtTemp.Rows.Clear();
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("SymptomBus.DeleteSymptom"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("SymptomBus.DeleteSymptom"));
                    }
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những triệu chứng cần xóa.", IconType.Information);
            }
        }
Beispiel #4
0
        private void GenerateCode()
        {
            Cursor.Current = Cursors.WaitCursor;
            Result result = SymptomBus.GetSymptomCount();

            if (result.IsOK)
            {
                int count = Convert.ToInt32(result.QueryResult);
                txtCode.Text = Utility.GetCode("TC", count + 1, 4);
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("SymptomBus.GetSymptomCount"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("SymptomBus.GetSymptomCount"));
            }
        }
Beispiel #5
0
        private void InitData()
        {
            dtpkNgay.Value = DateTime.Now;

            //DocStaff
            List <byte> staffTypes = new List <byte>();

            staffTypes.Add((byte)StaffType.BacSi);
            staffTypes.Add((byte)StaffType.BacSiSieuAm);
            staffTypes.Add((byte)StaffType.BacSiNgoaiTongQuat);
            staffTypes.Add((byte)StaffType.BacSiNoiTongQuat);
            staffTypes.Add((byte)StaffType.BacSiPhuKhoa);
            Result result = DocStaffBus.GetDocStaffList(staffTypes);

            if (!result.IsOK)
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("DocStaffBus.GetDocStaffList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("DocStaffBus.GetDocStaffList"));
                return;
            }
            else
            {
                cboDocStaff.DataSource = result.QueryResult;
            }

            if (Global.StaffType == StaffType.BacSi || Global.StaffType == StaffType.BacSiSieuAm ||
                Global.StaffType == StaffType.BacSiNgoaiTongQuat || Global.StaffType == StaffType.BacSiNoiTongQuat ||
                Global.StaffType == StaffType.BacSiPhuKhoa)
            {
                cboDocStaff.SelectedValue = Global.UserGUID;
                cboDocStaff.Enabled       = false;
            }

            //Symptom
            result = SymptomBus.GetSymptomList();
            if (!result.IsOK)
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("SymptomBus.GetSymptomList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("SymptomBus.GetSymptomList"));
                return;
            }
            else
            {
                cboTrieuChung.DataSource = result.QueryResult;
            }
        }
Beispiel #6
0
        private bool CheckInfo()
        {
            if (txtCode.Text.Trim() == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng nhập mã triệu chứng.", IconType.Information);
                txtCode.Focus();
                return(false);
            }

            if (txtSymptom.Text.Trim() == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng nhập triệu chứng.", IconType.Information);
                txtSymptom.Focus();
                return(false);
            }

            if (txtAdvice.Text.Trim() == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng nhập lời khuyên.", IconType.Information);
                txtAdvice.Focus();
                return(false);
            }

            string sympGUID = _isNew ? string.Empty : _symptom.SymptomGUID.ToString();
            Result result   = SymptomBus.CheckSymptomExistCode(sympGUID, txtCode.Text);

            if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST)
            {
                if (result.Error.Code == ErrorCode.EXIST)
                {
                    MsgBox.Show(this.Text, "Mã triệu chứng này đã tồn tại rồi. Vui lòng nhập mã khác.", IconType.Information);
                    txtCode.Focus();
                    return(false);
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("SymptomBus.CheckSymptomExistCode"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("SymptomBus.CheckSymptomExistCode"));
                return(false);
            }

            return(true);
        }