Esempio n. 1
0
        private void LoadCommect(HttpClientProvider httpClientProvider, Comment comment)
        {
            var user = CommonMethods.SafeRunMethod.WithReturn(() => httpClientProvider.GetDatabaseUserReader().GetById(comment.UserId));

            if (user == null)
            {
                return;
            }

            LabelUserName.Content       = user.Login;
            LabelCreateDateTime.Content = comment.CreateDateTime.ToString("dd.MM.yyyy HH:mm:ss");
            TextBoxCommentContent.Text  = comment.Content;
        }
Esempio n. 2
0
        private void ButtonSendComment_OnClick(object sender, RoutedEventArgs e)
        {
            if (CommonMethods.Check.FieldIsEmpty(TextBoxCommentContent))
            {
                CommonMethods.ShowMessageBox.Error("Необходимо написать комментарий");
                return;
            }

            var userId = CommonMethods.SafeRunMethod.WithReturn(() => httpClientProvider.GetDatabaseUserReader().GetWithUsingFilters(httpClientProvider.Login))?.First()?.UserId;

            if (userId == null)
            {
                return;
            }

            CommonMethods.SafeRunMethod.WithoutReturn(() => httpClientProvider.GetDatabaseCommentEditor().Add(new Comment {
                Content = TextBoxCommentContent.Text,
                UserId  = userId.Value,
                TaskId  = thisTask.TaskId
            }));

            TextBoxCommentContent.Text = string.Empty;
            UpdateListComments();
        }
Esempio n. 3
0
 private Dictionary <string, Guid> GetUserNames()
 {
     return(CommonMethods.SafeRunMethod.WithReturn(() => httpClientProvider.GetDatabaseUserReader().GetAll().ToDictionary(user => user.Login, user => user.UserId)));
 }
Esempio n. 4
0
 private Guid GetThisUserId()
 {
     return(CommonMethods.SafeRunMethod.WithReturn(() => httpClientProvider.GetDatabaseUserReader().GetWithUsingFilters(httpClientProvider.Login).First().UserId));
 }
Esempio n. 5
0
 private void DataGridUsers_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     CommonMethods.WorkWithTables.View(SelectedUser, httpClientProvider.GetDatabaseUserReader(), CommonMethods.GetWindow.User());
 }
Esempio n. 6
0
        private TaskControl CreateTaskControl(HttpClientProvider httpClientProvider, Column column, Task task)
        {
            var developerName = task.DeveloperId == null ? string.Empty : CommonMethods.SafeRunMethod.WithReturn(() => httpClientProvider.GetDatabaseUserReader().GetById(task.DeveloperId.Value).Login);

            var taskControl = new TaskControl(httpClientProvider, task, (Brush) new BrushConverter().ConvertFromString(column.Brush), developerName);

            taskControl.AddTask    += (sender, args) => CreateColumn(httpClientProvider, thisColumn);
            taskControl.EditTask   += (sender, args) => CreateColumn(httpClientProvider, thisColumn);
            taskControl.DeleteTask += (sender, args) => CreateColumn(httpClientProvider, thisColumn);

            return(taskControl);
        }