Beispiel #1
0
        private void rgBookings_DoubleClick(object sender, EventArgs e)
        {
            if (iSSItemSelected > 0)
            {
                SharedData.iBookingID = iSSItemSelected;

                Form frmBooking = new frmBooking();
                DialogResult dlg = frmBooking.ShowDialog();
                if (dlg == DialogResult.OK)
                {
                    wsCurrent = rgBookings.CurrentWorksheet.Name;
                    LoadBookingsGrid();
                }

                SharedData.iBookingID = 0;
            }
        }
Beispiel #2
0
        private void gBookings_RowDoubleClick(object sender, GridRowDoubleClickEventArgs e)
        {
            if (e.GridRow.RowIndex > -1 && e.MouseEventArgs.Button == MouseButtons.Left && gBookings.PrimaryGrid.Rows[e.GridRow.RowIndex].Tag != null)
            {
                SharedData.iBookingID = Convert.ToInt32(gBookings.PrimaryGrid.Rows[e.GridRow.RowIndex].Tag);

                Form frmBooking = new frmBooking();
                DialogResult dlg = frmBooking.ShowDialog();
                if (dlg == DialogResult.OK && SharedData.iBookingID > 0 && SharedData.dSchedule.Count > 0)
                {
                    LoadBookings();
                }

                SharedData.iBookingID = 0;
            }
        }
Beispiel #3
0
        private void cvBookings_ItemDoubleClick(object sender, MouseEventArgs e)
        {
            if (cvBookings.SelectedView == eCalendarView.Year)
            {
                cvBookings.SelectedView = eCalendarView.Day;
                return;
            }

            if (cvBookings.SelectedAppointments.Count > 0)
            {
                SharedData.iBookingID = Convert.ToInt32(cvBookings.SelectedAppointments[0].Appointment.Tag);
                Form frmBooking = new frmBooking();
                DialogResult dlg = frmBooking.ShowDialog();
                if (dlg == DialogResult.OK)
                {
                    LoadBookings();
                }
                SharedData.iBookingID = 0;
            }
        }
Beispiel #4
0
        private void mEnquiriesBooking_Click(object sender, EventArgs e)
        {
            if (rBooking != null)
            {
                SharedData.sBookingCompany = txtEnquiryCompany.Text;
                SharedData.sBookingContact = txtEnquiryName.Text;
                SharedData.sBookingEmail = txtEnquiryEmail.Text;
                SharedData.sBookingPhone = txtEnquiryPhone.Text;
            }

            Form frmBooking = new frmBooking();
            DialogResult dlg = frmBooking.ShowDialog();
            if (dlg == DialogResult.OK)
            {
                ms.SelectedTab = mtBookings;
                SharedData.sBookingCompany = "";
                SharedData.sBookingContact = "";
                SharedData.sBookingEmail = "";
                SharedData.sBookingPhone = "";
                LoadBookingsGrid();
                LoadBookings();
            }
        }
Beispiel #5
0
        private void mBookingsAdd_Click(object sender, EventArgs e)
        {
            Form frmBooking = new frmBooking();
            DialogResult dlg = frmBooking.ShowDialog();
            if (dlg == DialogResult.OK && SharedData.iBookingID > 0 && SharedData.dSchedule.Count > 0)
            {
                Appointment appointment = new Appointment();

                string[] sDates = SharedData.dSchedule["dates"].Split('|');
                string[] sTimes = new string[] { };
                if (SharedData.dSchedule["times"].Length > 0)
                {
                    sTimes = SharedData.dSchedule["times"].Split('|');
                }
                DateTime now = DateTime.Now;
                int iYear = now.Year, iMonth = now.Month, iDay = now.Day;

                string[] d1 = sDates[0].Split('/');
                string[] t1 = new string[] { };
                if (sTimes.Length == 2)
                {
                    t1 = sTimes[0].Split(':');
                }
                iYear = Convert.ToInt32(d1[2].Substring(0, d1[2].IndexOf(' ')));
                iMonth = Convert.ToInt32(d1[1]);
                iDay = Convert.ToInt32(d1[0]);
                appointment.StartTime = new DateTime(iYear, iMonth, iDay, (t1.Length == 2 ? Convert.ToInt32(t1[0]) : 0), (t1.Length == 2 ? Convert.ToInt32(t1[0]) : 0), 0);

                string[] d2 = sDates[1].Split('/');
                string[] t2 = new string[] { };
                if (sTimes.Length == 2)
                {
                    t2 = sTimes[1].Split(':');
                }
                iYear = Convert.ToInt32(d2[2].Substring(0, d2[2].IndexOf(' ')));
                iMonth = Convert.ToInt32(d2[1]);
                iDay = Convert.ToInt32(d2[0]);
                appointment.EndTime = new DateTime(iYear, iMonth, iDay, (t2.Length == 2 ? Convert.ToInt32(t2[0]) : 0), (t1.Length == 2 ? Convert.ToInt32(t2[0]) : 0), 0);

                appointment.Subject = SharedData.dSchedule["name"];

                appointment.CategoryColor = Appointment.CategoryGreen;
                appointment.TimeMarkedAs = Appointment.TimerMarkerBusy;
                appointment.Locked = true;
                appointment.Tag = SharedData.iBookingID;
                cmBookings.Appointments.Add(appointment);

                cvBookings.CalendarModel = cmBookings;
            }

            SharedData.iBookingID = 0;
            LoadBookings();
            LoadBookingsGrid();
        }