예제 #1
0
        private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((comboBox4.SelectedItem).ToString() != "- SELECT -")
            {
                comboBox5.Enabled = true;

                DbConnector dbConn = new DbConnector();
                dbConn.connect();

                BedSide bed = new BedSide();

                bed.Wing  = (comboBox2.SelectedItem).ToString();
                bed.Floor = (comboBox3.SelectedItem).ToString();
                bed.Bay   = (comboBox4.SelectedItem).ToString();

                BedSideHandler bedHnd = new BedSideHandler();
                comboBox5.DataSource = bedHnd.showBed(dbConn.getConn(), bed);
            }
            else
            {
                comboBox5.Enabled = false;

                comboBox5.SelectedIndex = 0;
            }
        }
예제 #2
0
        public List <BedSide> listBed(MySqlConnection conn, BedSide bedSide)
        {
            List <BedSide> listOfBed = new List <BedSide>();

            string sql = "SELECT bed FROM `bedside` WHERE wing='" + bedSide.Wing + "' AND floor='" +
                         bedSide.Floor + "' AND bay='" + bedSide.Bay + "' AND status=0;";

            MySqlCommand sqlComm = new MySqlCommand(sql, conn);

            using (MySqlDataReader sqlReader = sqlComm.ExecuteReader())
            {
                while (sqlReader.Read())
                {
                    BedSide aBed = new BedSide();

                    aBed.Bed = (string)sqlReader.GetValue(0);

                    Console.WriteLine(aBed.Bed);

                    listOfBed.Add(aBed);
                }
            }

            return(listOfBed);
        }