public async Task AddTask(TaskModel model)
        {
            ListTasks.Add(model);
            TasksUpdated?.Invoke(this, null);

            var newModel = new TaskVm();

            newModel.Id           = model.Id;
            newModel.AssignedToId = model.Member;
            newModel.IsComplete   = model.IsDone;
            newModel.Subject      = model.Text;

            var result = await Create(newModel.ToCreateTaskCommand());

            if (result != null)
            {
                var updatedList = (await GetAllTasks()).Payload;

                if (updatedList != null)
                {
                    tasks = updatedList;
                    TasksChanged?.Invoke(this, null);
                    return;
                }
                UpdateTaskFailed?.Invoke(this, "The creation was successful, but we can no longer get an updated list of members from the server.");
            }

            UpdateTaskFailed?.Invoke(this, "Unable to create record.");
        }
Пример #2
0
        private async void ValidateDelete(object sender)
        {
            MessageDialog showDialog = new MessageDialog("Etes vous sur de vouloir supprimer cette tache : " + SelectedTask.title + " ?");

            showDialog.Commands.Add(new UICommand("Oui")
            {
                Id = 0
            });
            showDialog.Commands.Add(new UICommand("Non")
            {
                Id = 1
            });
            showDialog.DefaultCommandIndex = 0;
            showDialog.CancelCommandIndex  = 1;
            var result = await showDialog.ShowAsync();

            if ((int)result.Id == 0)
            {
                if (SelectedTask != null)
                {
                    ListTasks.Remove(SelectedTask);
                    NotifyPropertyChanged("ListTasks");
                }
            }
        }
Пример #3
0
        /**
         * Fonction qui permet de supprimer une tâche de la liste
         **/

        private async void delSomething(object parameter)
        {
            if (SelectedModel != null)
            {
                MessageDialog showDialog = new MessageDialog("Etês-vous certain de vouloir supprimer cette tâche : " + SelectedModel.title + " ?");
                showDialog.Commands.Add(new UICommand("Oui")
                {
                    Id = 0
                });
                showDialog.Commands.Add(new UICommand("Non")
                {
                    Id = 1
                });
                showDialog.DefaultCommandIndex = 0;
                showDialog.CancelCommandIndex  = 1;
                var result = await showDialog.ShowAsync();

                if ((int)result.Id == 0)
                {
                    if (SelectedModel != null)
                    {
                        ListTasks.Remove(SelectedModel);
                        NotifyPropertyChanged("ListTasks");
                    }
                }
            }
            else
            {
                MessageDialog showDialog = new MessageDialog("Pas de tâche à supprimer.");
                var           result     = await showDialog.ShowAsync();
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            var person = new Person();

            person.Run();
            var listTasks = new ListTasks();

            listTasks.Run();
            Console.ReadLine();
        }
Пример #5
0
        //[DashboardItem]
        ActionResult List(ListTasks request)
        {
            if (ModelState.IsValid)
            {
                ModelState.Clear();

                request.Query();
            }
            return(View("List", request));
        }
        public ActionResult Search()
        {
            ListTasks model = new ListTasks();

            model.Tasks    = repo.GetAll <Tasks>().ToList();
            model.Status   = repo.GetAll <TaskStatus>().ToList();
            model.TaskType = repo.GetAll <TaskType>().ToList();
            model.Users    = repo.GetAll <User>().ToList();

            return(View(model));
        }
Пример #7
0
 /**
  * Fonction qui crée une nouvelle tâche avec les paramètre rentré dans le formulaire
  *
  **/
 public void addSomething(object parameter)
 {
     if (NewTask.title == null || NewTask.content == null)
     {
         dialogErrorAdd();
     }
     else
     {
         ListTasks.Add(NewTask);
         NotifyPropertyChanged("ListTasks");
         NewTask = new Model.Tasks();
     }
 }
        public ActionResult Search(string searchText)
        {
            ListTasks model = new ListTasks();

            //List of searched Tasks with the required text
            model.Tasks = repo.Search <Tasks>(searchText).ToList();

            model.Status     = repo.GetAll <TaskStatus>().ToList();
            model.TaskType   = repo.GetAll <TaskType>().ToList();
            model.Users      = repo.GetAll <User>().ToList();
            model.searchText = searchText;

            return(View(model));
        }
 public async void LoadTasks()
 {
     tasks = (await GetAllTasks()).Payload;
     //ListTasks = (List<TaskModel>)(await GetAllTasks()).Payload;
     foreach (var itm in tasks)
     {
         var data = new TaskModel();
         data.Id     = itm.Id;
         data.IsDone = itm.IsComplete;
         data.Member = itm.AssignedToId;
         data.Text   = itm.Subject;
         ListTasks.Add(data);
     }
     TasksChanged?.Invoke(this, null);
     return;
 }
Пример #10
0
        /**
         * Fonction qui permet d'éditer une tâche de la liste
         **/

        public void EditTask(object parameter)
        {
            if (NewTask.title == "" || NewTask.title == null || NewTask.content == "" || NewTask.content == null)
            {
                dialogErrorAdd();
            }
            else
            {
                ListTasks.Add(NewTask);
                ListTasks.Remove(SelectedModel);
                NotifyPropertyChanged("ListTasks");
                NewTask        = new Model.Tasks();
                NewTaskTitle   = null;
                NewTaskContent = null;
                NewTaskDate    = DateTime.Today;
            }
        }
Пример #11
0
 public ActionResult ApproveRecharging(int id, ListTasks request)
 {
     request.Approve <RechargingCommand>(id, LogTypes.ApproveRecharging);
     return(Recharging(request));
 }
 public void SelectTask(Guid id)
 {
     SelectedTask = ListTasks.SingleOrDefault(t => t.Id == id);
     TasksUpdated?.Invoke(this, null);
 }
Пример #13
0
        public ActionResult <ListTasksResponse> Post(ListTasks request)
        {
            ListTasksResponse ret = new ListTasksResponse();
            GXSelectArgs      arg = GXSelectArgs.SelectAll <GXTask>();

            arg.Count      = (UInt32)request.Count;
            arg.Descending = true;
            if (request.AttributeId != 0)
            {
                arg.Columns.Add <GXDevice>();
                arg.Columns.Add <GXObject>();
                arg.Columns.Add <GXAttribute>();
                arg.Joins.AddInnerJoin <GXTask, GXObject>(a => a.Object, b => b.Id);
                arg.Joins.AddInnerJoin <GXObject, GXDevice>(a => a.DeviceId, b => b.Id);
                arg.Joins.AddInnerJoin <GXObject, GXAttribute>(a => a.Id, b => b.ObjectId);
                arg.Where.And <GXAttribute>(q => q.Id == request.AttributeId);
            }
            else if (request.ObjectId != 0)
            {
                arg.Columns.Add <GXDevice>();
                arg.Columns.Add <GXObject>();
                arg.Columns.Add <GXAttribute>();
                arg.Joins.AddInnerJoin <GXTask, GXObject>(a => a.Object, b => b.Id);
                arg.Joins.AddInnerJoin <GXObject, GXDevice>(a => a.DeviceId, b => b.Id);
                arg.Where.And <GXObject>(q => q.Id == request.ObjectId);
            }
            else if (request.DeviceId != 0)
            {
                arg.Columns.Add <GXDevice>();
                arg.Columns.Add <GXObject>();
                arg.Columns.Add <GXAttribute>();
                arg.Joins.AddInnerJoin <GXTask, GXObject>(a => a.Object, b => b.Id);
                arg.Joins.AddInnerJoin <GXObject, GXDevice>(a => a.DeviceId, b => b.Id);
                arg.Joins.AddInnerJoin <GXObject, GXAttribute>(a => a.Id, b => b.ObjectId);
                arg.Where.And <GXObject>(q => q.DeviceId == request.DeviceId);
            }
            else if ((request.Targets & TargetType.Attribute) != 0)
            {
                arg.Columns.Add <GXDevice>();
                arg.Columns.Add <GXObject>();
                arg.Columns.Add <GXAttribute>();
                arg.Joins.AddInnerJoin <GXTask, GXObject>(a => a.Object, b => b.Id);
                arg.Joins.AddInnerJoin <GXObject, GXDevice>(a => a.DeviceId, b => b.Id);
                arg.Joins.AddInnerJoin <GXObject, GXAttribute>(a => a.Id, b => b.ObjectId);
            }
            else if ((request.Targets & TargetType.Object) != 0)
            {
                arg.Columns.Add <GXDevice>();
                arg.Columns.Add <GXObject>();
                arg.Joins.AddInnerJoin <GXTask, GXObject>(a => a.Object.Id, b => b.Id);
                arg.Joins.AddInnerJoin <GXObject, GXDevice>(a => a.DeviceId, b => b.Id);
            }
            else if ((request.Targets & TargetType.Device) != 0)
            {
                arg.Columns.Add <GXDevice>();
                arg.Joins.AddInnerJoin <GXTask, GXObject>(a => a.Object.Id, b => b.Id);
                arg.Joins.AddInnerJoin <GXObject, GXDevice>(a => a.DeviceId, b => b.Id);
            }
            arg.OrderBy.Add <GXTask>(q => q.Id);
            ret.Tasks = host.Connection.Select <GXTask>(arg).ToArray();
            return(ret);
        }
Пример #14
0
 public ActionResult Recharging(ListTasks request)
 {
     request.CommandType = Task.GetCommandType(typeof(RechargingCommand));
     ViewData["action"]  = "Recharging";
     return(List(request));
 }
Пример #15
0
 public ActionResult RefuseLimitAmount(int id, ListTasks request)
 {
     request.Reject <LimitAmountCommand, RefuseCommand>(id, LogTypes.RefuseLimitAmount);
     return(LimitAmount(request));
 }
Пример #16
0
 public ActionResult ApproveLimitAmount(int id, ListTasks request)
 {
     request.Approve <LimitAmountCommand>(id, LogTypes.ApproveLimitAmount);
     return(LimitAmount(request));
 }
Пример #17
0
 public ActionResult RefuseRecharging(int id, ListTasks request)
 {
     request.Reject <RechargingCommand, RefuseRechargeCommand>(id, LogTypes.RefuseRecharging);
     return(Recharging(request));
 }
Пример #18
0
 //[DashboardItem]
 public ActionResult LimitAmount(ListTasks request)
 {
     request.CommandType = Task.GetCommandType(typeof(LimitAmountCommand));
     ViewData["action"]  = "LimitAmount";
     return(List(request));
 }