Example #1
0
 //This constructor for update, confirm feature
 public FormDCDetail(DischargeCertificate dcDetail, String userAction)
 {
     InitializeComponent();
     this.DCDetail   = dcDetail;
     this.UserAction = userAction;
     SetDCForUpdate(dcDetail);
 }
Example #2
0
        private void buttonDCDelete_Click(object sender, EventArgs e)
        {
            if (dataViewDC.SelectedRows.Count > 0)
            {
                int dcID  = Convert.ToInt32(dataViewDC.SelectedRows[0].Cells[0].Value);
                int state = Convert.ToInt16(dataViewDC.SelectedRows[0].Cells[4].Value);

                if (state != 1)
                {
                    DialogResult dialogResult = MessageBox.Show("Xác nhận xóa giấy xuất viện", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (dialogResult == DialogResult.Yes)
                    {
                        if (DischargeCertificate.DeleteDC(dcID) > 0)
                        {
                            MessageBox.Show("Xóa giấy xuất viện thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Không thể xóa giấy xuất viện đã được xác nhận", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                refreshDataViewDC();
            }
        }
Example #3
0
        //Refresh datagridview in Discharge tab
        private void refreshDataViewDC()
        {
            try
            {
                // Get Discharge's datatable
                DataTable dcTable = DischargeCertificate.GetListDC();

                // Add Vietnamese column's name
                dcTable.Columns.Add("Mã giấy xuất viện", typeof(string), "[DCID]");
                dcTable.Columns.Add("Mã bệnh nhân", typeof(string), "[PATIENTID]");
                dcTable.Columns.Add("Mã nhân viên", typeof(string), "[STAFFID]");
                dcTable.Columns.Add("Ngày lập", typeof(DateTime), "[DATE]");
                dcTable.Columns.Add("Trạng thái", typeof(string), "IIF([STATE] = 0, 'Chưa xác nhận', 'Đã xác nhận')");
                // Set data source to dataview for searching
                dataViewDC.DataSource = dcTable.DefaultView;

                // Hide English columns'name
                for (int i = 0; i < 5; i++)
                {
                    dataViewDC.Columns[i].Visible = false;
                }
            }
            catch
            {
                MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
 private void SetDCForUpdate(DischargeCertificate dcDetail)
 {
     textBoxDCID.Text            = dcDetail.DCID.ToString();
     textBoxPatientID.Text       = dcDetail.PatientID.ToString();
     textBoxStaffID.Text         = dcDetail.StaffID.ToString();
     dateDischarge.Value         = dcDetail.Date;
     comboBoxState.SelectedIndex = dcDetail.State;
     comboBoxState.Enabled       = false;
 }
Example #5
0
        private void buttonDCUpdate_Click(object sender, EventArgs e)
        {
            if (dataViewDC.SelectedRows.Count > 0)
            {
                int dcID = Convert.ToInt32(dataViewDC.SelectedRows[0].Cells[0].Value);
                DischargeCertificate updateDC = DischargeCertificate.GetDC(dcID);
                FormDCDetail         formDCD  = new FormDCDetail(updateDC, "edit");
                formDCD.ShowDialog();

                refreshDataViewDC();
            }
        }
Example #6
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     try
     {
         DischargeCertificate newDC = new DischargeCertificate();
         newDC.PatientID = Convert.ToInt32(textBoxPatientID.Text);
         newDC.StaffID   = Convert.ToInt32(textBoxStaffID.Text);
         newDC.Date      = dateDischarge.Value;
         newDC.State     = comboBoxState.SelectedIndex;
         if (UserAction == "edit")
         {
             newDC.DCID = Convert.ToInt32(textBoxDCID.Text);
             DialogResult dialogResult = MessageBox.Show("Xác nhận cập nhập thông tin giấy xuất viện", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (dialogResult == DialogResult.Yes)
             {
                 if (DischargeCertificate.UpdateDC(newDC) > 0)
                 {
                     MessageBox.Show("Cập nhập thông tin giấy xuất viện thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             if (DischargeCertificate.IsPatientHadDC(Convert.ToInt32(textBoxPatientID.Text)))
             {
                 MessageBox.Show("Bệnh nhân đã có giấy xuất viện", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
             else
             {
                 newDC.DCID = 0;
                 if (DischargeCertificate.InsertDC(newDC) > 0)
                 {
                     MessageBox.Show("Thêm giấy xuất viện thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
     }
     catch
     {
         MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     this.Close();
 }
Example #7
0
        private void buttonDCConfirm_Click(object sender, EventArgs e)
        {
            if (dataViewDC.SelectedRows.Count > 0)
            {
                int dcID  = Convert.ToInt32(dataViewDC.SelectedRows[0].Cells[0].Value);
                int state = Convert.ToInt16(dataViewDC.SelectedRows[0].Cells[4].Value);

                if (state != 1)
                {
                    DischargeCertificate confirmDC = DischargeCertificate.GetDC(dcID);
                    if (HospitalBed.ConfirmPatient(confirmDC.PatientID))
                    {
                        if (Bill.ConfirmPatient(confirmDC.PatientID))
                        {
                            DialogResult dialogResult = MessageBox.Show("Xác nhận giấy xuất viện", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                            if (dialogResult == DialogResult.Yes)
                            {
                                Patient updatePatient = Patient.GetPatient(confirmDC.PatientID);
                                updatePatient.State = 0;
                                confirmDC.State     = 1;
                                if (DischargeCertificate.UpdateDC(confirmDC) > 0 && Patient.UpdatePatient(updatePatient) > 0)
                                {
                                    MessageBox.Show("Xác nhận giấy xuất viện thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Bệnh nhân chưa thanh toán hóa đơn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Bệnh nhân chưa trả giường", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Giấy xuất viện đã được xác nhận", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                refreshDataViewDC();
            }
        }