Пример #1
0
        private void OnDisplayBenhNhanNgoaiGoiKhamList()
        {
            Result result = BenhNhanNgoaiGoiKhamBus.GetBenhNhanNgoaiGoiKhamList(_tuNgay, _denNgay, _tenBenhNhan, _type);

            if (result.IsOK)
            {
                MethodInvoker method = delegate
                {
                    ClearData();
                    DataTable dt = result.QueryResult as DataTable;
                    dgBenhNhanNgoaiGoiKham.DataSource = result.QueryResult as DataTable;
                    lbKetQuaTimDuoc.Text = string.Format("Kết quả tìm được: {0}", dt.Rows.Count);
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("BenhNhanNgoaiGoiKhamBus.GetBenhNhanNgoaiGoiKhamList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("BenhNhanNgoaiGoiKhamBus.GetBenhNhanNgoaiGoiKhamList"));
            }
        }
        private void OnSaveInfo()
        {
            try
            {
                MethodInvoker method = delegate
                {
                    List <BenhNhanNgoaiGoiKham> benhNhanNgoaiGoiKhamList = new List <BenhNhanNgoaiGoiKham>();
                    DataTable dt = dgBenhNhanNgoaiGoiKham.DataSource as DataTable;
                    foreach (DataRow row in dt.Rows)
                    {
                        BenhNhanNgoaiGoiKham bnngk    = new BenhNhanNgoaiGoiKham();
                        DateTime             ngayKham = DateTime.Now;
                        if (row["NgayKham"] != null && row["NgayKham"] != DBNull.Value)
                        {
                            ngayKham = Convert.ToDateTime(row["NgayKham"]);
                        }

                        bnngk.NgayKham    = ngayKham;
                        bnngk.PatientGUID = Guid.Parse(row["PatientGUID"].ToString());
                        bnngk.ServiceGUID = Guid.Parse(row["ServiceGUID"].ToString());
                        string lanDauStr = row["LanDauStr"].ToString();
                        bnngk.LanDau      = lanDauStr == "Lần đầu" ? (byte)0 : (byte)1;
                        bnngk.CreatedBy   = Guid.Parse(Global.UserGUID);
                        bnngk.CreatedDate = DateTime.Now;
                        benhNhanNgoaiGoiKhamList.Add(bnngk);
                    }

                    Result result = BenhNhanNgoaiGoiKhamBus.InsertBenhNhanNgoaiGoiKham(benhNhanNgoaiGoiKhamList);
                    if (!result.IsOK)
                    {
                        MsgBox.Show(this.Text, result.GetErrorAsString("BenhNhanNgoaiGoiKhamBus.InsertBenhNhanNgoaiGoiKham"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("BenhNhanNgoaiGoiKhamBus.InsertBenhNhanNgoaiGoiKham"));
                        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);
            }
        }
Пример #3
0
        private void OnDelete()
        {
            List <string>  deletedKeysList = new List <string>();
            List <DataRow> deletedRows     = new List <DataRow>();
            DataTable      dt = dgBenhNhanNgoaiGoiKham.DataSource as DataTable;

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

            if (deletedKeysList.Count > 0)
            {
                if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những bệnh nhân ngoài gói khám mà bạn đã đánh dấu ?") == DialogResult.Yes)
                {
                    foreach (DataRow row in deletedRows)
                    {
                        string nguoiTaoGUID = row["CreatedBy"].ToString();
                        if (nguoiTaoGUID != Global.UserGUID)
                        {
                            MsgBox.Show(Application.ProductName, "Bạn không thể xóa bệnh nhân ngoài gói khám do người khác tạo. Vui lòng kiểm tra lại.", IconType.Information);
                            return;
                        }
                    }

                    Result result = BenhNhanNgoaiGoiKhamBus.DeleteBenhNhanNgoaiGoiKham(deletedKeysList);
                    if (result.IsOK)
                    {
                        foreach (DataRow row in deletedRows)
                        {
                            dt.Rows.Remove(row);
                        }
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("BenhNhanNgoaiGoiKhamBus.DeleteBenhNhanNgoaiGoiKham"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("BenhNhanNgoaiGoiKhamBus.DeleteBenhNhanNgoaiGoiKham"));
                    }
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những bệnh nhân ngoài gói khám cần xóa.", IconType.Information);
            }
        }
Пример #4
0
        private void OnSaveInfo()
        {
            try
            {
                MethodInvoker method = delegate
                {
                    _benhNhanNgoaiGoiKham.UpdatedDate = DateTime.Now;
                    _benhNhanNgoaiGoiKham.DeletedBy   = Guid.Parse(Global.UserGUID);

                    _benhNhanNgoaiGoiKham.NgayKham    = dtpkNgayKham.Value;
                    _benhNhanNgoaiGoiKham.PatientGUID = Guid.Parse(cboBenhNhan.SelectedValue.ToString());
                    _benhNhanNgoaiGoiKham.ServiceGUID = Guid.Parse(cboService.SelectedValue.ToString());
                    _benhNhanNgoaiGoiKham.LanDau      = (byte)cboLanDauTaiKham.SelectedIndex;

                    Result result = BenhNhanNgoaiGoiKhamBus.UpdateBenhNhanNgoaiGoiKham(_benhNhanNgoaiGoiKham);
                    if (!result.IsOK)
                    {
                        MsgBox.Show(this.Text, result.GetErrorAsString("BenhNhanNgoaiGoiKhamBus.UpdateBenhNhanNgoaiGoiKham"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("BenhNhanNgoaiGoiKhamBus.UpdateBenhNhanNgoaiGoiKham"));
                        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);
            }
        }