Exemplo n.º 1
0
        private void RoomsStateUC_Load(object sender, EventArgs e)
        {
            try
            {
                dataGridViewClosedRooms.DataSource = hotelDbDataSet.apartament;
                HotelDbDataSet.apartamentDataTable openTable = new HotelDbDataSet.apartamentDataTable();
                dataGridViewOpened.DataSource = openTable;


                HotelDbDataSet.apartamentDataTable apartaments = apartamentTableAdapter.GetData();

                foreach (HotelDbDataSet.apartamentRow row in apartaments.Rows)
                {
                    bool?state = lockHistoryTableAdapter1.ApartamentState((int)row[0]);
                    if (state.HasValue)
                    {
                        if (state.Value)
                        {
                            hotelDbDataSet.apartament.ImportRow(row);
                        }
                        else
                        {
                            openTable.ImportRow(row);
                        }
                    }
                }
            }
            catch (Exception ex) { }
        }
Exemplo n.º 2
0
        private void ButtonSearch_Click(object sender, EventArgs e)
        {
            try
            {
                HotelDbDataSet.apartamentDataTable allfreerooms = apartamentTableAdapter.GetDataByFreeRooms(
                    dateFrom.Value, dateTo.Value,
                    dateFrom.Value, dateTo.Value,
                    dateFrom.Value, dateTo.Value);

                var query = from o in allfreerooms
                            where o.class_id == comboBoxClass.Text
                            select o;
                DataView res = query.AsDataView();

                dataGridViewFreeApart.DataSource = res;
                dataGridViewFreeApart.Columns["class_id"].Visible = false;
                dataGridViewFreeApart.Columns[0].HeaderCell.Value = "Room";
                dataGridViewFreeApart.RowHeadersVisible           = false;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }