Beispiel #1
0
        private void roomTypeListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (roomTypeListBox.SelectedIndex == 1)
            {
                TwinBedCheck.Show();
            }
            else
            {
                TwinBedCheck.Hide();
            }
            roomList();
            SqlCommand cmd = new SqlCommand("SELECT * from Billing where Room='" + roomTypeListBox.Text + "'", con);

            con.Open();
            cmd.ExecuteNonQuery();
            SqlDataReader dr;

            dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                string priceSH = (string)dr["PriceShRoom"].ToString();
                nisPerNight.Text = priceSH;
            }
            con.Close();
        }
Beispiel #2
0
        public void NewReservation_Load(object sender, EventArgs e)
        {
            TwinBedCheck.Hide();
            string     queryRoo = "Select * from Billing";
            SqlCommand cmd      = new SqlCommand(queryRoo, con);

            try
            {
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    roomTypeListBox.Items.Add(reader[2]).ToString();
                    dinningListBox.Items.Add(reader[1]).ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            con.Close();
            if (string.IsNullOrEmpty(dinningPerNight.Text))
            {
                dinningPerNight.Text = "0";
            }
            if (string.IsNullOrEmpty(totalNis.Text))
            {
                totalNis.Text = "0";
            }
            if (string.IsNullOrEmpty(noOfNights.Text))
            {
                noOfNights.Text = "0";
            }
            if (string.IsNullOrEmpty(nisPerNight.Text))
            {
                nisPerNight.Text = "0";
            }
        }