public async Task <ActionResult <CatEstado> > PostCatEstado(CatEstado catEstado) { _context.CatEstados.Add(catEstado); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCatEstado", new { id = catEstado.IdEstado }, catEstado)); }
public async Task <IActionResult> PutCatEstado(int id, CatEstado catEstado) { if (id != catEstado.IdEstado) { return(BadRequest()); } _context.Entry(catEstado).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatEstadoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void ObtenerComboCatEstados(CatEstado Datos) { try { Catalogo_Datos cd = new Catalogo_Datos(); cd.ObtenerComboCatEstado(Datos); } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { DcGeneralDataContext dcGeneralDataContext = new DcGeneralDataContext(); if (Request.Cookies["activo"].Value != "1") { Response.Redirect("~/Login.aspx"); } try { //this.Response.Buffer = true; //this.session = (SessionManager)this.Session["SessionManagerLogin"]; //this.isLogin = this.session.Parametros["islogin"] != null ? //bool.Parse(this.session.Parametros["islogin"].ToString()) : false; DataContext dcTemp = new DcGeneralDataContext(); if (!this.IsPostBack) { List <CatEstado> listaEstado = dcTemp.GetTable <CatEstado>().ToList(); CatEstado catTemp = new CatEstado(); catTemp.id = -1; catTemp.strValor = "Todos"; listaEstado.Insert(0, catTemp); this.ddlStatua.DataTextField = "strValor"; this.ddlStatua.DataValueField = "id"; this.ddlStatua.DataSource = listaEstado; this.ddlStatua.DataBind(); List <UTTT.Ejemplo.Linq.Data.Entity.Persona> listaE = dcTemp.GetTable <UTTT.Ejemplo.Linq.Data.Entity.Persona> ().ToList(); UTTT.Ejemplo.Linq.Data.Entity.Persona catTempE = new UTTT.Ejemplo.Linq.Data.Entity.Persona(); catTempE.id = -1; catTempE.strNombre = "Todos"; listaE.Insert(0, catTempE); this.ddlPersona.DataTextField = "strNombre"; this.ddlPersona.DataValueField = "id"; this.ddlPersona.DataSource = listaE; this.ddlPersona.DataBind(); } } catch (Exception _e) { this.Response.Redirect("~/Error.aspx", false); per.correo("ERROR:" + _e.ToString()); } }
public void LlenarComboCatEstadoXIDPais(int IDPais) { try { CatEstado Estado = new CatEstado(); Estado.Conexion = Comun.Conexion; Estado.IDPais = IDPais; //Comun.IDPais = Estado.IDPais; Catalogo_Negocio Catalogos_negocio = new Catalogo_Negocio(); Catalogos_negocio.ObtenerComboCatEstados(Estado); this.cmbEstado.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.cmbEstado.AutoCompleteSource = AutoCompleteSource.ListItems; this.cmbEstado.DataSource = Estado.TablaDatos; this.cmbEstado.DisplayMember = "descripcion"; this.cmbEstado.ValueMember = "id_estado"; } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["activo"].Value != "1") { Response.Redirect("~/Login.aspx"); } try { this.Response.Buffer = true; this.session = (SessionManager)this.Session["SessionManager"]; this.idUser = this.session.Parametros["idUser"] != null? int.Parse(this.session.Parametros["idUser"].ToString()) : 0; if (this.idUser == 0) { this.txtPersona.Visible = false; this.baseEntity = new Linq.Data.Entity.Users(); this.tipoAccion = 1; } else { this.baseEntity = dcGlobal.GetTable <Linq.Data.Entity.Users>().First(c => c.id == this.idUser); this.tipoAccion = 2; } if (!this.IsPostBack) { if (this.session.Parametros["baseEntity"] == null) { this.session.Parametros.Add("baseEntity", this.baseEntity); } List <Linq.Data.Entity.Persona> listaPersona = dcGlobal.GetTable <Linq.Data.Entity.Persona>().ToList(); this.ddlPersona.DataTextField = "strNombre"; this.ddlPersona.DataValueField = "id"; this.ddlPersona.DataSource = listaPersona; this.ddlPersona.DataBind(); this.ddlPersona.SelectedIndexChanged += new EventHandler(ddlPersona_SelectedIndexChanged); List <CatEstado> listac = dcGlobal.GetTable <CatEstado>().ToList(); CatEstado catTempc = new CatEstado(); this.ddlEstado.DataTextField = "strValor"; this.ddlEstado.DataValueField = "id"; this.ddlEstado.DataSource = listac; this.ddlEstado.DataBind(); this.ddlEstado.SelectedIndexChanged += new EventHandler(ddlEstado_SelectedIndexChanged); if (this.idUser == 0) { this.lblAccion.Text = "Agregar"; this.ddlEstado.Visible = false; this.statuslbl.Visible = false; } else { this.txtPersona.Visible = true; this.txtPersona.Enabled = false; ddlPersona.Visible = false; this.lblAccion.Text = "Editar"; this.txt_fecha.Text = this.baseEntity.fecha.ToShortDateString(); this.txtNombre.Text = this.baseEntity.nombre; this.txtVContraseña.Text = desencriptar(this.baseEntity.contrasena.ToString()); this.txtContrasena.Text = desencriptar(this.baseEntity.contrasena.ToString()); this.txtPersona.Text = this.baseEntity.Persona.strNombre; this.setItem(ref this.ddlPersona, baseEntity.Persona.strNombre); this.setItem(ref this.ddlEstado, baseEntity.CatEstado.strValor); } } } catch (Exception _e) { correo("ERROR:" + _e.ToString()); this.Response.Redirect("~/Error.aspx", false); } }
public async Task <IActionResult> Detalle(String _ID, bool result, String mensaje) { if (string.IsNullOrEmpty(HttpContext.Session.GetString(SessionKeyNombre))) { return(RedirectToAction("Index", "Home")); } else { Solicitud solicitud = new Solicitud(); List <catDocumento> catDocumentos = new List <catDocumento>(); List <CatEstado> catEstados = new List <CatEstado>(); catEstados = CatEstado.fillEstados(); ViewBag.usuario = HttpContext.Session.GetString(SessionKeyNombre); string execeptionMsg; try { solicitud = await FireStore.GetSolicitudFromFireStore(_ID); if (solicitud.solicitudID != null) { if (solicitud.mesaControlID == null && solicitud.grupoID == null) { if (await FireStore.SetControlId(_ID, HttpContext.Session.GetString(SessionKeyId), HttpContext.Session.GetString(SessionKeyNombre), false)) { solicitud.mesaControlID = HttpContext.Session.GetString(SessionKeyId); } } else if (solicitud.mesaControlID == null && solicitud.grupoID != null) { if (await FireStore.SetControlId(_ID, HttpContext.Session.GetString(SessionKeyId), HttpContext.Session.GetString(SessionKeyNombre), false)) { solicitud.mesaControlID = HttpContext.Session.GetString(SessionKeyId); } else { if (await FireStore.SetRenovacionControlId(_ID, HttpContext.Session.GetString(SessionKeyId), HttpContext.Session.GetString(SessionKeyNombre), false)) { solicitud.mesaControlID = HttpContext.Session.GetString(SessionKeyId); } } } else if (solicitud.mesaControlID != HttpContext.Session.GetString(SessionKeyId) && solicitud.dictamen == null) { execeptionMsg = solicitud.mesaControlID == null ? "" : "Esta solicitud ya esta siendo atendida por " + solicitud.mesaControlUsuario + "."; throw new Exception(execeptionMsg); } catDocumentos = await FireStore.GetCatDocumentosFromFirestore(); if (solicitud.documentos.Find(x => x.solicitudCambio == true) != null && solicitud.status != 6) { await FireStore.CambioEstado(_ID, 6, null, 0, null); return(RedirectToAction("Detalle", new { _ID = _ID })); } ViewBag.solicitud = solicitud; ViewBag.catDocumentos = catDocumentos; ViewBag.catEstados = catEstados; ViewBag.estado = catEstados.Find(x => x.clave == solicitud.direccion.estado).estado; //mensaje notice ViewBag.result = result; ViewBag.mensaje = mensaje; ViewBag.liberable = solicitud.documentos.Where(doc => doc.version != 1).Count() > 0 ? false : true; } else { ViewBag.error = solicitud.grupoNombre;//Auxiliar para mostrar un mensaje de error } } catch (Exception ex) { ViewBag.error = "Error al obtener datos. \n" + ex.Message; Log.Information("*****Error Exception Detalle: {0}", ex.Message); } return(View()); } }