Пример #1
0
        /// <summary>
        /// VisitPage constructor takes refference to window as parameter
        /// Loads database context
        /// Fills dropdowns
        /// </summary>
        /// <param name="window"></param>
        public VisitsPage(MainWindow window)
        {
            InitializeComponent();
            this._window  = window;
            this._context = new AppointmentsContext();
            _context.Database.EnsureCreated();
            _context.Locations.Load();
            _context.Doctors.Load();
            _context.Clients.Load();
            _context.VisitTime.Load();
            List <Locations> locations = _context.Locations.ToList();

            LocationVisitInput.ItemsSource   = locations;
            LocationVisitInput.SelectedIndex = 0;
            List <Clients>         clients        = _context.Clients.ToList();
            List <DropDownElement> clientDropDown = new List <DropDownElement>();

            foreach (Clients client in clients)
            {
                clientDropDown.Add(new DropDownElement {
                    Id = client.ClientId, Name = $"{client.Name} {client.LastName}"
                });
            }
            CustomerVisitInput.ItemsSource   = clientDropDown;
            CustomerVisitInput.SelectedIndex = 0;
            _fromHours = FillTimeDropDown();
            FromTimeVisitInput.ItemsSource   = _fromHours;
            FromTimeVisitInput.SelectedIndex = 0;
            _toHours = FillTimeDropDown();
            ToVisitInput.ItemsSource   = _toHours;
            ToVisitInput.SelectedIndex = 0;
            DoctorVisitInput.IsEnabled = false;
        }
        public AppointmentsController(Services.Calendar calendar, AppointmentsContext context, Services.TelegramBotService botService)
        {
            _calendar = calendar;

            _dbContext = context;

            _botService = botService;
        }
        /// <summary>
        /// AdminPage constructor with window refference as parameter
        /// Loads database context
        /// Fills Locations selectBox with Locations from database
        /// </summary>
        /// <param name="window"></param>
        public AdminPage(MainWindow window)
        {
            InitializeComponent();
            this._window  = window;
            this._context = new AppointmentsContext();
            _context.Database.EnsureCreated();
            _context.Locations.Load();
            _context.Doctors.Load();
            _context.Clients.Load();
            List <Locations> locations = _context.Locations.ToList();

            DoctorLocationInput.ItemsSource   = locations;
            DoctorLocationInput.SelectedIndex = 0;
        }
        /// <summary>
        /// ListPage constructor gets two parameters refference to window and bool if list is for doctors or for customers
        /// Loads database, puts data into drop down (based on bool doctors list or clients list) and data grid
        /// </summary>
        /// <param name="window"></param>
        /// <param name="isDoctor"></param>
        public ListPage(MainWindow window, bool isDoctor)
        {
            InitializeComponent();
            this._context = new AppointmentsContext();
            _context.Database.EnsureCreated();
            _context.Locations.Load();
            _context.Doctors.Load();
            _context.Clients.Load();
            _context.Visits.Load();
            _context.VisitTime.Load();
            this._window   = window;
            this._isDoctor = isDoctor;
            List <DropDownElement> dropDownElements = new List <DropDownElement>();

            visitsDataGrid.ItemsSource = CreateDataGridSource(false, false);
            if (isDoctor)
            {
                SelectBoxLabel.Content = "Select Doctor:";
                _doctors = _context.Doctors.ToList();
                foreach (Doctors doctor in _doctors)
                {
                    dropDownElements.Add(new DropDownElement {
                        Id = doctor.DoctorId, Name = $"{doctor.Name} {doctor.LastName}"
                    });
                }
            }
            else
            {
                SelectBoxLabel.Content = "Select Customer:";
                _customers             = _context.Clients.ToList();
                foreach (Clients customer in _customers)
                {
                    dropDownElements.Add(new DropDownElement {
                        Id = customer.ClientId, Name = $"{customer.Name} {customer.LastName}"
                    });
                }
            }
            FilterDropDown.ItemsSource   = dropDownElements;
            FilterDropDown.SelectedIndex = 0;
        }
 public DaysController()
 {
     db = new AppointmentsContext();
 }
Пример #6
0
 public HomeController(ILogger <HomeController> logger, AppointmentsContext context)
 {
     _logger  = logger;
     _context = context;
 }
 public TimeslotsController()
 {
     db = new AppointmentsContext();
 }
Пример #8
0
 public AppointmentsController(AppointmentsContext appointmentsContext)
 {
     _appointmentsContext = appointmentsContext;
 }
 public MeetingStatusController()
 {
     db = new AppointmentsContext();
 }