public ActionResult Create([Bind(Include = "Inspector,ConsecutivoBC,ConsecutivoPO,HandHeld,Copias,Piepagina,ClaveIns,ClaveAdmin,Serie,ConsecutivoSinDoc,estado,fecha_inicio,fecha_fin,ConsecutivoNumeroMarco,PasswordActualizado")] GENERALES gENERALES) { if (ModelState.IsValid) { db.GENERALES.Add(gENERALES); string mensaje = Verificar(gENERALES.Inspector); if (mensaje == "") { db.SaveChanges(); TempData["Type"] = "success"; TempData["Message"] = "El registro se realizó correctamente"; return(RedirectToAction("Index")); } else { ViewBag.Type = "warning"; ViewBag.Message = mensaje; IEnumerable <SelectListItem> itemsInspectores = db.INSPECTOR .Select(o => new SelectListItem { Value = o.Id.Trim(), Text = o.Nombre }); ViewBag.ComboInspectores = itemsInspectores; return(View(gENERALES)); } } return(View(gENERALES)); }
public ActionResult DeleteConfirmed(string id) { GENERALES gENERALES = db.GENERALES.Find(id); db.GENERALES.Remove(gENERALES); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Inspector,ConsecutivoBC,ConsecutivoPO,HandHeld,Copias,Piepagina,ClaveIns,ClaveAdmin,Serie,ConsecutivoSinDoc,estado,fecha_inicio,fecha_fin,ConsecutivoNumeroMarco,PasswordActualizado")] GENERALES gENERALES) { if (ModelState.IsValid) { db.Entry(gENERALES).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gENERALES)); }
public ActionResult InactivarConfirmed(string id) { GENERALES gENERALES = db.GENERALES.Find(id); if (gENERALES.estado == "I") { gENERALES.estado = "A"; } else { gENERALES.estado = "I"; } db.SaveChanges(); return(RedirectToAction("Index")); }
public void CARGARVALORESINICIALES() { DataTable PAISES = new DataTable("PAISES"); DataColumn COLUMNAS = PAISES.Columns.Add("IDPAIS", typeof(Int32)); COLUMNAS.AllowDBNull = false; COLUMNAS.Unique = true; PAISES.Columns.Add("NOMBRE", typeof(String)); DataRow nuevafila; nuevafila = PAISES.NewRow(); nuevafila["IDPAIS"] = 1; nuevafila["NOMBRE"] = "COLOMBIA"; PAISES.Rows.Add(nuevafila); cboPais.DataSource = PAISES; cboPais.DataTextField = "NOMBRE"; cboPais.DataValueField = "NOMBRE"; cboPais.DataBind(); DataTable GENEROS = new DataTable("GENEROS"); DataColumn COLUMNASGENEROS = GENEROS.Columns.Add("IDGENERO", typeof(Int32)); COLUMNASGENEROS.AllowDBNull = false; COLUMNASGENEROS.Unique = true; GENEROS.Columns.Add("NOMBRE", typeof(String)); DataRow nuevafilaGENEROS; nuevafilaGENEROS = GENEROS.NewRow(); nuevafilaGENEROS["IDGENERO"] = 1; nuevafilaGENEROS["NOMBRE"] = "HOMBRE"; GENEROS.Rows.Add(nuevafilaGENEROS); nuevafilaGENEROS = GENEROS.NewRow(); nuevafilaGENEROS["IDGENERO"] = 2; nuevafilaGENEROS["NOMBRE"] = "MUJER"; GENEROS.Rows.Add(nuevafilaGENEROS); cboGenero.DataSource = GENEROS; cboGenero.DataTextField = "NOMBRE"; cboGenero.DataValueField = "NOMBRE"; cboGenero.DataBind(); DataTable TIPOSIDEN = new DataTable("TIPOSIDEN"); DataColumn COLUMNASTIPOSIDEN = TIPOSIDEN.Columns.Add("IDTIPOSIDEN", typeof(Int32)); COLUMNASTIPOSIDEN.AllowDBNull = false; COLUMNASTIPOSIDEN.Unique = true; TIPOSIDEN.Columns.Add("NOMBRE", typeof(String)); DataRow nuevafilaTIPOSIDEN; nuevafilaTIPOSIDEN = TIPOSIDEN.NewRow(); nuevafilaTIPOSIDEN["IDTIPOSIDEN"] = 1; nuevafilaTIPOSIDEN["NOMBRE"] = "CEDULA DE CIUDADANIA"; TIPOSIDEN.Rows.Add(nuevafilaTIPOSIDEN); nuevafilaTIPOSIDEN = TIPOSIDEN.NewRow(); nuevafilaTIPOSIDEN["IDTIPOSIDEN"] = 2; nuevafilaTIPOSIDEN["NOMBRE"] = "TARJETA DE IDENTIDAD"; TIPOSIDEN.Rows.Add(nuevafilaTIPOSIDEN); cbo_tipoId.DataSource = TIPOSIDEN; cbo_tipoId.DataTextField = "NOMBRE"; cbo_tipoId.DataValueField = "NOMBRE"; cbo_tipoId.DataBind(); cboDepto.DataSource = GENERALES.DEPARTAMENTOSObtener(0); cboDepto.DataTextField = "NOMBRE"; cboDepto.DataValueField = "NOMBRE"; cboDepto.DataBind(); cboCiudad.DataSource = GENERALES.MUNICIPIOSObtenerbyID_DEPTO(1, 0); cboCiudad.DataTextField = "NOMBRE"; cboCiudad.DataValueField = "NOMBRE"; cboCiudad.DataBind(); CARGARGRILLA3(); }