public ActionResult Graficas1() { bd_inde2Context dc = new bd_inde2Context(); ViewData["CodTransformador"] = new SelectList(dc.Transformador, "CodTransformador", "Transformador1"); return(View()); }
public ActionResult Graficas() { bd_inde2Context dc = new bd_inde2Context(); // ViewData["CodTransformador"] = new SelectList(dc.Transformador, "CodTransformador", "Transformador1"); var lista = dc.Transformador.Select(p => p.Transformador1).ToList(); return(View()); }
public ActionResult Login(Usuario login, string ReturnUrl = "") { using (bd_inde2Context dc = new bd_inde2Context()) { ClaimsIdentity identity = null; bool isAuthenticated = false; // var ad = dc.TbUsuario.FirstOrDefault(); var c = dc.Usuario.Where(w => w.Email == login.Email).FirstOrDefault(); if (c != null) { var d = dc.Usuario.Where(w => w.Contrasenia == login.Contrasenia).FirstOrDefault(); if (d != null) { var pers = dc.Usuariosxrol.Where(p => p.CodUsuario == c.CodUsuario).FirstOrDefault(); var rols = dc.Rol.Where(r => r.CodRol == pers.CodRol).FirstOrDefault(); identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, c.Email), new Claim(ClaimTypes.Role, rols.Rol1) }, CookieAuthenticationDefaults.AuthenticationScheme); isAuthenticated = true; if (isAuthenticated) { var principal = new ClaimsPrincipal(identity); var loginA = HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal); return(RedirectToAction("Index", "Home")); } } else { RedirectToAction("Login"); } } else { RedirectToAction("Login"); } } return(View()); }
public ControlParametroUnidadsController(bd_inde2Context context) { _context = context; }
public UsuariosxrolsController(bd_inde2Context context) { _context = context; }
public UnidadGeneradorasController(bd_inde2Context context) { _context = context; }
public DatoTransformadorsController(bd_inde2Context context) { _context = context; }
public ActionResult GetVent(miFormulario miFormulario) { bd_inde2Context dc = new bd_inde2Context(); var query = dc.DatoTransformador.Include("CodTransformadorNavigation") .GroupBy(p => p.CodTransformadorNavigation.Transformador1) .Select(g => new { name = g.Key, count = g.Sum(w => w.PotenciaMw) }).ToList(); if (miFormulario.fechaInicial.Equals(miFormulario.fechaFinal)) { Debug.WriteLine("esta es la hora +++++++++++++++++"); Debug.WriteLine(miFormulario.horaInicial); var c = miFormulario.horaInicial.ToString(); var d = miFormulario.horaFinal.ToString(); if (!c.Equals("00:00:00") && !d.Equals("00:00:00")) { var query2 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso == Convert.ToDateTime(miFormulario.fechaInicial)) .Where(g => g.CodHoraNavigation.Hora >= miFormulario.horaInicial) .Where(g => g.CodHoraNavigation.Hora <= miFormulario.horaFinal) .Select(g => g.VentIMA.ToString()).ToList(); var query3 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso == Convert.ToDateTime(miFormulario.fechaInicial)) .Where(g => g.CodHoraNavigation.Hora >= miFormulario.horaInicial) .Where(g => g.CodHoraNavigation.Hora <= miFormulario.horaFinal) .Select(g => g.CodHoraNavigation.Hora.ToString()).ToList(); List <List <String> > myList = new List <List <String> >(); myList.Add(query2); myList.Add(query3); return(Json(myList)); } else if (c.Equals("00:00:00") && d.Equals("00:00:00")) { var query2 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso == Convert.ToDateTime(miFormulario.fechaInicial)) .Select(g => g.VentIMA.ToString()).ToList(); var query3 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso == Convert.ToDateTime(miFormulario.fechaInicial)) .Select(g => g.CodHoraNavigation.Hora.ToString()).ToList(); List <List <String> > myList = new List <List <String> >(); myList.Add(query2); myList.Add(query3); return(Json(myList)); } else if (!c.Equals("00:00:00") && d.Equals("00:00:00")) { var query2 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso == Convert.ToDateTime(miFormulario.fechaInicial)) .Where(g => g.CodHoraNavigation.Hora >= miFormulario.horaInicial) .Select(g => g.VentIMA.ToString()).ToList(); var query3 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso == Convert.ToDateTime(miFormulario.fechaInicial)) .Where(g => g.CodHoraNavigation.Hora >= miFormulario.horaInicial) .Select(g => g.CodHoraNavigation.Hora.ToString()).ToList(); List <List <String> > myList = new List <List <String> >(); myList.Add(query2); myList.Add(query3); return(Json(myList)); } else if (c.Equals("00:00:00") && !d.Equals("00:00:00")) { var query2 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso == Convert.ToDateTime(miFormulario.fechaInicial)) .Where(g => g.CodHoraNavigation.Hora <= miFormulario.horaFinal) .Select(g => g.VentIMA.ToString()).ToList(); var query3 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso == Convert.ToDateTime(miFormulario.fechaInicial)) .Where(g => g.CodHoraNavigation.Hora <= miFormulario.horaFinal) .Select(g => g.CodHoraNavigation.Hora.ToString()).ToList(); List <List <String> > myList = new List <List <String> >(); myList.Add(query2); myList.Add(query3); return(Json(myList)); } } else { var c = miFormulario.horaInicial.Hours; var d = miFormulario.horaFinal.Hours; var e = miFormulario.horaInicial.ToString(); var f = miFormulario.horaFinal.ToString(); double r = (d - c) + 1; double m = 1 / r; double k = 24; double s = 1 / k; if (!e.Equals("00:00:00") && !f.Equals("00:00:00")) { var query4 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso >= Convert.ToDateTime(miFormulario.fechaInicial)) .Where(p => p.FecIngreso <= Convert.ToDateTime(miFormulario.fechaFinal)) .Where(g => g.CodHoraNavigation.Hora >= miFormulario.horaInicial) .Where(g => g.CodHoraNavigation.Hora <= miFormulario.horaFinal) .GroupBy(p => p.FecIngreso).Select(g => g.Sum(w => w.VentIMA * m).ToString()).ToList(); var query5 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso >= Convert.ToDateTime(miFormulario.fechaInicial)) .Where(p => p.FecIngreso <= Convert.ToDateTime(miFormulario.fechaFinal)) .GroupBy(p => p.FecIngreso).Select(g => g.Key.ToString()).ToList(); List <List <String> > myList = new List <List <String> >(); myList.Add(query4); myList.Add(query5); return(Json(myList)); } else if (e.Equals("00:00:00") && f.Equals("00:00:00")) { var query4 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso >= Convert.ToDateTime(miFormulario.fechaInicial)) .Where(p => p.FecIngreso <= Convert.ToDateTime(miFormulario.fechaFinal)) .GroupBy(p => p.FecIngreso).Select(g => g.Sum(w => w.VentIMA * 0.25).ToString()).ToList(); var query5 = dc.DatoTransformador.Include("CodTransformadorNavigation").Where(p => p.CodTransformadorNavigation.Transformador1 == miFormulario.transformador) .Where(p => p.FecIngreso >= Convert.ToDateTime(miFormulario.fechaInicial)) .Where(p => p.FecIngreso <= Convert.ToDateTime(miFormulario.fechaFinal)) .GroupBy(p => p.FecIngreso).Select(g => g.Key.ToString()).ToList(); List <List <String> > myList = new List <List <String> >(); myList.Add(query4); myList.Add(query5); return(Json(myList)); } } return(View()); }
public ControlGeneralPtqUnidadsController(bd_inde2Context context) { _context = context; }
public ControlGeneracionDiariasController(bd_inde2Context context) { _context = context; }