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_Categoria_Articulo obj = new WSGestion.MOD_Categoria_Articulo(); obj.CAT_descripcion = txt_nombre.Value; obj.CAT_id_centro_atencion = Convert.ToInt32(txt_cea_codigo.Value); obj.CAT_id_categoria_articulo= Convert.ToInt32(txt_codigo.Value); wsgest.CRE_Categoria_Articulo(obj); Response.Redirect("frm_Grid_Categoria_Articulo.aspx"); } if (FormAccion == "Editar") { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Categoria_Articulo obj = new WSGestion.MOD_Categoria_Articulo(); obj.CAT_descripcion = txt_nombre.Value; obj.CAT_id_centro_atencion = Convert.ToInt32(txt_cea_codigo.Value); obj.CAT_id_categoria_articulo = Convert.ToInt32(txt_codigo.Value); wsgest.UPD_Categoria_Articulo(obj); Response.Redirect("frm_Grid_Categoria_Articulo.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_Categoria_Articulo obj = new WSGestion.MOD_Categoria_Articulo(); obj = wsgest.SEL_GRID_BY_ID_Categoria_Articulo(codigo_seleccionado, centro_seleccionado); txt_nombre.Value = obj.CAT_descripcion; txt_codigo.Value = obj.CAT_id_categoria_articulo.ToString(); txt_cea_codigo.Value = obj.CAT_id_centro_atencion.ToString(); txt_cea_nombre.Value = obj.CEA_nombre; txt_codigo.Disabled = true; } 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; } }