예제 #1
0
        public void SetNewTask(string recepient, string taskDesc, string taskPriority)
        {
            var sender = Clients.CallerState.UserName;

            if (!string.IsNullOrEmpty(sender))
            {
                if (recepient != sender)
                {
                    if (!string.IsNullOrEmpty(taskDesc))
                    {
                        if (ChatClients.ContainsKey(recepient))
                        {
                            KChatTask task = new KChatTask(sender, recepient, taskDesc, taskPriority);

                            User client = new User();
                            ChatClients.TryGetValue(recepient, out client);
                            Console.WriteLine($"{sender} set task to {recepient}");
                            DbHelper.SetTask(task);

                            Clients.Client(client.ID).SetNewTask(sender, taskDesc, taskPriority);
                        }
                    }
                }
            }
        }
예제 #2
0
        public static void SetTask(KChatTask task)
        {
            var cmd = Conn.CreateCommand();

            cmd.CommandText = $"INSERT INTO KTasks(Author,CreatedOnDate,Assignee,TaskState,TaskDescription, TaskPriority) " +
                              $"VALUES('{task.Author}','{task.CreatedOnDate.ToString("yyyy-MM-dd hh:mm")}','{task.Assignee}','{task.TaskState.ToString()}','{task.TaskDesc}',{task.TaskPriority})";
            cmd.ExecuteNonQuery();
        }