static void CreateDetail(int time, int recurso, int tarea) { var ctx = new TareasDbContext(); ctx.Set <Detalle>().Add(new Detalle { Fecha = DateTime.Now, Tiempo = time, RecursoId = recurso, TareaId = tarea }); ctx.SaveChanges(); }
public static void InsertDetail(DateTime date, int time, Resource resource, Task task) { var ctx = new TareasDbContext(); ctx.Details.Add(new Detail { Date = date, Time = time, ResourceId = resource.Id, TaskId = task.Id }); ctx.SaveChanges(); }
static void UpdateTaskResource(int id, int resp) { var ctx = new TareasDbContext(); var tarea = ctx.Tareas.Where(i => i.Id == id).FirstOrDefault(); if (tarea is null) { Console.WriteLine("La tarea no existe"); } else { tarea.RecursoId = resp; } ctx.SaveChanges(); }
static void UpdateTaskStatus(int id, string sta) { var ctx = new TareasDbContext(); var tarea = ctx.Tareas.Where(i => i.Id == id).FirstOrDefault(); if (tarea is null) { Console.WriteLine("La tarea no existe"); } else { tarea.Estado = sta; } ctx.SaveChanges(); }
static void CreateTask(string titulo, string vencimiento, int estimacion, int responsable, string estado = null) { var ctx = new TareasDbContext(); ctx.Set <Tarea>().Add(new Tarea { Titulo = titulo, Vencimiento = DateTime.Parse(vencimiento), Estimacion = estimacion, RecursoId = responsable, Estado = estado }); ctx.SaveChanges(); }
public static void UpdateDetailsId(int id, DateTime date, int time, Resource resource, Task task) { var ctx = new TareasDbContext(); var detail = ctx.Details.Where(i => i.Id == id).FirstOrDefault(); if (detail != null) { detail.Date = date; detail.Time = time; detail.ResourceId = resource.Id; detail.TaskId = task.Id; } ctx.SaveChanges(); }
public static void InsertTask(string title, DateTime expiration, int estimate, string state, Resource liable) { var ctx = new TareasDbContext(); ctx.Tasks.Add(new Task { Title = title, Expiration = expiration, Estimate = estimate, State = state, ResourceId = liable.Id }); ctx.SaveChanges(); }
public static void Delete(int Id) { var ctx = new TareasDbContext(); var user = ctx.Users.Where(i => i.Id == Id).FirstOrDefault(); if (user != null) { ctx.Users.Remove(user); Console.WriteLine($"Se removio el usuario con exito"); ctx.SaveChanges(); } else { Console.WriteLine($"Usuario Inexistente. "); } }
public static void UpdateTaskId(int id, string title, DateTime expiration, int estimate, string state, Resource liable) { var ctx = new TareasDbContext(); var task = ctx.Tasks.Where(i => i.Id == id).FirstOrDefault(); if (task != null) { task.Title = title; task.Expiration = expiration; task.Estimate = estimate; task.State = state; task.ResourceId = liable.Id; } ctx.SaveChanges(); }
static void ResetPasswordUser(int id, string pass = null) { var ctx = new TareasDbContext(); var usuario = ctx.Usuarios.Where(i => i.UsuarioPK == id).FirstOrDefault(); if (usuario is null) { Console.WriteLine("El usuario no existe"); } else { if (!string.IsNullOrEmpty(pass)) { usuario.Clave = pass; } } ctx.SaveChanges(); }
static void UpdateDetailTask(int id, int taskId) { var ctx = new TareasDbContext(); var detalle = ctx.Detalles.Where(i => i.Id == id).FirstOrDefault(); if (detalle is null) { Console.WriteLine("El detalle no existe"); } else { detalle.Fecha = DateTime.Now; if (taskId > 0) { detalle.TareaId = taskId; } } ctx.SaveChanges(); }
static void UpdateTaskTime(int id, string venc, int est = -1) { var ctx = new TareasDbContext(); var tarea = ctx.Tareas.Where(i => i.Id == id).FirstOrDefault(); if (tarea is null) { Console.WriteLine("La tarea no existe"); } else { tarea.Vencimiento = DateTime.Parse(venc); if (est > 0) { tarea.Estimacion = est; } } ctx.SaveChanges(); }
static void UpdateResource(int id, string name, int user = -1) { var ctx = new TareasDbContext(); var recurso = ctx.Recursos.Where(i => i.Id == id).FirstOrDefault(); if (recurso is null) { Console.WriteLine("El recurso no existe"); } else { if (!string.IsNullOrEmpty(name)) { recurso.Nombre = name; } if (user > 0) { recurso.UsuarioId = user; } } ctx.SaveChanges(); }