Пример #1
0
        private void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var listView = (sender as ListView);
            var exp      = (listView.Parent as Expander);
            var h        = int.Parse((listView.SelectedItem as TextBlock).Text.Substring(0, (listView.SelectedItem as TextBlock).Text.IndexOf(':')));

            Schedules scheduleNew = new Schedules
            {
                TimeStart = new DateTime(CalendarSmall.SelectedDate.Value.Year, CalendarSmall.SelectedDate.Value.Month, CalendarSmall.SelectedDate.Value.Day, h, 0, 0),
                Date      = CalendarSmall.SelectedDate.Value,
                Duration  = 1,
                Coach     = StaffRepository.GetInstance().Get(int.Parse(exp.DataContext.ToString())),
                Services  = new AdditionalServices()
            };

            SchedulesRepository.GetInstance().Add(scheduleNew);
            var schedule = SchedulesRepository.GetInstance().GetAll();

            list      = new List <Schedules>();
            coachList = new List <Staff>();

            foreach (var item in schedule)
            {
                if (item.Date == CalendarSmall.SelectedDate)
                {
                    coachList.Add(item.Coach);
                    list.Add(item);
                }
            }
            var listSchedule = list.Where(item => item.Coach.Id == int.Parse(exp.DataContext.ToString())).ToList();

            exp.Content = null;
            exp.Content = SetGraficOfOne(listSchedule);
        }
Пример #2
0
        public MainWindow()
        {
            DataContext = this;

            timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromSeconds(1)
            };
            timer.Tick += (s, r) =>
            {
                var news = NewsRepository.GetInstance().GetAll();
                if (NewsCount < news.Count())
                {
                    NewsPanel.Children.Clear();
                    SetNews(news.ToList());
                    NewsCount = news.Count();
                }
            };
            timer.Start();

            InitializeComponent();

            var schedule = SchedulesRepository.GetInstance().GetAll();

            foreach (var item in schedule)
            {
                if (item.Date.Date.Equals(DateTime.Today))
                {
                    ScheduleOfOneUc scheduleOfOne = new ScheduleOfOneUc(item);
                    WorksPanel.Children.Add(scheduleOfOne);
                }
            }

            SetTasks();
        }
Пример #3
0
 public void GetByDates(ObjectListView olv, DateTime d1, DateTime d2)
 {
     using (SchedulesRepository repo = new SchedulesRepository())
     {
         var list = repo.GetByDates(d1, d2);
         olv.SetObjects(list);
     }
 }
Пример #4
0
 private void NewsNameCmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     foreach (var item in SchedulesRepository.GetInstance().GetAll())
     {
         if (item.Coach.Id == ((sender as ComboBox).SelectedItem as Staff).Id)
         {
             Schedules.Add(item);
         }
     }
 }
Пример #5
0
        public void Delete(ObjectListView olv)
        {
            var obj = olv.SelectedObject as Schedule;

            using (SchedulesRepository repo = new SchedulesRepository())
            {
                repo.Delete(obj);
                olv.RemoveObject(obj);
            }
        }
Пример #6
0
 public SchedulesBox()
 {
     InitializeComponent();
     if (DesignerProperties.GetIsInDesignMode(this))
     {
         return;
     }
     EventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>();
     EventAggregator.GetEvent <ApplicationLoadedEvent>().Subscribe(OnSchedulesLoaded);
     _schedulesRepository = ServiceLocator.Current.GetInstance <IUnityContainer>().Resolve <SchedulesRepository>();
 }
Пример #7
0
        public SchedulesViewModel(IEventAggregator eventAggregator, IDataTransport dataTransport, IUnityContainer container)
        {
            Schedules           = new ObservableCollection <ScheduleClass>();
            _eventAggregator    = eventAggregator;
            _dataTransport      = dataTransport;
            _scheduleRepository = container.Resolve <SchedulesRepository>();

            AddScheduleCommand  = new DelegateCommand <string>(AddSchedule);
            SaveScheduleCommand = new DelegateCommand(SaveSchedule);
            DropScheduleCommand = new DelegateCommand(DropSchedule);
            CancelCommand       = new DelegateCommand(Cancel);

            _selectedScheduleType = ScheduleTypes.Light;
        }
Пример #8
0
 public void New(ObjectListView olv)
 {
     using (SchedulesRepository repo = new SchedulesRepository())
     {
         Schedule obj = repo.New();
         obj.CurrentDate = DateTime.Now.Date;
         obj.Done        = false;
         ScheduleForm frm = new ScheduleForm(obj);
         frm.Text = "Νέα Επιθεώρηση";
         if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             obj = frm.Schedule;
             repo.Insert(obj);
             obj = repo.Reload(obj);
             olv.AddObject(obj);
         }
     }
 }
Пример #9
0
        public void Edit(ObjectListView olv)
        {
            var obj = olv.SelectedObject as Schedule;

            if (obj == null)
            {
                return;
            }
            if (obj.Done)
            {
                return;
            }
            using (SchedulesRepository repo = new SchedulesRepository())
            {
                ScheduleForm frm = new ScheduleForm(obj);
                frm.Text = obj.Id;
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    obj = repo.Update(frm.Schedule);
                    olv.RefreshObject(obj);
                }
            }
        }
Пример #10
0
        public UnitOfWork(
            PatientsRepository patients,
            PractitionersRepository practitioners,
            PractitionerRolesRepository practitionerRoles,
            RelatedPeopleRepository relatedPeople,
            PeopleRepository people,
            OrganizationsRepository organizations,
            HealthcareServicesRepository healthcareServices,
            LocationsRepository locations,
            DevicesRepository devices,
            TasksRepository tasks,
            AppointmentsRepository appointments,
            SchedulesRepository schedules,
            EncountersRepository encounters,
            EpisodesOfCareRepository episodesOfCare,
            FlagsRepository flags
            )
        {
            var database = new FhirDevelopment01DB();

            Patients           = patients;
            Practitioners      = practitioners;
            PractitionerRoles  = practitionerRoles;
            RelatedPeople      = relatedPeople;
            People             = people;
            Organizations      = organizations;
            HealthcareServices = healthcareServices;
            Locations          = locations;
            Devices            = devices;
            Tasks          = tasks;
            Appointments   = appointments;
            Schedules      = schedules;
            Encounters     = encounters;
            EpisodesOfCare = episodesOfCare;
            Flags          = flags;
        }
Пример #11
0
        public void Get(ObjectListView olv)
        {
            using (SchedulesRepository repo = new SchedulesRepository())
            {
                var d    = DateTime.Now.Date;
                var list = repo.GetByDates(d, d);
                olv.ModelFilter = null;
                olv.Columns.Clear();

                olv.Columns.Add(new BrightIdeasSoftware.OLVColumn()
                {
                    Text         = "Μηχάνημα",
                    AspectGetter = delegate(object row)
                    {
                        var obj = row as Schedule;
                        if (obj.Machine == null)
                        {
                            return(string.Empty);
                        }
                        else
                        {
                            return(obj.Machine.Title);
                        }
                    },
                    TextAlign = System.Windows.Forms.HorizontalAlignment.Left,
                    Width     = 100
                });

                olv.Columns.Add(new BrightIdeasSoftware.OLVColumn()
                {
                    Text                 = "Χρονική Επιθεώρηση",
                    AspectGetter         = delegate(object row) { return(((Schedule)row).Recurrence); },
                    AspectToStringFormat = "{0:d}",
                    TextAlign            = System.Windows.Forms.HorizontalAlignment.Left,
                    Width                = 150
                });

                olv.Columns.Add(new BrightIdeasSoftware.OLVColumn()
                {
                    Text         = "Είδος Επιθεώρησης",
                    AspectGetter = delegate(object row) { return(((Schedule)row).Inspection); },
                    TextAlign    = System.Windows.Forms.HorizontalAlignment.Left,
                    Width        = 150
                });

                olv.Columns.Add(new BrightIdeasSoftware.OLVColumn()
                {
                    Text         = "Είδος Εργασίας",
                    AspectGetter = delegate(object row) { return(((Schedule)row).Work); },
                    TextAlign    = System.Windows.Forms.HorizontalAlignment.Left,
                    Width        = 150
                });

                olv.Columns.Add(new BrightIdeasSoftware.OLVColumn()
                {
                    Text                 = "Ημερομηνία",
                    AspectGetter         = delegate(object row) { return(((Schedule)row).CurrentDate); },
                    AspectToStringFormat = "{0:d}",
                    TextAlign            = System.Windows.Forms.HorizontalAlignment.Left,
                    Width                = 150
                });

                olv.Columns.Add(new BrightIdeasSoftware.OLVColumn()
                {
                    Text                 = "Επόμενη Επιθεώρηση",
                    AspectGetter         = delegate(object row) { return(((Schedule)row).NextDate); },
                    AspectToStringFormat = "{0:d}",
                    TextAlign            = System.Windows.Forms.HorizontalAlignment.Left,
                    Width                = 150
                });

                olv.Columns.Add(new BrightIdeasSoftware.OLVColumn()
                {
                    Text         = "Συντηρητής",
                    AspectGetter = delegate(object row)
                    {
                        var obj = row as Schedule;
                        if (obj.Employee == null)
                        {
                            return(string.Empty);
                        }
                        else
                        {
                            return(obj.Employee.Title);
                        }
                    },
                    TextAlign = System.Windows.Forms.HorizontalAlignment.Left,
                    Width     = 150
                });

                olv.Columns.Add(new BrightIdeasSoftware.OLVColumn()
                {
                    Text         = "Ολοκληρώθηκε",
                    TextAlign    = System.Windows.Forms.HorizontalAlignment.Center,
                    AspectGetter = delegate(object row) { return(((Schedule)row).Done); },
                    CheckBoxes   = true
                });

                olv.SetObjects(list);
            }
        }
Пример #12
0
        private void SetCoach()
        {
            CoachesPanel.Children.Clear();
            var schedule = SchedulesRepository.GetInstance().GetAll();

            list      = new List <Schedules>();
            coachList = new List <Staff>();

            foreach (var item in schedule)
            {
                if (item.Date == CalendarSmall.SelectedDate)
                {
                    coachList.Add(item.Coach);
                    list.Add(item);
                }
            }

            foreach (var l in list)
            {
                Expander         exp;
                StackPanel       spCoach = null;
                List <Schedules> listOne;
                foreach (var c in coachList)
                {
                    listOne = list.Where(item => item.Coach.Id == c.Id).ToList();

                    if (l.Coach.Id == c.Id)
                    {
                        if (spCoach is null)
                        {
                            spCoach = new StackPanel {
                                Orientation = Orientation.Horizontal
                            };

                            BitmapImage bitmap;
                            if (File.Exists(c.ProfileImg.Name + c.ProfileImg.Extension))
                            {
                                bitmap = new BitmapImage(new Uri(System.IO.Path.GetFullPath(c.ProfileImg.Name + c.ProfileImg.Extension)));
                            }
                            else
                            {
                                bitmap = new BitmapImage(new Uri(System.IO.Path.GetFullPath(Utillity.GetInstance().ByteToImage(c.ProfileImg))));
                            }

                            spCoach.Children.Add(new Ellipse
                            {
                                Width  = 60,
                                Height = 60,
                                Fill   = new ImageBrush(bitmap)
                            });

                            spCoach.Children.Add(new TextBlock
                            {
                                Text = c.Name + " " + c.SurName,
                                VerticalAlignment = VerticalAlignment.Center,
                                Margin            = new Thickness(15, 0, 0, 0),
                                FontSize          = 18,
                            });
                        }

                        exp = new Expander
                        {
                            Header      = spCoach,
                            Content     = SetGraficOfOne(listOne),
                            DataContext = c.Id
                        };
                        CoachesPanel.Children.Add(exp);
                    }
                }
            }
        }