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);
        }
        public AddGraficWnd()
        {
            DataContext = this;

            foreach (var item in StaffRepository.GetInstance().GetAll())
            {
                if (item.Position.Name.Equals("Coach"))
                {
                    Coach.Add(item);
                }
            }
            InitializeComponent();
        }
Beispiel #3
0
        } //открытие панели регистрации

        private void OkRegBtn_Click(object sender, RoutedEventArgs e)
        {
            Staff nStaff = new Staff
            {
                Name           = nameRegTb.Text,
                SurName        = surnameRegtb.Text,
                PhoneNumber    = phoneRegTb.Text,
                WorkExperience = float.Parse(workRegTb.Text),
                Account        = new Accounts
                {
                    Password = passRegTb.Password,
                    Login    = emailRegTb.Text
                },
                Position = PositionRepository.GetInstance().Get((positionRegCb.SelectedItem as Position).Id),
                Complex  = ComplexRepository.GetInstance().Get(int.Parse(workPlaceRegCb.SelectedItem.ToString().ToArray().First().ToString()))
            };

            StaffRepository.GetInstance().Add(nStaff);

            CloseSignInPanel();
        } //регистрация пользователя
        static void Main(string[] args)
        {
            var tree       = new TreeVisitor <Staff>();
            var repository = StaffRepository.GetInstance("Data/input.txt");
            var root       = repository.GetRoot();

            var staffQueue = new Queue <TreeNode <Staff> >();

            staffQueue.Enqueue(root);
            while (staffQueue.Count != 0)
            {
                var staffNode   = staffQueue.Dequeue();
                var permissions = tree.Traverse(staffNode, staff => staff.Permissions);
                Console.WriteLine($"{staffNode.Data.Name}'s accessible permissions: {string.Join(", ", permissions.Select(p => p.Name))}.");

                staffNode.Children.ForEach(x => staffQueue.Enqueue(x));
            }

            Console.WriteLine("_______________________");

            var commandRepository = CommandAndQueryRepository.GetInstance("Data/commands.txt");
            var commands          = commandRepository.GetCommands();

            foreach (var command in commands)
            {
                var result = command.Execute(root);
                if (!string.IsNullOrEmpty(result))
                {
                    Console.WriteLine($"Result of {command.CommandString} command: {command.Execute(root)}.");
                }
                else
                {
                    Console.WriteLine($"Command {command.CommandString} executed.");
                }
            }
        }