예제 #1
0
 private void buttonReturnBed_Click(object sender, EventArgs e)
 {
     if (dataViewBed.SelectedRows.Count > 0)
     {
         int bedID = Convert.ToInt16(dataViewBed.SelectedRows[0].Cells[0].Value);
         int state = Convert.ToInt16(dataViewBed.SelectedRows[0].Cells[2].Value);
         if (state == 1)
         {
             DialogResult dialogResult = MessageBox.Show("Xác nhận trả giường", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (dialogResult == DialogResult.Yes)
             {
                 HospitalBed updateHB = HospitalBed.GetHospitalBed(bedID);
                 updateHB.Patient = 0;
                 updateHB.State   = 0;
                 if (HospitalBed.UpdateHospitalBed(updateHB) > 0)
                 {
                     MessageBox.Show("Trả giường thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else
         {
             MessageBox.Show("Giường bệnh trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         refreshDataViewBed();
     }
 }
예제 #2
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            if (!superValidator1.Validate())
            {
                return;
            }
            HBDetail.Patient = Convert.ToInt32(textBoxPatientID.Text);
            String str = comboBoxState.Items[comboBoxState.SelectedIndex].ToString();

            HBDetail.State = 1;
            if (Patient.IsPatientExist(HBDetail.Patient))
            {
                try
                {
                    if (!HospitalBed.CheckPatient(HBDetail.Patient))
                    {
                        if (HospitalBed.UpdateHospitalBed(HBDetail) > 0)
                        {
                            MessageBox.Show("Nhận giường thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Bệnh nhân đã nhận giường", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                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);
            }
        }