public static DO_SIM GetSIM(int idSIM) { DO_SIM dO_SIM = new DO_SIM(); SO_Sim sO_Sim = new SO_Sim(); DataSet informacionBD = sO_Sim.GetSIM(idSIM); if (informacionBD != null) { if (informacionBD.Tables.Count > 0 && informacionBD.Tables[0].Rows.Count > 0) { foreach (DataRow item in informacionBD.Tables[0].Rows) { dO_SIM = new DO_SIM(); dO_SIM.ID_SIM = Convert.ToInt32(item["ID_SIMS"].ToString()); dO_SIM.SIM = item["SIM"].ToString(); dO_SIM.operador = GetGerente((int)item["ID_OPERADOR"]); if (!string.IsNullOrEmpty(item["ID_SIM_GERENTE"].ToString())) { dO_SIM.idSIMGerente = Convert.ToInt32(item["ID_SIM_GERENTE"].ToString()); dO_SIM.gerente = GetGerente((int)item["ID_GERENTE"]); dO_SIM.FechaSolicitud = Convert.ToDateTime(item["FECHA_SOLICITUD"].ToString()); dO_SIM.FechaEntrega = Convert.ToDateTime(item["FECHA_ENTREGA"].ToString()); } else { dO_SIM.idSIMGerente = 0; } } } } return(dO_SIM); }
public static List <DO_SIM> GetAllSIM(string fechaInicial, string fechaFinal) { SO_Sim sO_Sim = new SO_Sim(); List <DO_SIM> ListaResultante = new List <DO_SIM>(); DataSet informacionBD = sO_Sim.GetAll(fechaInicial, fechaFinal); if (informacionBD != null) { if (informacionBD.Tables.Count > 0 && informacionBD.Tables[0].Rows.Count > 0) { foreach (DataRow item in informacionBD.Tables[0].Rows) { DO_SIM dO_SIM = new DO_SIM(); dO_SIM.ID_SIM = Convert.ToInt32(item["ID_SIMS"].ToString()); dO_SIM.SIM = item["SIM"].ToString(); dO_SIM.operador = GetGerente((int)item["ID_OPERADOR"]); if (!string.IsNullOrEmpty(item["ID_SIM_GERENTE"].ToString())) { dO_SIM.gerente = GetGerente((int)item["ID_GERENTE"]); dO_SIM.FechaSolicitud = Convert.ToDateTime(item["FECHA_SOLICITUD"].ToString()); dO_SIM.FechaEntrega = Convert.ToDateTime(item["FECHA_ENTREGA"].ToString()); } ListaResultante.Add(dO_SIM); } } } return(ListaResultante); }
public ActionResult SaveChangeSIM([Bind(Include = "ID_SIM,FechaSolicitud,FechaEntrega,operadorSelected,gerenteSelected,idSIMGerente,SIM")] DO_SIM dO_SIM) { if (dO_SIM.idSIMGerente == 0) { DataManager.InsertSIMGerente(dO_SIM.FechaEntrega, dO_SIM.FechaSolicitud, dO_SIM.ID_SIM, Convert.ToInt32(dO_SIM.gerenteSelected)); } else { DataManager.UpdateSIMGerente(dO_SIM.FechaEntrega, dO_SIM.FechaSolicitud, dO_SIM.ID_SIM, Convert.ToInt32(dO_SIM.gerenteSelected), dO_SIM.idSIMGerente); } return(RedirectToAction("VerSIMS")); }
public ActionResult SaveSIM([Bind(Include = "SIM,operadorSelected")] DO_SIM dO_SIM) { DO_Gerente operador = DataManager.GetGerente(Convert.ToInt32(dO_SIM.operadorSelected)); DO_Gerente gerente = DataManager.GetGerente(Convert.ToInt32(dO_SIM.gerenteSelected)); dO_SIM.operador = operador; dO_SIM.gerente = gerente; DataManager.InsertSIM(dO_SIM); dO_SIM.SIM = "EL NUEVO"; return(RedirectToAction("AltaSIM2", new { idOperador = dO_SIM.operadorSelected, idGerente = dO_SIM.gerenteSelected, fechaSolicitud = dO_SIM.FechaSolicitud, fechaEntrega = dO_SIM.FechaEntrega })); }
public ActionResult AltaSIM2(string idOperador, string idGerente, string fechaSolicitud, string fechaEntrega) { ViewBag.Empleados = convert(DataManager.GetAllGerentes()); DO_SIM dO_SIM = new DO_SIM(); dO_SIM.SIM = ""; dO_SIM.gerenteSelected = idGerente; dO_SIM.operadorSelected = idOperador; dO_SIM.FechaSolicitud = Convert.ToDateTime(fechaSolicitud); dO_SIM.FechaEntrega = Convert.ToDateTime(fechaEntrega); return(View("AltaSIM", dO_SIM)); }
public ActionResult EditarSIM(int idSIM) { DO_SIM dO_SIM = DataManager.GetSIM(idSIM); List <SelectListItem> list = new List <SelectListItem>(); list = convert(DataManager.GetAllGerentes()); dO_SIM.operadorSelected = dO_SIM.operador.IdGerente.ToString(); if (dO_SIM.gerente is null) { dO_SIM.gerenteSelected = "0"; } else { dO_SIM.gerenteSelected = dO_SIM.gerente.IdGerente.ToString(); } ViewBag.Empleados = list; return(View(dO_SIM)); }
public static int InsertSIM(DO_SIM dO_SIM) { SO_Sim sO_Sim = new SO_Sim(); return(sO_Sim.Insert(dO_SIM.operador.IdGerente, dO_SIM.SIM)); }