Example #1
0
        private void buttonRoomUpdate_Click(object sender, EventArgs e)
        {
            Inpatient inpatient = new Inpatient()
            {
                PatID       = int.Parse(comboBoxPatient.SelectedValue.ToString()),
                InPatID     = int.Parse(textBoxInpatientID.Text),
                RoomNo      = comboBoxRNo.SelectedValue.ToString(),
                Admission   = dateTimePickerDOA.Value.Date,
                Discharge   = dateTimePickerDOD.Value.Date,
                TotalAmount = int.Parse(textBox1.Text),
            };
            DatabaseOps databaseOps = new DatabaseOps();

            databaseOps.update(inpatient);
            display();
        }
Example #2
0
        private void buttonRoomInsert_Click(object sender, EventArgs e)
        {
            Inpatient inpatient = new Inpatient();

            inpatient.PatID       = int.Parse(comboBoxPatient.SelectedValue.ToString());
            inpatient.RoomNo      = comboBoxRNo.SelectedValue.ToString();
            inpatient.Admission   = dateTimePickerDOA.Value.Date;
            inpatient.Discharge   = dateTimePickerDOD.Value.Date;
            inpatient.TotalAmount = int.Parse(textBox1.Text);
            DatabaseOps databaseOps = new DatabaseOps();

            if (inpatient.ifinpatientalreadyexisted(inpatient.PatID, inpatient.Admission) == true)
            {
                databaseOps.insert(inpatient);
                databaseOps.updateRoomAvailability(Convert.ToInt32(inpatient.RoomNo), "Unavailable");
            }
            else
            {
                MessageBox.Show("Unable to Assign room because room already assignes", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            display();
        }