public void GetToDoList(string userName) { List<TodoMessageDto> result = null; using (var context = new TodoDBEntities()) { var user = context.Users.FirstOrDefault(x => x.UserName == userName); result = context.TodoMessages.AsEnumerable(). Select(x => new TodoMessageDto { Id = x.ID, IsCompleted = x.IsCompleted, Message = x.Message, Person = x.Person, Priority = (PriorityType)(x.PriorityID ?? 1), IsOwn = user != null && x.UserID == user.ID, Owner = x.Users != null ? x.Users.UserName : "******" }).OrderBy(x => x.IsOwn).ToList(); } using (var callback = new TodoServiceCallbackClient()) callback.OnGetToDoListComplete(userName, result); }
private void RunPriorityWorkflow(string userName, IEnumerable<TodoMessageDto> list) { Dictionary<string, object> workflowInputArguments = new Dictionary<string, object> { { "UserName", userName }, { "TodoMessages", list } }; WorkflowApplication wfApp = new WorkflowApplication(TodoService.PriorityWorkflow.Value, workflowInputArguments); wfApp.Completed = (workflowCompletedArgs) => { using (var callback = new TodoServiceCallbackClient()) callback.OnUpdateToDoMessagesComplete(userName, true); }; wfApp.Run(); }
public void GetPersonsList(string userName, string personKey) { //if (string.IsNullOrWhiteSpace(personKey)) List<string> result = null; using (var context = new TodoDBEntities()) { result = context.TodoMessages.Where(x => x.Person.IndexOf(personKey) != -1).Select(x => x.Person).Distinct().ToList(); } using (var callback = new TodoServiceCallbackClient()) callback.OnGetPersonsListComplete(userName, result); }
public void RemoveToDoMessages(string userName, IEnumerable<int> ids) { //if (!ValidateEnumerableParam(ids)) return; using (var context = new TodoDBEntities()) { context.ExecuteStoreCommand(@"delete from TodoMessages where ID in (" + string.Join(",", ids).PadRight(1) + ")"); context.SaveChanges(); } using (var callback = new TodoServiceCallbackClient()) callback.OnRemoveToDoMessagesComplete(userName, true); }