示例#1
0
        public static CustomerDTO CreateNewCustomer(UserSearchDTO connectedAccount = null)
        {
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrCustomerDetails();

            dlg.SetControl(ctrl);
            var customer = new CustomerDTO();

            customer.Settings         = new CustomerSettingsDTO();
            customer.ConnectedAccount = connectedAccount;
            ctrl.SelectedCustomer     = customer;
            if (dlg.ShowDialog() == true)
            {
                //FillActivities();//TODO:maybe we should change this
                CustomersReposidory.Instance.Add(ctrl.Customer);
                //refresh reminders only if this customer has it
                if (ctrl.Customer.RemindBefore != null)
                {
                    ReminderItemsReposidory.Instance.ClearCache();
                }
                return(ctrl.Customer);
            }
            return(null);
        }
        public void EditSelected()
        {
            if (SelectedEntry.IsLocked)
            {
                return;
            }
            var dlg = new EditDomainObjectWindow();
            IEditableControl ctrl = null;


            var viewModel = SelectedEntry;

            if (!viewModel.IsNew)
            {
                viewModel = viewModel.Clone();
            }

            if (SelectedEntry is ScheduleEntryDTO)
            {
                var control = new usrScheduleEntryDetails();
                ctrl = control;
                control.Fill(viewModel);
                dlg.SetControl(control);
            }
            else
            {
                var control = new usrChampionshipScheduleEntryEditor();
                ctrl = control;
                control.Fill(viewModel);
                dlg.SetControl(control);
            }


            if (dlg.ShowDialog() == true)
            {
                IsModified = true;
                update((ScheduleEntryBaseDTO)ctrl.Object);
            }
        }
        public void EditSelectedActivity()
        {
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrActivityDetails();

            dlg.SetControl(ctrl);
            ctrl.Fill(SelectedActivity.Clone());
            if (dlg.ShowDialog() == true)
            {
                replace(SelectedActivity, ctrl.Activity);
            }
        }
示例#4
0
        public void New()
        {
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrReminderDetails();

            dlg.SetControl(ctrl);
            var reminder = new ReminderItemDTO();

            ctrl.ReminderItem = reminder;
            if (dlg.ShowDialog() == true)
            {
                ReminderItemsReposidory.Instance.Add(ctrl.ReminderItem);
            }
        }
        private void editSelectedItem()
        {
            if (!UIHelper.EnsurePremiumLicence())
            {
                return;
            }
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrMyPlaceDetails();

            dlg.SetControl(ctrl);
            ctrl.Fill(SelectedItem.Clone());
            if (dlg.ShowDialog() == true)
            {
                replace(SelectedItem, ctrl.MyPlace);
            }
        }
示例#6
0
        public void EditSelectedItem()
        {
            if (!UIHelper.EnsureInstructorLicence())
            {
                return;
            }
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrCustomerGroupDetails();

            dlg.SetControl(ctrl);
            ctrl.Fill(SelectedItem.Clone());
            if (dlg.ShowDialog() == true)
            {
                replace(SelectedItem, ctrl.CustomerGroup);
            }
        }
示例#7
0
        public void Edit()
        {
            if (SelectedReminder.Type != ReminderType.Custom)
            {
                return;
            }
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrReminderDetails();

            dlg.SetControl(ctrl);
            ctrl.ReminderItem = SelectedReminder.Clone();
            if (dlg.ShowDialog() == true)
            {
                replace(SelectedReminder, ctrl.ReminderItem);
            }
        }
        public void NewActivity()
        {
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrActivityDetails();

            dlg.SetControl(ctrl);
            ActivityDTO activity = new ActivityDTO();

            activity.Color = Color.LightGreen.ToColorString();
            ctrl.Fill(activity);
            if (dlg.ShowDialog() == true)
            {
                ActivitiesReposidory.Instance.Add(ctrl.Activity);
                NotifyOfPropertyChange(() => Activities);
            }
        }
示例#9
0
        private void rbtnNew_Click(object sender, RoutedEventArgs e)
        {
            //ExerciseEditorWindow dlg = new ExerciseEditorWindow();
            //var newExercise = new ExerciseDTO();
            //if (SelectedExerciseType.HasValue)
            //{
            //    newExercise.ExerciseType = SelectedExerciseType.Value;
            //}
            //else if(SelectedExercise!=null)
            //{
            //    newExercise.ExerciseType = SelectedExercise.ExerciseType;
            //}
            //dlg.Fill(newExercise);
            //if(dlg.ShowDialog()==true)
            //{
            //    Fill();
            //}

            if (!UIHelper.EnsurePremiumLicence())
            {
                return;
            }
            var dlg = new EditDomainObjectWindow();

            var ctrl        = new usrExerciseEditor();
            var newExercise = new ExerciseDTO();

            if (SelectedExerciseType.HasValue)
            {
                newExercise.ExerciseType = SelectedExerciseType.Value;
            }
            else if (SelectedExercise != null)
            {
                newExercise.ExerciseType = SelectedExercise.ExerciseType;
            }
            ctrl.Fill(newExercise, ExercisesReposidory.Instance.Items.Values);
            dlg.SetControl(ctrl);

            if (dlg.ShowDialog() == true)
            {
                ExercisesReposidory.Instance.Add((ExerciseDTO)ctrl.Object);
                Fill(pageContext);
            }
        }
示例#10
0
        public void EditSelectedItem()
        {
            if (!UIHelper.EnsureInstructorLicence())
            {
                return;
            }
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrCustomerDetails();

            dlg.SetControl(ctrl);
            ctrl.SelectedCustomer = SelectedItem.Clone();
            if (dlg.ShowDialog() == true)
            {
                replace(SelectedItem, ctrl.Customer);
                //refresh reminders
                ReminderItemsReposidory.Instance.ClearCache();
            }
        }
示例#11
0
        private void rbtnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (!UIHelper.EnsurePremiumLicence())
            {
                return;
            }

            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrExerciseEditor();

            ctrl.Fill(SelectedExercise.StandardClone(), ExercisesReposidory.Instance.Items.Values);
            dlg.SetControl(ctrl);

            if (dlg.ShowDialog() == true)
            {
                ExercisesReposidory.Instance.Update((ExerciseDTO)ctrl.Object);
                Fill(pageContext);
            }
        }
示例#12
0
        private void newItem()
        {
            if (!UIHelper.EnsurePremiumLicence())
            {
                return;
            }
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrMyPlaceDetails();

            dlg.SetControl(ctrl);
            var myPlace = new MyPlaceDTO();

            myPlace.Color = Color.LavenderBlush.ToColorString();
            ctrl.Fill(myPlace);
            if (dlg.ShowDialog() == true)
            {
                _myPlacesCache.Add(ctrl.MyPlace);
                NotifyOfPropertyChange(() => Items);
            }
        }
示例#13
0
        public void NewGroup()
        {
            if (!UIHelper.EnsureInstructorLicence())
            {
                return;
            }
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrCustomerGroupDetails();

            dlg.SetControl(ctrl);
            var customer = new CustomerGroupDTO();

            customer.Color = Color.LightGoldenrodYellow.ToColorString();
            ctrl.Fill(customer);
            if (dlg.ShowDialog() == true)
            {
                CustomerGroupsReposidory.Instance.Add(ctrl.CustomerGroup);
                NotifyOfPropertyChange(() => Items);
            }
        }