Esempio n. 1
0
        /// <summary>
        /// This function is called when a user click on "addChargesButton" button.
        /// It will pop-up AddCharges form as a modal dialog which will allow the
        /// user to add Room Service charges or Restaurant charges for
        /// the selected booking.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addChargesButton_Click(object sender, EventArgs e)
        {
            //Display AddCharges form as modal dialog
            AddCharges objectAddCharges = new AddCharges(objectBookingInformation);

            objectAddCharges.ShowDialog();

            restaurantTextBox.Text  = objectBookingInformation.restaurantCharges.ToString();
            roomServiceTextBox.Text = objectBookingInformation.roomServiceCharges.ToString();
            totalTextBox.Text       = objectBookingInformation.getTotalCharges().ToString();

            OdbcCommand objectOdbcCommand = objectOdbcConnection.CreateCommand();

            objectOdbcCommand.CommandText = "update booking set roomServCharges=?, restaurantCharges=?, "
                                            + " totalPrice = ? where"
                                            + " bookingId = ?";
            objectOdbcCommand.Parameters.Add("roomServCharges", OdbcType.Decimal).Value
                = Convert.ToDecimal(roomServiceTextBox.Text.Trim());
            objectOdbcCommand.Parameters.Add("restaurantCharges", OdbcType.Decimal).Value
                = Convert.ToDecimal(restaurantTextBox.Text.Trim());
            objectOdbcCommand.Parameters.Add("totalPrice", OdbcType.Decimal).Value
                = Convert.ToDecimal(totalTextBox.Text.Trim());
            objectOdbcCommand.Parameters.Add("bookingID", OdbcType.NVarChar).Value
                = bookingIDTextBox.Text.Trim();
            objectOdbcCommand.ExecuteNonQuery();
        }
Esempio n. 2
0
        /// <summary>
        /// This function is called when a user click on "addChargesButton" button.
        /// It will pop-up AddCharges form as a modal dialog which will allow the 
        /// user to add Room Service charges or Restaurant charges for
        /// the selected booking.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addChargesButton_Click(object sender, EventArgs e)
        {
            //Display AddCharges form as modal dialog
            AddCharges objectAddCharges = new AddCharges(objectBookingInformation);
            objectAddCharges.ShowDialog();

            restaurantTextBox.Text = objectBookingInformation.restaurantCharges.ToString();
            roomServiceTextBox.Text = objectBookingInformation.roomServiceCharges.ToString();
            totalTextBox.Text = objectBookingInformation.getTotalCharges().ToString();

            OdbcCommand objectOdbcCommand = objectOdbcConnection.CreateCommand();
            objectOdbcCommand.CommandText = "update booking set roomServCharges=?, restaurantCharges=?, "
                                            + " totalPrice = ? where"
                                            + " bookingId = ?";
            objectOdbcCommand.Parameters.Add("roomServCharges", OdbcType.Decimal).Value
                = Convert.ToDecimal(roomServiceTextBox.Text.Trim());
            objectOdbcCommand.Parameters.Add("restaurantCharges", OdbcType.Decimal).Value
                = Convert.ToDecimal(restaurantTextBox.Text.Trim());
            objectOdbcCommand.Parameters.Add("totalPrice", OdbcType.Decimal).Value
                = Convert.ToDecimal(totalTextBox.Text.Trim());
            objectOdbcCommand.Parameters.Add("bookingID", OdbcType.NVarChar).Value
                = bookingIDTextBox.Text.Trim();
            objectOdbcCommand.ExecuteNonQuery();
        }