protected void btn_guardar_ServerClick(object sender, EventArgs e) { try { if (FormAccion == "Agregar") { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Puesto obj = new WSGestion.MOD_Puesto(); obj.PUE_nombre = txt_nombre.Value; obj.PUE_descripcion = txt_descripcion.Value; obj.PUE_id_centro_atencion = Convert.ToInt32(txt_id_centro.Value.ToString()); wsgest.CRE_Puesto(obj); Response.Redirect("frm_Grid_Puesto.aspx"); } if (FormAccion == "Editar") { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Puesto obj = new WSGestion.MOD_Puesto(); obj.PUE_nombre = txt_nombre.Value; obj.PUE_descripcion = txt_descripcion.Value; obj.PUE_id_centro_atencion = Convert.ToInt32(txt_id_centro.Value.ToString()); obj.PUE_id_puesto = Convert.ToInt32(txt_codigo.Value.ToString()); wsgest.UPD_Puesto(obj); Response.Redirect("frm_Grid_Puesto.aspx"); } } catch (Exception exc) { Alert_Mensaje.Attributes["class"] = "alert alert-danger"; mensaje_alerta = exc.ToString(); titulo_mensaje_alerta = "Error: "; Alert_Mensaje.Visible = true; } }
private void Carga_Editar() { try { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Puesto obj = new WSGestion.MOD_Puesto(); obj = wsgest.SEL_GRID_BY_ID_Puesto(codigo_seleccionado); txt_nombre.Value = obj.PUE_nombre; txt_descripcion.Value = obj.PUE_descripcion; txt_id_centro.Value = obj.PUE_id_centro_atencion.ToString(); txt_codigo.Value = obj.PUE_id_puesto.ToString(); txt_nombre_cea.Value = obj.CEA_nombre; } catch (Exception exc) { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Codigo_Select"] = "0"; Alert_Mensaje.Attributes["class"] = "alert alert-danger"; mensaje_alerta = exc.ToString(); titulo_mensaje_alerta = "Error: "; Alert_Mensaje.Visible = true; } }