Exemplo n.º 1
0
    public async Task <bool> DeleteTask(Guid taskId)
    {
        var taskEditor = new TaskEditorComponent(Store);

        taskEditor.AutoDBSave = false;  // don't save automatically

        var res = await taskEditor.DeleteModel(Service, taskId);

        if (res)
        {
            NoteTaskDto tskDel = null;
            foreach (var item in Model.Tasks)
            {
                if (item.NoteTaskId == taskId)
                {
                    tskDel = item;
                    break;
                }
            }

            if (tskDel != null)
            {
                if (tskDel.IsNew())
                {
                    Model.Tasks.Remove(tskDel);
                }
                else
                {
                    tskDel.SetIsDeleted(true);
                }
            }
        }

        return(res);
    }
Exemplo n.º 2
0
    public async Task <NoteTaskDto> NewTask()
    {
        var taskEditor = new TaskEditorComponent(Store);

        taskEditor.AutoDBSave = false;  // don't save automatically

        await taskEditor.NewModel(Service);

        taskEditor.Model.NoteId = Model.NoteId;
        var userDto = (await Service.Users.GetByUserNameAsync(Store.AppUserName)).Entity;

        taskEditor.Model.UserId       = userDto.UserId;
        taskEditor.Model.UserFullName = userDto.FullName;
        taskEditor.Model.Description  = "(Task descripcion ...)";
        taskEditor.Model.StartDate    = DateTime.Now;
        taskEditor.Model.SetIsNew(true);

        var res = taskEditor.RunModal();

        if (res.Entity == EComponentResult.Executed)
        {
            Model.Tasks.Add(taskEditor.Model);
            return(taskEditor.Model);
        }
        else
        {
            return(null);
        }
    }
Exemplo n.º 3
0
    public NoteTaskDto EditTask(Guid taskId)
    {
        var taskEditor = new TaskEditorComponent(Store);

        taskEditor.AutoDBSave = false;  // don't save automatically

        var task = Model.Tasks.Where(_ => _.NoteTaskId == taskId).SingleOrDefault();

        taskEditor.LoadModel(Service, task, false);

        var res = taskEditor.RunModal();

        if (res.Entity == EComponentResult.Executed)
        {
            return(taskEditor.Model);
        }
        else
        {
            return(null);
        }
    }
Exemplo n.º 4
0
 public IEditorView <NoteTaskDto> View(TaskEditorComponent component)
 {
     return(new TaskEditorForm(component));
 }
Exemplo n.º 5
0
 public TaskEditorForm(TaskEditorComponent com)
 {
     InitializeComponent();
     _com = com;
 }