public void CreateToDoItem(IToDoItem todo) { ServiceReference1.TasksServiceClient task = new TasksServiceClient(); DummyToDoManager.ToDoManager manager = new DummyToDoManager.ToDoManager(); try { manager.CreateToDoItem(todo); update = true; task.Add(new Task() { RemoteStatus = true, IsCompleted = todo.IsCompleted, TaskId = todo.ToDoId.ToString(), TaskName = todo.Name, UserId = todo.UserId.ToString() }); } catch { task.Add(new Task() { RemoteStatus = false, IsCompleted = todo.IsCompleted, TaskId = todo.ToDoId.ToString(), TaskName = todo.Name, UserId = todo.UserId.ToString() }); } }
static void AddOrMerge(IToDoItem item, ObservableCollection <IToDoItem> toDo, ObservableCollection <IToDoItem> toDone) { var toDoIndex = toDo.IndexOf(item); var toDoneIndex = toDone.IndexOf(item); if (toDoIndex < 0 && toDoneIndex < 0) { if (item.Completed) { toDone.Add(item); } else { toDo.Add(item); } return; } if (toDoneIndex >= 0) { if (toDone [toDoneIndex].Text != item.Text) { toDone [toDoneIndex].Text = item.Text; toDone [toDoneIndex] = toDone [toDoneIndex]; // force change } return; } if (toDo [toDoIndex].Text != item.Text) { toDo [toDoIndex].Text = item.Text; toDo [toDoIndex] = toDo [toDoIndex]; } }
public void CreateToDoItem(IToDoItem todo) { using (StreamWriter writer = new StreamWriter("add.json")) { writer.WriteLine(JsonConvert.SerializeObject(todo)); } string temp; List<IToDoItem> items = new List<IToDoItem>(); if (File.Exists("items.json")) { using (StreamReader reader = new StreamReader("items.json")) { temp = reader.ReadToEnd(); } items = JsonConvert.DeserializeObject<List<ToDoItem>>(temp).Select(item => (IToDoItem) item).ToList(); items.Add(new ToDoItem() { IsCompleted = todo.IsCompleted, Name = todo.Name, ToDoId = todo.ToDoId, UserId = todo.UserId }); temp = JsonConvert.SerializeObject(items); using (StreamWriter writer = new StreamWriter("items.json", false)) { writer.WriteLine(temp); } ThreadPool.QueueUserWorkItem(CreateToDoItemWork, todo); } }
// Token: 0x06001659 RID: 5721 RVA: 0x0007DEAC File Offset: 0x0007C0AC protected override void OnObjectModified(IMapiEvent mapiEvent, IMailboxSession itemStore, IStoreObject item, List <KeyValuePair <string, object> > customDataToLog) { ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "ToDoModernReminderProcessor.OnObjectModified"); if (item != null) { ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "ToDoModernReminderProcessor.OnObjectModified - item exists"); IToDoItem toDoItem = (IToDoItem)item; Reminders <ModernReminder> reminders = toDoItem.ModernReminders; if (reminders != null) { ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "ToDoModernReminderProcessor.OnObjectModified - Reminders exist -> schedule reminder"); int numRemindersScheduled = 0; customDataToLog.Add(new KeyValuePair <string, object>("ToDoRemSchd.Latency", base.ExecuteAndMeasure(delegate { numRemindersScheduled = this.ReminderMessageManager.ScheduleReminder(itemStore, toDoItem, reminders); }).ToString())); customDataToLog.Add(new KeyValuePair <string, object>("ToDoRemSchd.Count", numRemindersScheduled)); return; } ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "ToDoModernReminderProcessor.OnObjectModified - Modern reminders don't exist -> clearing the reminder"); customDataToLog.Add(new KeyValuePair <string, object>("ToDoRemClr.Latency", base.ExecuteAndMeasure(delegate { this.ReminderMessageManager.ClearReminder(itemStore, toDoItem); }).ToString())); } }
public void CreateToDoItem(IToDoItem todo) { if (todo.UserId != currentUserId) LoadLocalStorage(todo.UserId); todo.ToDoId = localItems.Count; localItems.Add(todo); Task.Run(() => AddItemRemote(todo)); Task.Run(() => InvokeWorkQueue()); }
// Token: 0x060015D5 RID: 5589 RVA: 0x0007ADD8 File Offset: 0x00078FD8 protected override void OnObjectDeleted(IMapiEvent mapiEvent, IMailboxSession itemStore, IStoreObject item, List <KeyValuePair <string, object> > customDataToLog) { ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "EmailModernReminderProcessor.OnObjectDeleted"); if (item != null) { ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "EmailModernReminderProcessor.OnObjectDeleted - item exists"); IToDoItem messageItem = (IToDoItem)item; this.DeleteReminderMessages(itemStore, messageItem, customDataToLog); } }
public bool Equals(IToDoItem other) { var item = other as ToDoItem; if (item == null) { return(false); } return(item.identifier == identifier); }
public void Setup() { _ToDoItemRepository = new Mock <IToDoItemRepo>(); _ToDoItemService = new ToDoItemService(_ToDoItemRepository.Object, Mapper); _ToDoItemRepository.Setup(p => p.Add(It.IsAny <CreateToDoItemDto>())).Returns(Task.FromResult(_toDoItemDto)); _ToDoItemRepository.Setup(p => p.Update(It.IsAny <UpdateToDoItemDto>())).Returns(Task.FromResult(_toDoItemDto)); _ToDoItemRepository.Setup(p => p.Delete(It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult(1)); _ToDoItemRepository.Setup(p => p.GetById(It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult(_toDoItemDto)); _ToDoItemRepository.Setup(p => p.GetAllByUser(It.IsAny <PaginationParameters>(), It.IsAny <int>())).Returns(Task.FromResult(_toDoItemDtos)); }
public void UpdateToDoItem(IToDoItem todo) { int index = items.FindIndex(i => i.ToDoId == todo.ToDoId); if (index != -1) { items.RemoveAt(index); items.Add(todo); } //SyncToDoItems(); }
public async void UpdateToDoItem(IToDoItem todo) { int index = items.FindIndex(i => i.ToDoId == todo.ToDoId); if (index != -1) { items.RemoveAt(index); items.Add(todo); } await fastClient.SyncUpdateItemAsync((CustomTask)todo); }
public ToDoItemContract Build(IToDoItem toDoItemEntity) { ToDoItemContract toDoItemContract = new ToDoItemContract(); toDoItemContract.Id = toDoItemEntity.Id; toDoItemContract.Title = toDoItemEntity.Title; toDoItemContract.Description = toDoItemEntity.Description; toDoItemContract.Complete = toDoItemEntity.Complete; return toDoItemContract; }
public ToDoItemContract Build(IToDoItem toDoItemEntity) { ToDoItemContract toDoItemContract = new ToDoItemContract(); toDoItemContract.Id = toDoItemEntity.Id; toDoItemContract.Title = toDoItemEntity.Title; toDoItemContract.Description = toDoItemEntity.Description; toDoItemContract.Complete = toDoItemEntity.Complete; return(toDoItemContract); }
public string Save(IToDoItem toDoItem) { if (!string.IsNullOrEmpty(toDoItem.Id)) { return(Update(toDoItem)); } else { return(Insert(toDoItem)); } }
private string Insert(IToDoItem toDoItem) { try { return(_toDoMapper.Insert(toDoItem)); } catch (Exception ex) { throw ex; } }
private string Insert(IToDoItem toDoItem) { try { return _toDoMapper.Insert(toDoItem); } catch (Exception ex) { throw ex; } }
public string Save(IToDoItem toDoItem) { if (!string.IsNullOrEmpty(toDoItem.Id)) { return Update(toDoItem); } else { return Insert(toDoItem); } }
public bool Equals(IToDoItem other) { var item = other as ToDoItem; if (item == null) { return(false); } return(item.calendarId == calendarId && item.eventId == eventId); }
public int AddToDoItem(IToDoItem item, string userId) { var newItem = _mapper.Map <ToDoItem>(item); newItem.UserId = userId; _context.ToDoItems.Add(newItem); _context.SaveChanges(); return(newItem.Id); }
public void CreateToDoItem(IToDoItem todo) { var binding = new BasicHttpBinding(BasicHttpSecurityMode.None); binding.Name = bindName; binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; var endP = new EndpointAddress(uri); List<IToDoItem> exList = new List<IToDoItem>(0); using (var client = new Remote.ToDoManagerClient(binding, endP)) { } }
public string Insert(IToDoItem toDoItem) { string sql = "INSERT INTO ToDoItems (id, title, description, complete, parentid, orderid) OUTPUT INSERTED.id VALUES (NEWID(), @title, @description, 0, @parentid, ISNULL((select max(OrderID) + 1 from ToDoItems),0))"; // access the database and retrieve data using (IDbConnection conn = GetConnection()) { IDbCommand command = conn.CreateCommand(); command.CommandText = sql; IDbDataParameter title = new SqlParameter("@title", toDoItem.Title); IDbDataParameter description = new SqlParameter("@description", toDoItem.Description); IDbDataParameter parentid; if (String.IsNullOrEmpty(toDoItem.ParentId)) { parentid = new SqlParameter("@parentid", DBNull.Value); } else { parentid = new SqlParameter("@parentid", toDoItem.ParentId); } command.Parameters.Add(title); command.Parameters.Add(description); command.Parameters.Add(parentid); try { conn.Open(); object result = command.ExecuteScalar(); if (result != null) { return(result.ToString()); } else { throw new NoNullAllowedException("No ID returned when inserting a to do item"); } } catch (Exception ex) { throw ex; } finally { conn.Close(); } } }
public async void CreateToDoItem(IToDoItem todo) { var item = new CustomTask() { Name = todo.Name, UserId = todo.UserId, ToDoId = todo.ToDoId, IsCompleted = todo.IsCompleted }; items.Add(item as IToDoItem); isAdded = true; await fastClient.SyncToDoItemsAsync(item); }
public void CreateToDoItem(IToDoItem item) { var client = new ToDoManagerClient(); var toDoItem = new ToDoItem() { Name = item.Name, IsCompleted = item.IsCompleted, ToDoId = item.ToDoId, UserId = item.UserId }; client.CreateToDoItem(toDoItem); }
public void CreateToDoItem(IToDoItem item) { //var client = new ToDoProxyServiceClient(); var toDoItem = new ToDoProxyItem() { Name = item.Name, IsCompleted = item.IsCompleted, ToDoId = item.ToDoId, UserId = item.UserId }; client.CreateToDoItem(toDoItem); }
public void UpdateToDoItem(IToDoItem todo) { if (todo.UserId != currentUserId) LoadLocalStorage(todo.UserId); IToDoItem toUpdate = localItems.Find(x => x.ToDoId == todo.ToDoId); if (toUpdate != null) { int indexToUpdate = localItems.IndexOf(toUpdate); localItems[indexToUpdate] = todo; Task.Run(() => UpdateItemRemote(todo)); Task.Run(() => InvokeWorkQueue()); } }
public ToDoItemContract Build(IToDoItem toDoItemEntity) { ToDoItemContract toDoItemContract = new ToDoItemContract(); toDoItemContract.Id = toDoItemEntity.Id; toDoItemContract.Title = toDoItemEntity.Title; toDoItemContract.Description = toDoItemEntity.Description; toDoItemContract.Complete = toDoItemEntity.Complete; // ANDREI: mapped the parent task properties toDoItemContract.ParentTaskId = toDoItemEntity.ParentTaskId; toDoItemContract.ParentTaskTitle = toDoItemEntity.ParentTaskTitle; return toDoItemContract; }
private string Update(IToDoItem toDoItem) { try { if (_toDoMapper.Update(toDoItem)) return toDoItem.Id; else throw new Exception("No todo items updated"); } catch (Exception ex) { throw ex; } }
public async void UpdateToDoItem(IToDoItem todo) { var item = todo.ToServiceToDoItem(); repository.Update(item); isSync = false; try { var task = client.UpdateToDoItemAsync(item); await task; isSync = task.IsCompleted; } catch { //log it } }
public async Task <int> LoadToDoListItem(string toDoListItemId) { if (!string.IsNullOrEmpty(toDoListItemId)) { mCurrentToDoItem = await mDataStore.GetItemAsync(toDoListItemId); Id = mCurrentToDoItem.Id; TaskName = mCurrentToDoItem.TaskName; Priority = mCurrentToDoItem.Priority; DueDate = mCurrentToDoItem.DueDate; } DueTime = new TimeSpan(mCurrentToDoItem.DueDate.Hour, mCurrentToDoItem.DueDate.Minute, mCurrentToDoItem.DueDate.Second); return(0); }
// Token: 0x060015D6 RID: 5590 RVA: 0x0007AE54 File Offset: 0x00079054 private void DeleteReminderMessages(IMailboxSession itemStore, IToDoItem messageItem, List <KeyValuePair <string, object> > customDataToLog) { int numRemindersDeleted = 0; long num = 0L; GlobalObjectId globalObjectId = messageItem.GetGlobalObjectId(); if (globalObjectId != null) { ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "EmailModernReminderProcessor.DeleteReminderMessages - global object id exists"); num = base.ExecuteAndMeasure(delegate { numRemindersDeleted = this.ReminderMessageManager.DeleteReminderMessages(itemStore, messageItem); }); } customDataToLog.Add(new KeyValuePair <string, object>("EmlRemDel.Latency", num.ToString())); customDataToLog.Add(new KeyValuePair <string, object>("EmlRemDel.Count", numRemindersDeleted)); }
// Token: 0x060015D7 RID: 5591 RVA: 0x0007AF2C File Offset: 0x0007912C private void CreateReminderMessages(IMailboxSession itemStore, IToDoItem messageItem, List <KeyValuePair <string, object> > customDataToLog) { int numRemindersCreated = 0; long num = 0L; Reminders <ModernReminder> reminders = messageItem.ModernReminders; if (reminders != null) { ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "EmailModernReminderProcessor.CreateReminderMessages - Reminders exist"); num = base.ExecuteAndMeasure(delegate { numRemindersCreated = this.ReminderMessageManager.CreateReminderMessages(itemStore, messageItem, reminders); }); } customDataToLog.Add(new KeyValuePair <string, object>("EmlRemAdd.Latency", num.ToString())); customDataToLog.Add(new KeyValuePair <string, object>("EmlRemAdd.Count", numRemindersCreated)); }
private string Update(IToDoItem toDoItem) { try { if (_toDoMapper.Update(toDoItem)) { return(toDoItem.Id); } else { throw new Exception("No todo items updated"); } } catch (Exception ex) { throw ex; } }
public string UpdateDependentTasks(IToDoItem toDoItem) { try { if (_toDoMapper.UpdateDependentTasks(toDoItem)) { return(toDoItem.Id); } else { throw new Exception("No todo items updated"); } } catch (Exception ex) { throw ex; } }
public bool UpdateDependentTasks(IToDoItem toDoItem) { string sql = @" UPDATE ToDoItems SET parentid = @parentid WHERE id = @id"; // access the database and retrieve data using (IDbConnection conn = GetConnection()) { IDbCommand command = conn.CreateCommand(); command.CommandText = sql; Guid guid; IDbDataParameter parentid; if (Guid.TryParse(toDoItem.ParentId, out guid)) { parentid = new SqlParameter("@parentid", guid); } else { parentid = new SqlParameter("@parentid", DBNull.Value); } IDbDataParameter id = new SqlParameter("@id", toDoItem.Id); command.Parameters.Add(parentid); command.Parameters.Add(id); try { conn.Open(); int result = command.ExecuteNonQuery(); return(result > 0); } catch (Exception ex) { throw ex; } finally { conn.Close(); } } }
public bool Update(IToDoItem toDoItem) { string sql = @" UPDATE ToDoItems SET title = @title , description = @description , complete = @complete WHERE id = @id"; // access the database and retrieve data using (IDbConnection conn = GetConnection()) { IDbCommand command = conn.CreateCommand(); command.CommandText = sql; IDbDataParameter title = new SqlParameter("@title", toDoItem.Title); IDbDataParameter description = new SqlParameter("@description", toDoItem.Description); IDbDataParameter complete = new SqlParameter("@complete", toDoItem.Complete); IDbDataParameter id = new SqlParameter("@id", toDoItem.Id); command.Parameters.Add(title); command.Parameters.Add(description); command.Parameters.Add(complete); command.Parameters.Add(id); try { conn.Open(); int result = command.ExecuteNonQuery(); return(result > 0); } catch (Exception ex) { throw ex; } finally { conn.Close(); } } }
public string Insert(IToDoItem toDoItem) { string sql = "INSERT INTO ToDoItems (id, title, description, complete) OUTPUT INSERTED.id VALUES (NEWID(), @title, @description, 0)"; // access the database and retrieve data using (IDbConnection conn = GetConnection()) { IDbCommand command = conn.CreateCommand(); command.CommandText = sql; IDbDataParameter title = new SqlParameter("@title", toDoItem.Title); IDbDataParameter description = new SqlParameter("@description", toDoItem.Description); command.Parameters.Add(title); command.Parameters.Add(description); try { conn.Open(); object result = command.ExecuteScalar(); if (result != null) { return(result.ToString()); } else { throw new NoNullAllowedException("No ID returned when inserting a to do item"); } } catch (Exception ex) { throw ex; } finally { conn.Close(); } } }
public string Insert(IToDoItem toDoItem) { // ANDREI: the changed sql query string sql = "INSERT INTO ToDoItems (id, title, description, complete, parent_task_id) OUTPUT INSERTED.id VALUES (newid(), @title, @description, 0, null)"; // access the database and retrieve data using (IDbConnection conn = GetConnection()) { IDbCommand command = conn.CreateCommand(); command.CommandText = sql; IDbDataParameter title = new SqlParameter("@title", toDoItem.Title); IDbDataParameter description = new SqlParameter("@description", toDoItem.Description); command.Parameters.Add(title); command.Parameters.Add(description); try { conn.Open(); object result = command.ExecuteScalar(); if (result != null) return result.ToString(); else throw new NoNullAllowedException("No ID returned when inserting a to do item"); } catch (Exception ex) { throw ex; } finally { conn.Close(); } } }
public void CreateToDoItem(IToDoItem todo) { items.Add(todo); //SyncToDoItems(); }
public void UpdateToDoItem(IToDoItem todo) { using (StreamWriter writer = new StreamWriter("update.json")) { writer.WriteLine(JsonConvert.SerializeObject((ToDoItem)todo)); } string temp; using (StreamReader reader = new StreamReader("items.json")) { temp = reader.ReadToEnd(); } List<IToDoItem> items = JsonConvert.DeserializeObject<List<ToDoItem>>(temp).Select(item => (IToDoItem)item).ToList(); items[items.FindIndex(item => item.ToDoId == todo.ToDoId)] = todo; temp = JsonConvert.SerializeObject(items); using (StreamWriter writer = new StreamWriter("items.json", false)) { writer.WriteLine(temp); } ThreadPool.QueueUserWorkItem(UpdateToDoItemWork, todo); }
/// <summary> /// Initializes a new instance of the <see cref="ToDoItemController"/> class. /// </summary> /// <param name="itemService">The item service.</param> /// <param name="mapper">The mapper.</param> public ToDoItemController(IToDoItem itemService, IMapper mapper) { this._itemService = itemService; this._mapper = mapper; }
public void UpdateToDoItem(IToDoItem item) { var client = new ToDoProxyService.Service1Client(); var toDoItem = new ToDoProxyService.ToDoItem() { Name = item.Name, IsCompleted = item.IsCompleted, ToDoId = item.ToDoId, UserId = item.UserId }; client.UpdateToDoItem(toDoItem); }
public void UpdateToDoItem(IToDoItem todo) { DummyToDoManager.ToDoManager manager = new DummyToDoManager.ToDoManager(); try { if (checkDB == false) if (CheckDB(todo.UserId)) { checkDB = true; //обновить локальное хранилище //не подключается :( } if (update == true) manager.UpdateToDoItem(todo); update = false; } catch { update = false; checkDB = false; } }
public CreatePageViewModel(IToDoItem currentToDoItem, IToDoItemDatabase <ToDoItem> dataStore) : base() { mCurrentToDoItem = currentToDoItem; mDataStore = dataStore; }
public ToDosItemController(IToDoItem repository) { this.repository = repository; }
private ToDoItem GetRealItem(IToDoItem todo) { List<ToDoItem> realItems = toDoManagerClient.GetTodoList(currentUserId).ToList(); ToDoItem realItem = realItems.FirstOrDefault(x => x.IsCompleted == todo.IsCompleted && x.Name == todo.Name); return realItem; }
public bool Update(IToDoItem toDoItem) { string sql = @" UPDATE ToDoItems SET title = @title , description = @description , complete = @complete WHERE id = @id"; // access the database and retrieve data using (IDbConnection conn = GetConnection()) { IDbCommand command = conn.CreateCommand(); command.CommandText = sql; IDbDataParameter title = new SqlParameter("@title", toDoItem.Title); IDbDataParameter description = new SqlParameter("@description", toDoItem.Description); IDbDataParameter complete = new SqlParameter("@complete", toDoItem.Complete); IDbDataParameter id = new SqlParameter("@id", toDoItem.Id); command.Parameters.Add(title); command.Parameters.Add(description); command.Parameters.Add(complete); command.Parameters.Add(id); try { conn.Open(); int result = command.ExecuteNonQuery(); return (result > 0); } catch (Exception ex) { throw ex; } finally { conn.Close(); } } }
private void UpdateItemRemote(IToDoItem todo) { var currentWorkItem = new ToDoItemWorkItem { Item = todo.ToRemoteToDoItem(), WorkType = ToDoWorkType.Add }; workQueue.TryAdd(currentWorkItem, 1); SaveWorkQueue(); try { ToDoItem realItemToUpdate = GetRealItem(todo); if (realItemToUpdate != null) toDoManagerClient.UpdateToDoItem(realItemToUpdate); DeleteFromWorkQueue(currentWorkItem); } catch (Exception) { ; } }
private void AddItemRemote(IToDoItem todo) { var currentWorkItem = new ToDoItemWorkItem {Item = todo.ToRemoteToDoItem(), WorkType = ToDoWorkType.Add}; workQueue.TryAdd(currentWorkItem,1); SaveWorkQueue(); try { toDoManagerClient.CreateToDoItem(todo.ToRemoteToDoItem()); DeleteFromWorkQueue(currentWorkItem); } catch (Exception) { ; } }