Beispiel #1
0
 public MemberForm(MakeBookingForm f, Facility fa)
 {
     InitializeComponent();
     bkgform = f;
     fac     = fa;
     i       = 0;
 }
        //ModifyForm form1;


        public BookingForm(MakeBookingForm f)
        {
            form = f;
            //BookingDateDtTimePckr.MinDate = DateTime.Today;
            form.BookingDateDtTimePckr.MaxDate = DateTime.Today.AddDays(60);
            form.BookingFromTime.CustomFormat  = "hh:00 tt";
            // form.BookingFromTime.Format = DateTimePickerFormat.Custom;
            form.BookingFromTime.ShowUpDown = true;
            form.BookingToTime.CustomFormat = "hh:00 tt";
            // form.BookingToTime.Format = DateTimePickerFormat.Custom;
            form.BookingToTime.ShowUpDown = true;
        }
Beispiel #3
0
        private void MakeNewBookingButton_Click(object sender, EventArgs e)
        {
            MakeBookingForm nbi = new MakeBookingForm();

            nbi.Show();
        }
        /// <summary>
        /// When double-clicking a cell, either trigger a New Booking form or Modify Booking form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1 && e.ColumnIndex > 0)
            {
                string   facName;
                DateTime date;
                int      hour = 0;

                facName = listFacilityAvailabiltyByDay[e.RowIndex].FacName.ToString();
                date    = selectedDate;

                // get the correct timing
                // look at the column, and pass an Hour object
                // can we create an Enum to help with the mapping?
                //switch (e.ColumnIndex)
                //{
                //    case 1:
                //        hour = 7;
                //        break;
                //    case 2:
                //        hour = 8;
                //        break;
                //    case 3:
                //        hour = 9;
                //        break;
                //    case 4:
                //        hour = 10;
                //        break;
                //    case 5:
                //        hour = 11;
                //        break;
                //    case 6:
                //    default:
                //        break;
                //}
                if (e.ColumnIndex >= 1 && e.ColumnIndex <= 14)
                {
                    hour = e.ColumnIndex + 6;
                }

                // trigger correct type of form
                if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "True")
                {
                    // Trigger Modify Booking
                    //bookingType = "Modify Booking";
                    ModifyForm form1 = new ModifyForm(facName, date, hour);
                    form1.refToAvailabiltyForm = this;
                    form1.ShowDialog();
                }
                else
                {
                    // Trigger New Booking
                    //bookingType = "New Booking";
                    MakeBookingForm form2 = new MakeBookingForm(facName, date, hour);
                    form2.refToAvailabiltyForm = this;
                    form2.ShowDialog();
                }

                //MessageBox.Show("Type of form triggerred: " + bookingType);
                //MessageBox.Show("Date: " + selectedDate.ToShortDateString());
                //MessageBox.Show("Facility Name: " + listFacilityAvailabiltyByDay[e.RowIndex].FacName.ToString());
                //MessageBox.Show("Time: " + hour.ToString() + "AM");
            }
        }