예제 #1
0
        //private void CheckTimeOverLap(AppointmentCollection collection, Appointment appointment)
        //{
        //    try
        //    {
        //        collection.ObservableList.ForEach(x => x.IsAppointmentOverlapped = false);
        //        appointment.IsAppointmentOverlapped = false;
        //        var query =
        //            collection.ObservableList.Where(
        //                x =>
        //                x.EndTime > appointment.BeginTime &&
        //                x.BeginTime < appointment.EndTime);
        //        var appointments = query as IList<Appointment> ?? query.ToList();
        //        if (appointments.Any(x =>
        //            {
        //                if (!appointment.ID.HasValue)
        //                    return true;
        //                return appointment.ID != x.ID;
        //            }))
        //        {
        //            appointments.ForEach(x => x.IsAppointmentOverlapped = true);
        //            appointment.IsAppointmentOverlapped = true;
        //        }

        //    }
        //    catch (Exception exception)
        //    {
        //        NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured,
        //                            ExceptionResources.ExceptionOccuredLogDetail);
        //    }
        //}

        private void GetAppointmentsByDate(Appointment appointment, bool doAsync = false, bool findNextAppointment = false)
        {
            try
            {
                if (doAsync)
                {
                    Task.Factory.StartNew(() =>
                    {
                        this.AppointmentCollection = AppointmentAction.GetAppointments(this.DBConnectionString,
                                                                                       appointment.AppointmentDate);

                        this.ShowProgressBar = false;
                    });
                }
                else
                {
                    this.AppointmentCollection = AppointmentAction.GetAppointments(this.DBConnectionString,
                                                                                   appointment.AppointmentDate);
                    this.ShowProgressBar = false;
                }
            }
            catch (Exception exception)
            {
                NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured,
                                    ExceptionResources.ExceptionOccuredLogDetail);
            }
        }
 private void GetCustomerAppointments()
 {
     Task.Factory.StartNew(() =>
     {
         try
         {
             this.Entity = AppointmentAction.GetAppointments(this.DBConnectionString, this.SelectedCustomer);
         }
         catch (Exception exception)
         {
             NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured,
                                 ExceptionResources.ExceptionOccuredLogDetail);
         }
     });
 }