示例#1
0
        //Add a new heath file
        private void buttonHealthFile_Click(object sender, EventArgs e)
        {
            if (dataViewPatient.SelectedRows.Count > 0)
            {
                int patientID = Convert.ToInt32(dataViewPatient.SelectedRows[0].Cells[0].Value);
                int state     = Patient.GetPatient(patientID).State;

                if (state == 1)
                {
                    if (!HeathFile.DidPatientHaveHF(patientID))
                    {
                        FormHFDetail formHFD = new FormHFDetail(patientID);
                        formHFD.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Bệnh nhân đã có bệnh án", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Bệnh nhân chưa nhập viện", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
示例#2
0
        private void buttonOk_Click(object sender, System.EventArgs e)
        {
            if (!superValidator1.Validate())
            {
                return;
            }
            if (Patient.IsPatientExist(int.Parse(textBoxPatientID.Text)))
            {
                try
                {
                    if (UserAction == "edit")
                    {
                        HeathFile newHF = new HeathFile();
                        newHF.HeathFileID  = int.Parse(textBoxHFID.Text);
                        newHF.PatientID    = int.Parse(textBoxPatientID.Text);
                        newHF.PatientState = textBoxPatientState.Text;
                        newHF.PreHistory   = textBoxPrehistory.Text;
                        newHF.Disease      = textBoxDisease.Text;
                        newHF.Treament     = textBoxTreatment.Text;
                        newHF.Date         = dateCreate.Value;
                        DialogResult dialogResult = MessageBox.Show("Xác nhận cập nhập thông tin bệnh án", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (dialogResult == DialogResult.Yes)
                        {
                            if (HeathFile.UpdateHeathFile(newHF) > 0)
                            {
                                MessageBox.Show("Cập nhập thông tin bệnh án thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                    else
                    {
                        if (HeathFile.DidPatientHaveHF(int.Parse(textBoxPatientID.Text)))
                        {
                            MessageBox.Show("Bệnh nhân đã có bệnh án", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            HeathFile newHF = new HeathFile();
                            newHF.HeathFileID  = 0;
                            newHF.PatientID    = int.Parse(textBoxPatientID.Text);
                            newHF.PatientState = textBoxPatientState.Text;
                            newHF.PreHistory   = textBoxPrehistory.Text;
                            newHF.Disease      = textBoxDisease.Text;
                            newHF.Treament     = textBoxTreatment.Text;
                            newHF.Date         = dateCreate.Value;
                            if (HeathFile.InsertHeathFile(newHF) > 0)
                            {
                                MessageBox.Show("Thêm bệnh á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);
                }
            }
            else
            {
                MessageBox.Show("Bệnh nhân không tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            this.Close();
        }