Example #1
0
        private void button19_Click(object sender, EventArgs e)//addward btn
        {
            try
            {
                if (checkRoom(comboBox5.Text.Last().ToString(), comboBox2.Text.Last().ToString()))//checking for existing room
                {
                    MessageBox.Show("You have already created this room!", "Room already created", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Please select valid input", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int    floornumber;
            int    roomnumber;
            string roomtype;
            string roomfee;

            try
            {
                floornumber = int.Parse(comboBox2.Text.Last().ToString());
                roomnumber  = int.Parse(comboBox5.Text.Last().ToString());
                roomtype    = comboBox6.Text;
                roomfee     = textBox6.Text;
                try
                {
                    hospitalwards addWard = new hospitalwards();
                    addWard.addWard(roomnumber, roomtype, roomfee, floornumber);
                    MessageBox.Show("Successfully added new ward", "Ward added", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception)
                {
                    MessageBox.Show("Please take a look at the input!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Please enter correct input", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            comboBox9.Items.Clear();
            hospitalwards roomInfo = new hospitalwards();
            List <string> floors   = roomInfo.countfloors();

            foreach (var item in floors)
            {
                comboBox9.Items.Add(item);
            }
            comboBox8.Enabled = false;
            comboBox8.Items.Clear();
        }
Example #2
0
File: Admin.cs Project: M3dic/M3dic
        private void button5_Click(object sender, EventArgs e)//add new ward button
        {
            addwardclear();
            hidepanels();
            panel5.Visible = true;
            comboBox9.Items.Clear();
            comboBox8.Items.Clear();
            hospitalwards roomInfo = new hospitalwards();
            List <string> floors   = roomInfo.countfloors();

            foreach (var item in floors)
            {
                comboBox9.Items.Add(item);
            }
        }