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
        private void comboBox9_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBox8.Items.Clear();
            comboBox8.Enabled = true;
            comboBox8.Text    = null;
            textBox22.Text    = "0";
            hospitalwards roomInfo = new hospitalwards();
            List <string> rooms    = roomInfo.countrooms(comboBox9.Text);

            foreach (var item in rooms)
            {
                comboBox8.Items.Add(item);
            }
        }
Example #3
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);
            }
        }
Example #4
0
 private void button20_Click(object sender, EventArgs e)//update btn
 {
     try
     {
         if (validinput())
         {
             hospitalwards updateWard = new hospitalwards();
             updateWard.WardUpdate(int.Parse(comboBox5.Text.Last().ToString()), comboBox6.Text, textBox6.Text, int.Parse(comboBox2.Text.Last().ToString()));
             MessageBox.Show("Room successfully updated!", "Room updated", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("Invalid input", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Invalid input", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #5
0
 private void button21_Click(object sender, EventArgs e)//addbedd
 {
     try
     {
         if (floor(comboBox9.Text) && room(comboBox8.Text))
         {
             hospitalwards addebd = new hospitalwards();
             addebd.addBED(int.Parse(comboBox9.Text), int.Parse(comboBox8.Text));
             textBox22.Text = addebd.countbeds(comboBox8.Text, comboBox9.Text);
             MessageBox.Show($"Successfully added new bed in room {comboBox8.Text}", "Bed added", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("Please select valid floor and room", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Please select valid floor and room", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #6
0
 private void comboBox8_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox8.Text != "")
     {
         try
         {
             hospitalwards hospitalwards1 = new hospitalwards();
             beds = hospitalwards1.numberofbeds(int.Parse(comboBox9.Text), int.Parse(comboBox8.Text));
         }
         catch (Exception)
         {
             beds = null;
         }
         if (beds == null)
         {
             textBox22.Text = "0";
         }
         else
         {
             textBox22.Text = beds;
         }
     }
 }
Example #7
0
        private bool floor(string text)
        {
            hospitalwards floor = new hospitalwards();

            return(floor.searchfloor(text));
        }
Example #8
0
        private bool room(string text)
        {
            hospitalwards room = new hospitalwards();

            return(room.searchroom(text));
        }
Example #9
0
        private bool checkRoom(string text, string text1)//true/false
        {
            hospitalwards checkroom = new hospitalwards();

            return(checkroom.checkRom(text, text1));
        }