private void BtnDisplay_Click(object sender, RoutedEventArgs e)
        {
            grdAppointment.ItemsSource = "";
            try
            {
                appointmentListXML = new AppointmentList();
                appointmentListXML = xmlObject.ReadFromXMLFile();
                appointmentListXML.Sort();
                //grdAppointment.ItemsSource = appointmentListXML;
                DisplayAppointment.Clear();
                for (int i = 0; i < appointmentListXML.Count(); i++)
                {
                    Appointment appt = appointmentListXML[i];
                    DisplayAppointment.Add(appt);
                }

                grdAppointment.ItemsSource = displayAppointment;
            }
            catch (IOException ioe)
            {
                Console.WriteLine(ioe.ToString());
            }
            finally
            {
            }
        }
Beispiel #2
0
 private void BtnShow_Click(object sender, RoutedEventArgs e)
 {
     myList          = new AppointmentList();
     txtDisplay.Text = "";
     ReadFile();
     myList.Sort();
     foreach (Client c in myList)
     {
         txtDisplay.Text += (c.ToString());
     }
 }
Beispiel #3
0
        private void BtnRegister_Click(object sender, RoutedEventArgs e)
        {
            bool flag = ValidateValues();

            if (slot <= appointmentArray.Length && flag == true)
            {
                if (appointmentArray[slot].Patient == null)
                {
                    appointmentError.Content            = "";
                    appointmentArray[slot].Patient      = CreateNewPatient();
                    appointmentArray[slot].Patient.Time = appointmentCombo.SelectedValue.ToString();
                    appointmentArray[slot].Time         = appointmentCombo.SelectedValue.ToString();
                    saveList.Add(appointmentArray[slot]);
                    saveList.Sort();
                }
                else if (appointmentArray[slot].Patient != null)
                {
                    appointmentError.Foreground = Brushes.Red;
                    appointmentError.Content    = "Slot Aready Taken";
                }
            }
            else
            {
                genralError.Foreground = Brushes.Red;
                genralError.Content    = "Error Registering Customer";
            }

            if (appointmentArray[slot].Patient != null)
            {
                Applist.Add(appointmentArray[slot].Patient);
                TimeList.RemoveAt(selectedIndex);
            }
            MyGrid.ItemsSource = Applist;

            //TimeList.Remove(appointmentCombo.SelectedValue.ToString());
        }
        // Use this method to set all tags at document starting.
        // Note: start and end parameters are just default values.
        // If document contains StartDate and EndDate tags,
        // actual start and end values go from the tags.
        internal void SetupTags(C1PrintDocument printDoc, AppointmentCollection appointmentCollection,
                                List <Appointment> appointmentList, DateTime start, DateTime end, bool hidePrivateAppointments, CalendarInfo calendarInfo)
        {
            Tag           tag  = null;
            TagCollection Tags = printDoc.Tags;

            if (Tags.IndexOfName("Appointment") >= 0)
            {
                tag = Tags["Appointment"];
                if (tag != null && tag.Type == typeof(Appointment) &&
                    appointmentList != null && appointmentList.Count > 0)
                {
                    tag.Value = appointmentList[0];
                }
            }
            if (Tags.IndexOfName("Appointments") >= 0)
            {
                tag = Tags["Appointments"];
                if (tag != null)
                {
                    if (tag.Type == typeof(AppointmentCollection))
                    {
                        tag.Value = appointmentCollection;
                    }
                    else if (tag.Type == typeof(IList <Appointment>))
                    {
                        if ((Context & PrintContextType.Appointment) != 0 &&
                            appointmentList != null)
                        {
                            appointmentList.Sort(AppointmentComparer.Default);
                            tag.Value = appointmentList;
                        }
                        else
                        {
                            Tag tag1 = null;
                            if (Tags.IndexOfName("StartDate") >= 0)
                            {
                                tag1 = Tags["StartDate"];
                                if (tag1 != null && tag1.Type == typeof(DateTime))
                                {
                                    start = (DateTime)tag1.Value;
                                }
                            }
                            if (Tags.IndexOfName("EndDate") >= 0)
                            {
                                tag1 = Tags["EndDate"];
                                if (tag1 != null && tag1.Type == typeof(DateTime))
                                {
                                    end = (DateTime)tag1.Value;
                                }
                            }
                            C1Scheduler scheduler = ((C1ScheduleStorage)appointmentCollection.ParentStorage.ScheduleStorage).Scheduler;
                            // get appointments for the currently selected SchedulerGroupItem if any,
                            // or all appointments otherwise.
                            AppointmentList list = appointmentCollection.GetOccurrences(
                                scheduler.SelectedGroupItem == null ? null : scheduler.SelectedGroupItem.Owner,
                                scheduler.GroupBy, start, end.AddDays(1), !hidePrivateAppointments);
                            list.Sort();
                            tag.Value = list;
                        }
                    }
                }
            }
            if (Tags.IndexOfName("CalendarInfo") >= 0)
            {
                tag = Tags["CalendarInfo"];
                if (tag != null && tag.Type == typeof(CalendarInfo))
                {
                    tag.Value = calendarInfo;
                }
            }
            if (Tags.IndexOfName("HidePrivateAppointments") >= 0)
            {
                tag = Tags["HidePrivateAppointments"];
                if (tag != null && tag.Type == typeof(bool))
                {
                    tag.Value = hidePrivateAppointments;
                }
            }
            // update string tags
            foreach (Tag t in Tags)
            {
                if (t.Type == typeof(string))
                {
                    string key = t.Name.ToLower();
                    switch (key)
                    {
                    case "start":
                        key = "startTime";
                        break;

                    case "end":
                        key = "endTime";
                        break;

                    case "showtimeas":
                        key = "showTimeAs";
                        break;

                    case "contacts":
                        key = "contactsButton";
                        break;

                    case "resources":
                        key = "resourcesButton";
                        break;

                    case "categories":
                        key = "categoriesButton";
                        break;
                    }
                    if (!string.IsNullOrEmpty(key))
                    {
                        // try find localized value from the Scheduler resources
                        string str = C1.WPF.Localization.C1Localizer.GetString("EditAppointment", key, (string)t.Value).Trim();
                        if (!string.IsNullOrEmpty(str))
                        {
                            while (str.EndsWith("."))
                            {
                                str = str.Substring(0, str.Length - 1);
                            }
                            if (!str.EndsWith(":"))
                            {
                                str += ":";
                            }
                            t.Value = str;
                        }
                    }
                }
            }
        }
        // adds assembly references and initializes document tags
        private void _printDoc_DocumentStarting(object sender, EventArgs e)
        {
            // add references needed for document scripts execution
            _printDoc.ScriptingOptions.ExternalAssemblies.Add(Assembly.GetAssembly(typeof(C1.WPF.Schedule.C1Scheduler)).Location);
            _printDoc.ScriptingOptions.ExternalAssemblies.Add("WindowsBase.dll");
            string path = Assembly.GetAssembly(typeof(System.Windows.Media.Color)).Location;

            _printDoc.ScriptingOptions.ExternalAssemblies.Add(path);

            path = Assembly.GetAssembly(typeof(System.Collections.Specialized.INotifyCollectionChanged)).Location;
            _printDoc.ScriptingOptions.ExternalAssemblies.Add(path);

            // initialize document tags
            DateTime start = Scheduler.VisibleDates[0];
            DateTime end   = Scheduler.VisibleDates[Scheduler.VisibleDates.Count - 1];

            Tag tag = _printDoc.Tags["StartDate"];

            if (tag != null && tag.Type == typeof(DateTime))
            {
                tag.Value = start;
            }
            tag = _printDoc.Tags["EndDate"];
            if (tag != null && tag.Type == typeof(DateTime))
            {
                tag.Value = end;
            }

            // show tag input form to user
            _printDoc.EditTags();

            tag = _printDoc.Tags["StartDate"];
            if (tag != null && tag.Type == typeof(DateTime))
            {
                start = (DateTime)tag.Value;
            }
            tag = _printDoc.Tags["EndDate"];
            if (tag != null && tag.Type == typeof(DateTime))
            {
                end = (DateTime)tag.Value;
            }

            tag = _printDoc.Tags["Appointment"];
            if (tag != null && tag.Type == typeof(Appointment) && Scheduler.SelectedAppointment != null)
            {
                tag.Value = Scheduler.SelectedAppointment;
            }

            tag = _printDoc.Tags["CalendarInfo"];
            if (tag != null && tag.Type == typeof(CalendarInfo))
            {
                tag.Value = Scheduler.CalendarHelper.Info;
            }

            tag = _printDoc.Tags["Appointments"];
            if (tag != null)
            {
                if (tag.Type == typeof(AppointmentCollection))
                {
                    tag.Value = Scheduler.DataStorage.AppointmentStorage.Appointments;
                }
                else if (tag.Type == typeof(IList <Appointment>))
                {
                    bool isAppointmentContext = _printDoc.DocumentFileName.Contains("Memo") || _printDoc.DocumentFileName.Contains("Details");
                    if (isAppointmentContext && Scheduler.SelectedAppointment != null)
                    {
                        List <Appointment> list = new List <Appointment>();
                        list.Add(Scheduler.SelectedAppointment);
                        tag.Value = list;
                    }
                    else
                    {
                        // get appointments for the currently selected SchedulerGroupItem if any,
                        // or all appointments otherwise.
                        AppointmentList list = Scheduler.DataStorage.AppointmentStorage.Appointments.GetOccurrences(
                            Scheduler.SelectedGroupItem == null ? null : Scheduler.SelectedGroupItem.Owner,
                            Scheduler.GroupBy, start, end.AddDays(1), true);
                        list.Sort();
                        tag.Value = list;
                    }
                }
            }
        }
Beispiel #6
0
        // adds assembly references and initializes document tags
        private void _printDoc_DocumentStarting(object sender, EventArgs e)
        {
            // add references needed for document scripts execution
            _printDoc.ScriptingOptions.ExternalAssemblies.Add(System.Reflection.Assembly.GetAssembly(typeof(C1Schedule)).Location);

            // initialize document tags
            DateTime start = c1Schedule1.SelectedDates[0].Date;
            DateTime end   = c1Schedule1.SelectedDates[c1Schedule1.SelectedDates.Length - 1].Date;

            Tag tag = _printDoc.Tags["StartDate"];

            if (tag != null && tag.Type == typeof(DateTime))
            {
                tag.Value = start;
            }
            tag = _printDoc.Tags["EndDate"];
            if (tag != null && tag.Type == typeof(DateTime))
            {
                tag.Value = end;
            }

            // show tag input form to user
            _printDoc.EditTags();

            tag = _printDoc.Tags["StartDate"];
            if (tag != null && tag.Type == typeof(DateTime))
            {
                start = (DateTime)tag.Value;
            }
            tag = _printDoc.Tags["EndDate"];
            if (tag != null && tag.Type == typeof(DateTime))
            {
                end = (DateTime)tag.Value;
            }

            tag = _printDoc.Tags["Appointment"];
            if (tag != null && tag.Type == typeof(Appointment) && c1Schedule1.SelectedAppointments != null && c1Schedule1.SelectedAppointments.Count > 0)
            {
                tag.Value = c1Schedule1.SelectedAppointments[0];
            }

            tag = _printDoc.Tags["CalendarInfo"];
            if (tag != null && tag.Type == typeof(CalendarInfo))
            {
                tag.Value = c1Schedule1.CalendarInfo;
            }

            tag = _printDoc.Tags["Appointments"];
            if (tag != null)
            {
                if (tag.Type == typeof(AppointmentCollection))
                {
                    tag.Value = c1Schedule1.DataStorage.AppointmentStorage.Appointments;
                }
                else if (tag.Type == typeof(IList <Appointment>))
                {
                    bool isAppointmentContext = _printDoc.DocumentFileName.Contains("Memo") || _printDoc.DocumentFileName.Contains("Details");
                    if (isAppointmentContext && c1Schedule1.SelectedAppointments != null && c1Schedule1.SelectedAppointments.Count > 0)
                    {
                        tag.Value = c1Schedule1.SelectedAppointments;
                    }
                    else
                    {
                        // get appointments for the currently selected SchedulerGroupItem if any,
                        // or all appointments otherwise.
                        AppointmentList list = c1Schedule1.DataStorage.AppointmentStorage.Appointments.GetOccurrences(
                            c1Schedule1.SelectedGroupItem == null ? null : c1Schedule1.SelectedGroupItem.Owner,
                            c1Schedule1.GroupBy, start, end.AddDays(1), true);
                        list.Sort();
                        tag.Value = list;
                    }
                }
            }
        }