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."); }
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"); } } }
/** * 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(); } }
static void Main(string[] args) { var person = new Person(); person.Run(); var listTasks = new ListTasks(); listTasks.Run(); Console.ReadLine(); }
//[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)); }
/** * 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; }
/** * 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; } }
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); }
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); }
public ActionResult Recharging(ListTasks request) { request.CommandType = Task.GetCommandType(typeof(RechargingCommand)); ViewData["action"] = "Recharging"; return(List(request)); }
public ActionResult RefuseLimitAmount(int id, ListTasks request) { request.Reject <LimitAmountCommand, RefuseCommand>(id, LogTypes.RefuseLimitAmount); return(LimitAmount(request)); }
public ActionResult ApproveLimitAmount(int id, ListTasks request) { request.Approve <LimitAmountCommand>(id, LogTypes.ApproveLimitAmount); return(LimitAmount(request)); }
public ActionResult RefuseRecharging(int id, ListTasks request) { request.Reject <RechargingCommand, RefuseRechargeCommand>(id, LogTypes.RefuseRecharging); return(Recharging(request)); }
//[DashboardItem] public ActionResult LimitAmount(ListTasks request) { request.CommandType = Task.GetCommandType(typeof(LimitAmountCommand)); ViewData["action"] = "LimitAmount"; return(List(request)); }