public void addTask(MobileTask task, int currentPeopleID) { if (currentPeopleID == 0) { return; } if (task.delegatedID > 0 && task.delegatedID != currentPeopleID) { task.type = MobileTask.TYPE_DELEGATED; delegated.Add(task); return; } if (task.statusID == 10) { task.type = MobileTask.TYPE_ACTIVE; active.Add(task); } else { task.type = MobileTask.TYPE_PENDING; pending.Add(task); } }
public void addTask(MobileTask task, int currentPeopleID) { if (currentPeopleID == 0) return; if (task.delegatedID > 0 && task.delegatedID != currentPeopleID) { task.type = MobileTask.TYPE_DELEGATED; delegated.Add(task); return; } if (task.statusID == 10) { task.type = MobileTask.TYPE_ACTIVE; active.Add(task); } else { task.type = MobileTask.TYPE_PENDING; pending.Add(task); } }
public ActionResult TaskItem(int ID) { var authError = Authenticate(); if (authError != null) return authError; BaseReturn br = new BaseReturn(); MobileTask mt = new MobileTask(); var item = (from e in DbUtil.Db.Tasks where e.Id == ID select e).SingleOrDefault(); br.type = 102; if (item != null) { br.count = 1; mt.populate(item); br.data = JSONHelper.JsonSerializer<MobileTask>(mt); } else { br.error = 1; } return br; }
public ActionResult FetchTasks(string data) { var result = AuthenticateUser(); if (!result.IsValid) return AuthorizationError(result); BaseMessage dataIn = BaseMessage.createFromString(data); var tasks = from t in DbUtil.Db.ViewIncompleteTasks orderby t.CreatedOn, t.StatusId, t.OwnerId, t.CoOwnerId where t.OwnerId == Util.UserPeopleId || t.CoOwnerId == Util.UserPeopleId select t; var complete = (from c in DbUtil.Db.Tasks where c.StatusId == TaskStatusCode.Complete where c.OwnerId == Util.UserPeopleId || c.CoOwnerId == Util.UserPeopleId orderby c.CreatedOn descending select c).Take(20); BaseMessage br = new BaseMessage(); switch (dataIn.device) { case BaseMessage.API_DEVICE_ANDROID: { Dictionary<int, MobileTask> taskList = new Dictionary<int, MobileTask>(); foreach (var item in tasks) { MobileTask task = new MobileTask().populate(item, Util.UserPeopleId ?? 0); taskList.Add(task.id, task); } foreach (var item in complete) { MobileTask task = new MobileTask().populate(item, Util.UserPeopleId ?? 0); taskList.Add(task.id, task); } br.data = SerializeJSON(taskList, dataIn.version); break; } case BaseMessage.API_DEVICE_IOS: { List<MobileTask> taskList = new List<MobileTask>(); foreach (var item in tasks) { MobileTask task = new MobileTask().populate(item, Util.UserPeopleId ?? 0); taskList.Add(task); } foreach (var item in complete) { MobileTask task = new MobileTask().populate(item, Util.UserPeopleId ?? 0); taskList.Add(task); } br.data = SerializeJSON(taskList, dataIn.version); break; } } br.count = tasks.Count(); br.setNoError(); return br; }