Exemple #1
0
        /********** CONSTRUCTOR **********/

        public TaskModel(DictModel dict, IReadOnlyList <UserModel> memberList)
        {
            Id          = dict.i("id");
            Title       = dict.s("title");
            Description = dict.s("description");
            ProjectId   = dict.i("project_id");

            foreach (var i in dict.l("members"))
            {
                DictModel d      = i.ToString();
                UserModel member = null;
                foreach (var m in memberList)
                {
                    if (m.Id == d.i("id"))
                    {
                        member = m;
                        break;
                    }
                }
                if (member != null)
                {
                    AddMember(member);
                }
            }
        }
Exemple #2
0
        private async Task AddMembers()
        {
            DictModel response = await OverlayForm(new TaskMemberForm (MasterFragment.projectContext, task));

            if (response != null)
            {
                UserModel member = null;
                foreach (var m in MasterFragment.projectContext.Members)
                {
                    if (m.Id == response.i("id"))
                    {
                        member = m;
                        break;
                    }
                }
                if (member != null)
                {
                    IsBusy = true;
                    try {
                        await App.AddUserToTask(MasterFragment.projectContext, task, member);

                        Refresh();
                    } catch (Exception ex) {
                        await DisplayAlert("Whoops", ex.Message, "OK");
                    }
                    IsBusy = false;
                }
            }
        }
Exemple #3
0
        public async Task <DictModel> CreateTask(DictModel taskDict)
        {
            DictModel dict = new DictModel("task");

            dict.Add("title", taskDict.s("title"));
            dict.Add("description", taskDict.s("description"));
            dict.Add("list", taskDict.s("list"));

            string uri = Globals.PROJECTS_URI + "/" + taskDict.i("project_id") + "/" + Globals.TASKS_URI;

            return(await MakeRequestAsync(uri, dict, RequestMethod.POST));
        }
Exemple #4
0
        public void UpdateWithJson(string json)
        {
            DictModel dict = json;

            Id    = dict.i("id");
            Email = dict.s("email");

            foreach (var p in dict.l("projects"))
            {
                AddProject(p.ToString());
            }
            UpdatePotentialProjects(dict);
        }
Exemple #5
0
        /********** CONSTRUCTOR **********/

        public ProjectModel(DictModel dict)
        {
            Id   = dict.i("id");
            Name = dict.s("name");

            foreach (var m in dict.l("members"))
            {
                AddMember(m.ToString());
            }
            foreach (var t in dict.l("tasks_todo"))
            {
                AddTask(t.ToString(), "todo");
            }
            foreach (var t in dict.l("tasks_doing"))
            {
                AddTask(t.ToString(), "doing");
            }
            foreach (var t in dict.l("tasks_done"))
            {
                AddTask(t.ToString(), "done");
            }
        }
Exemple #6
0
 public UserModel(DictModel dict)
 {
     Id    = dict.i("id");
     Email = dict.s("email");
 }