Пример #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            service          = (UserInformationService)e.Parameter;
            this.DataContext = new SummaryViewModel(service);
        }
Пример #2
0
        public ControlViewModel()
        {
            userInformationService = new UserInformationService();
            next          = true;
            NextCommand   = new RelayCommand(NextStep, () => Next);
            BackCommand   = new RelayCommand(BackToLastStep, () => Back);
            FinishCommand = new RelayCommand(FinishStep, () => Finish);

            currentIndex = UserInformationIndex.FirstName;
            currentStep  = ControlUserInformations.First(s => s.Index == currentIndex);
        }
Пример #3
0
        public PersonalData GetUserPersonalDataById(long userId)
        {
            UserAccount user = UserInformationService.GetUserAccountById(userId);

            Console.Write(user);
            if (user.PersonalData == null)
            {
                throw new Exception();
            }
            return(user.PersonalData);
        }
Пример #4
0
        private void GetUserDefaultPage(int userId)
        {
            string url = new UserInformationService().GetDefaultPage(userId);

            if (!string.IsNullOrEmpty(url))
            {
                defaultUri = url;
                this.MainFrame.Navigate(new Uri(url, UriKind.Relative));
            }
            else
            {
                this.MainFrame.Navigate(new Uri("/View/IndexPage/UserDefaultPage.xaml", UriKind.Relative));
            }
        }
Пример #5
0
        protected async virtual Task <List <UserInformationVm> > GetData()
        {
            List <UserInformationVm> data = new List <UserInformationVm>();

            if (LocalConfig.LoginModel.IdAccountType == (int)AccountType.Employee)
            {
                data = await UserInformationService.GetUserInformationListForEmployee(LocalConfig.LoginModel.Id);
            }
            else if (LocalConfig.LoginModel.IdAccountType == (int)AccountType.Boss)
            {
                data = await UserInformationService.GetUserInformationListForBoss(LocalConfig.LoginModel.Id);
            }

            return(data);
        }
Пример #6
0
 public UserPage(UserInformationService userInformationService)
 {
     _userInformationService = userInformationService;
     InitializeComponent();
 }
Пример #7
0
        private async void AddButton_Clicked(object sender, EventArgs e)
        {
            if (!isEdit)
            {
                bool       isTaskNameEditor = string.IsNullOrEmpty(taskNameEditor.Text);
                List <int> IdEmployeesList  = GetCheckEmployees();

                if (IdEmployeesList.Count != 0)
                {
                    if (isTaskNameEditor)
                    {
                        await DisplayAlert("Uwaga!", "Nazwa zadania jest pusta", "Ok");
                    }
                    else
                    {
                        var taskVm = new TaskVm()
                        {
                            Name        = taskNameEditor.Text,
                            Description = taskDescriptionEditor.Text
                        };

                        var data = await TaskService.AddTask(taskVm);

                        if (IdEmployeesList.Count == 0)
                        {
                            await DisplayAlert("Uwaga!", "Nie wybrałeś pracownika do wykonania zadania", "Ok");
                        }
                        else
                        {
                            foreach (var item in IdEmployeesList)
                            {
                                var userInformationVm = new UserInformationVm
                                {
                                    IdUser       = item,
                                    IdTask       = data.IdTask,
                                    Area         = taskAreaEditor.Text,
                                    IdTaskStatus = 1
                                };

                                UserInformationService.AddUserInformation(userInformationVm);
                                await DisplayAlert("OK!", "Pomyślnie dodano zadania!", "Ok");

                                await Shell.Current.GoToAsync("..");//cofajnie do poprzedniej strony
                            }
                        }
                    }
                }
                else
                {
                    await DisplayAlert("Uwaga!", "Nie wybrałeś pracownika do wykonania zadania", "Ok");
                }
            }
            else
            {
                bool isTaskNameEditor = string.IsNullOrEmpty(taskNameEditor.Text);

                if (isTaskNameEditor)
                {
                    await DisplayAlert("Uwaga!", "Nazwa zadania jest pusta", "Ok");
                }
                else
                {
                    var userInformationVm = new UserInformationVm
                    {
                        IdUserInformation = userInfoVm.IdUserInformation,
                        IdTask            = userInfoVm.IdTask,
                        IdUser            = userInfoVm.IdUser,
                        Area         = taskAreaEditor.Text,
                        IdTaskStatus = idStatusOfTask
                    };

                    var taskVm = new TaskVm()
                    {
                        IdTask      = (int)userInfoVm.IdTask,
                        Name        = taskNameEditor.Text,
                        Description = taskDescriptionEditor.Text
                    };

                    UserInformationService.EditUserInformation(userInformationVm);
                    TaskService.EditTask(taskVm);
                    await DisplayAlert("OK!", "Pomyślnie zapisano zadanie!", "Ok");

                    await Shell.Current.GoToAsync("..");
                }
            }
        }
 public SummaryViewModel(UserInformationService userInformationService)
 {
     this.userInformationService = userInformationService;
     ReturnToStartCommand        = new RelayCommand(GoToMain);
 }
Пример #9
0
 public AddressViewModel(UserInformationService informationServices)
 {
     userInformationService = informationServices;
     Index = UserInformationIndex.Address;
 }
Пример #10
0
 public ViewResult(UserInformationService userInformationService)
 {
     _userInformationService = userInformationService;
     InitializeComponent();
 }