Exemplo n.º 1
0
        private void BookingSearchForm_Load(object sender, EventArgs e)
        {
            BookingController = new SA41Team_10B_SportsBookingFacility.BookingTranController();
            //to add the facilities data to the combo box
            SA41Team_10B_SportsBookingFacility.FacilityBroker         fb           = new SA41Team_10B_SportsBookingFacility.FacilityBroker();
            List <SA41Team_10B_SportsBookingFacility.FacilityBooking> facilityList = new List <SA41Team_10B_SportsBookingFacility.FacilityBooking>();

            facilityList               = fb.GetAllFacilites();
            cmbFacilites.DataSource    = facilityList;
            cmbFacilites.DisplayMember = "Name".ToString();
            cmbFacilites.ValueMember   = "FacilityId";
            cmbFacilites.SelectedIndex = -1;


            //to add the customer data to the combo box
            SA41Team_10B_SportsBookingFacility.CustomerBroker      cb           = new SA41Team_10B_SportsBookingFacility.CustomerBroker();
            List <SA41Team_10B_SportsBookingFacility.CustomerBook> customerList = new List <SA41Team_10B_SportsBookingFacility.CustomerBook>();

            customerList              = cb.GetAllCustomers();
            cmbCustName.DataSource    = customerList;
            cmbCustName.DisplayMember = "Name".ToString();
            cmbCustName.ValueMember   = "CustomerID";
            cmbCustName.SelectedIndex = -1;
        }
Exemplo n.º 2
0
        private void BookingListForm_Load(object sender, EventArgs e)
        {
            //Bookingcontroller = new SA41Team_10B_SportsBookingFacility.BookingTranController();

            btnCancelBooking.Enabled = false;

            Bookingcontroller = new SA41Team_10B_SportsBookingFacility.BookingTranController();
            //to add the facilities data to the combo box
            SA41Team_10B_SportsBookingFacility.FacilityBroker         fb           = new SA41Team_10B_SportsBookingFacility.FacilityBroker();
            List <SA41Team_10B_SportsBookingFacility.FacilityBooking> facilityList = new List <SA41Team_10B_SportsBookingFacility.FacilityBooking>();

            facilityList               = fb.GetAllFacilites();
            cmbFacilites.DataSource    = facilityList;
            cmbFacilites.DisplayMember = "Name".ToString();
            cmbFacilites.ValueMember   = "FacilityId";
            cmbFacilites.SelectedIndex = -1;


            //to add the customer data to the combo box
            SA41Team_10B_SportsBookingFacility.CustomerBroker      cb           = new SA41Team_10B_SportsBookingFacility.CustomerBroker();
            List <SA41Team_10B_SportsBookingFacility.CustomerBook> customerList = new List <SA41Team_10B_SportsBookingFacility.CustomerBook>();

            customerList              = cb.GetAllCustomers();
            cmbCustName.DataSource    = customerList;
            cmbCustName.DisplayMember = "Name".ToString();
            cmbCustName.ValueMember   = "CustomerID";
            cmbCustName.SelectedIndex = -1;

            //dgvBookingList.SelectionMode = DataGridViewSelectionMode.FullColumnSelect;
            //List<SA41Team_10B_SportsBookingFacility.BookingTranLayer> BookingList = new List<SA41Team_10B_SportsBookingFacility.BookingTranLayer>();
            //BookingList = Bookingcontroller.GetAllBookings();

            //dgvBookingList.DataSource = BookingList;


            List <SA41Team_10B_SportsBookingFacility.BookingGridData> BookingGridList = new List <SA41Team_10B_SportsBookingFacility.BookingGridData>();

            BookingGridList = Bookingcontroller.GetGridData();

            dgvBookingList.DataSource = BookingGridList;
            dgvBookingList.Columns["BookName"].HeaderText         = "Customer";
            dgvBookingList.Columns["BookFacilityname"].HeaderText = "Facility Booked";
            dgvBookingList.Columns["BookTimeSlot"].HeaderText     = "Time Slot";
            dgvBookingList.Columns["BookIssueDate"].HeaderText    = "Booked Date";
            dgvBookingList.Columns["BookCustomerId"].Visible      = false;
            dgvBookingList.Columns["BookSlotId"].Visible          = false;
            dgvBookingList.Columns["BookFacilityId"].Visible      = false;
            dgvBookingList.AutoResizeColumns();



            //List<SA41Team_10B_SportsBookingFacility.CustomerBook> cusNameList = new List<SA41Team_10B_SportsBookingFacility.CustomerBook>();
            //foreach (SA41Team_10B_SportsBookingFacility.BookingTranLayer b in BookingList)
            //{
            //    cusNameList.Add(Bookingcontroller.GetCustomer(b.CustomerID));
            //}

            //dgvBookingList.Columns["status"].Visible = false;
            //MessageBox.Show(cusNameList.Count.ToString());

            //for (int i = 0; i < cusNameList.Count; i++)
            //{
            //    //MessageBox.Show(cusNameList[i].Name.ToString());
            //    //dgvBookingList.Rows.Add(cusNameList[i].Name.ToString());
            //    MessageBox.Show(dgvBookingList.Rows[i].Cells[2].Value.ToString());
            //    MessageBox.Show(cusNameList[i].Name.ToString());
            //    dgvBookingList.Rows[i].Cells[2].Value = cusNameList[i].Name.ToString();
            //}

            dgvBookingList.Refresh();
        }