/// <summary> /// Update the DONE Container /// </summary> /// <param name="Todo"></param> private void UpdateDoneItems(TodoVIewModel Done) { List <ActivityDetailVIewModel> SelectedDoneLists = Done.DoneItems.listTeamTwo.ToList(); foreach (var SelectedDoneitem in SelectedDoneLists) { var tempDoneTitle = SelectedDoneitem.TItle; var DoneListByActivitID = db.Activities.Where(p => p.title.Equals(tempDoneTitle)).Select(p => p.actId).FirstOrDefault(); var EarlyDoneStatus = db.Activities.Find(DoneListByActivitID); if (EarlyDoneStatus != null) { if (EarlyDoneStatus.status.Equals(const_Done)) { Debug.WriteLine("Already have this in Done Field"); } else if (!EarlyDoneStatus.status.Equals(const_Done)) { string Notification = "Todo item \"" + EarlyDoneStatus.title + "\" changed from " + EarlyDoneStatus.status + " to " + const_Done + " Container"; SaveTaskItems(EarlyDoneStatus.actId, 100, const_Done); var s = sendEmail(Notification, "", ""); } } } }
/// <summary> /// Update the TODO Container /// </summary> /// <param name="Done"></param> private void UpdateTodoItems(TodoVIewModel Todo) { List <ActivityDetailVIewModel> SelectedTodoLists = Todo.TodoItems.listbox.ToList(); foreach (var selectedTodo in SelectedTodoLists) { var temp = selectedTodo.TItle; var ActivitID = db.Activities.Where(p => p.title.Equals(temp)).Select(p => p.actId).FirstOrDefault(); var EarlyStatus = db.Activities.Find(ActivitID); if (EarlyStatus != null) { if (EarlyStatus.status.Equals(const_Todo)) { Debug.WriteLine("Already have this in Todo Field"); } else if (!EarlyStatus.status.Equals(const_Todo)) { string Notification = "Todo item \"" + EarlyStatus.title + "\" changed from " + EarlyStatus.status + " to " + const_Todo + " Container"; SaveNotification(Notification); SaveTaskItems(EarlyStatus.actId, 0, const_Todo); } } } }
/// <summary> /// Update the PROGRESS Container /// </summary> /// <param name="Progress"></param> private void UpdateProgressItems(TodoVIewModel Progress) { List <ActivityDetailVIewModel> SelectedProgressLists = Progress.ProgressItems.listTeamOne.ToList(); foreach (var selectedProgress in SelectedProgressLists) { var tempProgressTitle = selectedProgress.TItle; var ProgressListByActivitID = db.Activities.Where(p => p.title.Equals(tempProgressTitle)).Select(p => p.actId).FirstOrDefault(); var EarlyProgressStatus = db.Activities.Find(ProgressListByActivitID); if (EarlyProgressStatus != null) { if (EarlyProgressStatus.status.Equals(const_Progress)) { Debug.WriteLine("Already have this in Progress Field"); } else if (!EarlyProgressStatus.status.Equals(const_Progress)) { if (EarlyProgressStatus.status.Equals(const_Done)) { string Notification = "Todo item \"" + EarlyProgressStatus.title + "\" changed from " + EarlyProgressStatus.status + " to " + const_Progress + " Container"; SaveNotification(Notification); } SaveTaskItems(EarlyProgressStatus.actId, selectedProgress.completeness, const_Progress); } } } }
public SendSuccViewModel SaveTodo(TodoVIewModel todo) { SendSuccViewModel Message = new SendSuccViewModel(); if (ModelState.IsValid) { try { activityImpl.SaveAllTodoLists(todo); Message.SuccessMsg = "Succesfully Saved!"; } catch (Exception e) { Message.ErrorMsg = "Error Occurured while Saving!"; } } return(Message); }
/// <summary> /// Save all todo List /// </summary> /// <param name="todo"></param> /// <returns></returns> public void SaveAllTodoLists(TodoVIewModel todo) { UpdateDoneItems(todo); UpdateProgressItems(todo); UpdateTodoItems(todo); }