コード例 #1
0
        // Load data from guest and billing_item tables into listboxes
        private void LoadDataFolio()
        {
            // Fetch dataset for guestlist
            DataSet guestListDS = DBGetData.GetGuestList();

            if (guestListDS != null)
            {
                // No tables fetched
                if (guestListDS.Tables.Count == 0)
                {
                    MessageBox.Show("No guest datatable found, contact administrator.");
                    return;
                }
                // No rows fetched
                else if (guestListDS.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("No datarows found in guest table.");
                    return;
                }

                // Set the dataset as source for listbox
                listBoxGuest.ValueMember   = "guestid";
                listBoxGuest.DisplayMember = "guest_name";
                listBoxGuest.DataSource    = guestListDS.Tables[0];
            }

            // Fetch dataset for billingitems
            DataSet billingitemListDS = DBGetData.GetBillingItemList();

            if (billingitemListDS != null)
            {
                // No tables fetched
                if (billingitemListDS.Tables.Count == 0)
                {
                    MessageBox.Show("No billing_item datatable found, contact administrator.");
                    return;
                }
                // No rows fetched
                else if (billingitemListDS.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("No datarows found in billing_item table.");
                    return;
                }

                // Set the dataset as source for listbox
                listBoxBillingItem.ValueMember   = "billing_itemid";
                listBoxBillingItem.DisplayMember = "billing_itemname";
                listBoxBillingItem.DataSource    = billingitemListDS.Tables[0];
            }

            // Set value and display member for listBoxFolioItem
            listBoxFolioItem.ValueMember   = "billing_itemid";
            listBoxFolioItem.DisplayMember = "billing_itemname";
        }
コード例 #2
0
        // Loading data from database into listBoxGuest and comboBoxRoomType
        private void LoadDataBooking()
        {
            // Fetch dataset
            DataSet guestListDS = DBGetData.GetGuestList();

            if (guestListDS != null)
            {
                // No tables fetched
                if (guestListDS.Tables.Count == 0)
                {
                    MessageBox.Show("No guest datatable found, contact administrator.");
                    return;
                }
                // No rows fetched
                else if (guestListDS.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("No datarows found in guest table.");
                    return;
                }

                // Set the dataset as source for listbox
                listBoxGuest.ValueMember   = "guestid";
                listBoxGuest.DisplayMember = "guest_name";
                listBoxGuest.DataSource    = guestListDS.Tables[0];
            }

            // Fetch dataset
            DataSet roomtypeListDS = DBGetData.GetRoomtypeList();

            if (roomtypeListDS != null)
            {
                // No tables fetched
                if (roomtypeListDS.Tables.Count == 0)
                {
                    MessageBox.Show("No roomtype datatable found, contact administrator.");
                    return;
                }
                // No rows fetched
                else if (roomtypeListDS.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("No datarows found in roomtype table.");
                    return;
                }

                // Set the dataset as source for combobox

                comboBoxRoomType.ValueMember   = "room_typeid";
                comboBoxRoomType.DisplayMember = "name";
                comboBoxRoomType.DataSource    = roomtypeListDS.Tables[0];
            }
        }
コード例 #3
0
        // Loading data from database into listBoxGuest and comboBoxRoomType
        private void LoadDataBooking()
        {
            // Fetch dataset
            DataSet guestListDS = DBGetData.GetGuestList();

            if (guestListDS != null)
            {
                // No tables fetched
                if (guestListDS.Tables.Count == 0)
                {
                    MessageBox.Show("No guest datatable found, contact administrator.");
                    return;
                }
                // No rows fetched
                else if (guestListDS.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("No datarows found in guest table.");
                    return;
                }

                // Set the dataset as source for listbox
                listBoxGuest.ValueMember   = "guestid";
                listBoxGuest.DisplayMember = "guest_name";
                listBoxGuest.DataSource    = guestListDS.Tables[0];
            }

            // Fetch dataset
            DataSet roomtypeListDS = DBGetData.GetRoomtypeList();

            if (roomtypeListDS != null)
            {
                // No tables fetched
                if (roomtypeListDS.Tables.Count == 0)
                {
                    MessageBox.Show("No roomtype datatable found, contact administrator.");
                    return;
                }
                // No rows fetched
                else if (roomtypeListDS.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("No datarows found in roomtype table.");
                    return;
                }

                // Set the dataset as source for combobox

                comboBoxRoomType.ValueMember   = "room_typeid";
                comboBoxRoomType.DisplayMember = "name";
                comboBoxRoomType.DataSource    = roomtypeListDS.Tables[0];
            }

            // Highlight existing values
            MySqlDataReader getValues = DBGetData.GetRoomreservationData(reservationid);

            if (getValues.Read())
            {
                listBoxGuest.SelectedValue     = getValues.GetInt32(0);
                comboBoxRoomType.SelectedValue = getValues.GetInt32(1);
                datePickerArrival.Value        = getValues.GetDateTime(2);
                datePickerDeparture.Value      = getValues.GetDateTime(3);
                if (!getValues.IsDBNull(4))
                {
                    textBoxRemark.Text = getValues.GetString(4);
                }
            }

            getValues.Dispose();
        }
コード例 #4
0
        // Load data from guest, billing_item and folio_item tables into listboxes
        private void LoadDataFolio()
        {
            // Fetch dataset for guestlist
            DataSet guestListDS = DBGetData.GetGuestList();

            if (guestListDS != null)
            {
                // No tables fetched
                if (guestListDS.Tables.Count == 0)
                {
                    MessageBox.Show("No guest datatable found, contact administrator.");
                    return;
                }
                // No rows fetched
                else if (guestListDS.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("No datarows found in guest table.");
                    return;
                }

                // Set the dataset as source for listbox
                listBoxGuest.ValueMember   = "guestid";
                listBoxGuest.DisplayMember = "guest_name";
                listBoxGuest.DataSource    = guestListDS.Tables[0];
            }

            // Fetch dataset for billingitems
            DataSet billingitemListDS = DBGetData.GetBillingItemList();

            if (billingitemListDS != null)
            {
                // No tables fetched
                if (billingitemListDS.Tables.Count == 0)
                {
                    MessageBox.Show("No billing_item datatable found, contact administrator.");
                    return;
                }
                // No rows fetched
                else if (billingitemListDS.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("No datarows found in billing_item table.");
                    return;
                }

                // Set the dataset as source for listbox
                listBoxBillingItem.ValueMember   = "billing_itemid";
                listBoxBillingItem.DisplayMember = "billing_itemname";
                listBoxBillingItem.DataSource    = billingitemListDS.Tables[0];
            }

            // Set value and display member for listBoxFolioItem
            listBoxFolioItem.ValueMember   = "billing_itemid";
            listBoxFolioItem.DisplayMember = "billing_itemname";

            // Highlight existing values
            MySqlDataReader getValues = DBGetData.GetFolioData(folioid);

            if (getValues.Read())
            {
                listBoxGuest.SelectedValue = Convert.ToInt32(getValues[0]);
            }

            getValues.Dispose();
        }