Exemplo n.º 1
0
        public MainWindow()
        {
            cf = new CustomerFacade();
            af = new AppointmentFacade(cf);
            InitializeComponent();
            customersList = cf.LoadAllCustomers();

            customersDataGrid.ItemsSource = customersList;
            GetAppointments();
        }
Exemplo n.º 2
0
        bool EditInsteadOfSave; // true = opdater kunde .. false = opret ny kunde

        public CreateCustomerDialog(MainWindow mainWindow, CustomerFacade cfInput, AppointmentFacade afInput, List <ICustomer> customers)
        {
            InitializeComponent();
            cf              = cfInput;
            af              = afInput;
            customersList   = customers;
            icustomer       = cf.CreateCustomer();
            this.mainWindow = mainWindow;

            EditInsteadOfSave = false;

            appointments = new List <IAppointment>();
            AppointmentListView.ItemsSource = appointments;
        }
        private void onClickAddAppointment(object sender, RoutedEventArgs e)
        {
            appointment = AppointmentFacade.CreateAppointment();

            try
            {
                appointment.Name        = txtboxNavn.Text;
                appointment.Description = txtboxBeskrivelse.Text;

                TimeSpan tidspunkt;
                TimeSpan.TryParse(txtboxTidspunkt.Text, out tidspunkt);

                if (dpStartDate.SelectedDate != null)
                {
                    appointment.StartDate = dpStartDate.SelectedDate.Value.Add(tidspunkt);
                }
                else
                {
                    appointment.StartDate = DateTime.Now;
                }

                int freq;
                int.TryParse(txtboHyppighed.Text, out freq);
                appointment.Frequency = freq;

                double price;
                double.TryParse(txtboxPris.Text, out price);
                appointment.Price = price;

                appointment.City    = txtboxBy.Text;
                appointment.ZipCode = txtboxPostnr.Text;
                appointment.Address = txtboxAddresse.Text;

                //appointments.Add(appointment);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                MessageBox.Show("Fejl! " + e.ToString());
            }

            Close();
        }
Exemplo n.º 4
0
        // Constructor til "Ændre Kunde":
        public CreateCustomerDialog(MainWindow mainWindow, CustomerFacade cfInput, AppointmentFacade afInput, List <ICustomer> customers, ICustomer cust)
        {
            InitializeComponent();
            cf              = cfInput;
            af              = afInput;
            customersList   = customers;
            icustomer       = cust;
            this.mainWindow = mainWindow;

            appointments = cust.Appointments;
            AppointmentListView.ItemsSource = appointments;

            EditInsteadOfSave = true;

            nameTextBox.Text          = cust.Name;
            contactPersonTextBox.Text = cust.ContactPerson;
            addressTextBox.Text       = cust.Address;
            cityTextBox.Text          = cust.City;
            zipCodeTextBox.Text       = cust.ZipCode;
            phoneNumberTextBox.Text   = cust.PhoneNumber;
        }