public static List <UserInformationVm> MapList(List <UserInformation> userInformation)
        {
            var userInformationList = new List <UserInformationVm>();

            foreach (var item in userInformation)
            {
                var userInfo = new UserInformationVm();

                userInfo.IdUserInformation = item.IdUserInformation;
                userInfo.IdTask            = item.IdTask;
                userInfo.IdUser            = item.IdUser;
                userInfo.IdTaskStatus      = item.IdTaskStatus;
                userInfo.Area = item.Area;

                userInfo.UserFistName     = item.User.FirstName;
                userInfo.UserSurname      = item.User.Surname;
                userInfo.TaskName         = item.Task.Name;
                userInfo.TaskDescripton   = item.Task.Description;
                userInfo.StatusOfTaskName = item.StatusOfTask.Name;

                userInformationList.Add(userInfo);
            }

            return(userInformationList);
        }
Exemple #2
0
        public void InitEdit(UserInformationVm userInformationVm)
        {
            if (LocalConfig.LoginModel.IdAccountType == (int)AccountType.Boss)
            {
                taskForEditor.IsVisible  = true;
                taskForEditor.IsReadOnly = true;
                deleteButton.IsVisible   = true;

                taskNameEditor.Text        = userInformationVm.TaskName;
                taskDescriptionEditor.Text = userInformationVm.TaskDescripton;
                taskAreaEditor.Text        = userInformationVm.Area;
                taskForEditor.Text         = userInformationVm.UserFullName;
            }
            else if (LocalConfig.LoginModel.IdAccountType == (int)AccountType.Employee)
            {
                taskForLabel.IsVisible           = false;
                employeesStackLayout.IsVisible   = false;
                taskNameEditor.IsReadOnly        = true;
                taskDescriptionEditor.IsReadOnly = true;

                taskNameEditor.Text        = userInformationVm.TaskName;
                taskDescriptionEditor.Text = userInformationVm.TaskDescripton;
                taskAreaEditor.Text        = userInformationVm.Area;
            }
            addButton.IsVisible  = true;
            mapsButton.IsVisible = true;
        }
Exemple #3
0
 public AddEditTaskPage(UserInformationVm userInformationVm)
 {
     userInfoVm = userInformationVm;
     InitializeComponent();
     InitEdit(userInformationVm);
     isEdit       = true;
     slider.Value = (double)userInformationVm.IdTaskStatus - 1;
 }
 public static UserInformation MapFromVm(UserInformationVm usInfoVm)
 {
     return(new UserInformation
     {
         IdUserInformation = usInfoVm.IdUserInformation,
         IdTask = usInfoVm.IdTask,
         IdTaskStatus = usInfoVm.IdTaskStatus,
         IdUser = usInfoVm.IdUser,
         Area = usInfoVm.Area
     });
 }
Exemple #5
0
 public IActionResult Edit(UserInformationVm userInformation, string token)
 {
     if (userInformation == null)
     {
         return(Ok(ResponseManager.GenerateResponse("Błąd: Informacje dla użytkownika są puste", (int)MessageType.Error, null)));
     }
     else
     {
         _service.EditUserInformation(userInformation);
         return(Ok(ResponseManager.GenerateResponse(null, (int)MessageType.Ok, null)));
     }
 }
Exemple #6
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("..");
                }
            }
        }
Exemple #7
0
 public async static void EditUserInformation(UserInformationVm userInformation)
 {
     var address = Api.BuildAdress(userInformationController, editUserInformation, null, null, "?token=");
     await Api.Request(RestSharp.Method.POST, address, userInformation);
 }
Exemple #8
0
        public void EditUserInformation(UserInformationVm userInformationVm)
        {
            var userInformation = UserInformationMapper.MapFromVm(userInformationVm);

            _repo.EditUserInformation(userInformation);
        }