Exemplo n.º 1
0
        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_Forma_Pago obj = new WSGestion.MOD_Forma_Pago();

                    obj.FPA_descripcion = txt_nombre.Value;
                    obj.FPA_id_centro_atencion = Convert.ToInt32(txt_cea_codigo.Value);
                    obj.FPA_id_forma_pago = 0;

                    wsgest.CRE_Forma_Pago(obj);
                    Response.Redirect("frm_Grid_Forma_Pago.aspx");
                }

                if (FormAccion == "Editar")
                {
                    WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                    wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                    WSGestion.MOD_Forma_Pago obj = new WSGestion.MOD_Forma_Pago();

                    obj.FPA_descripcion = txt_nombre.Value;
                    obj.FPA_id_forma_pago = Convert.ToInt32(txt_codigo.Value.ToString());
                    obj.FPA_id_centro_atencion = Convert.ToInt32(centro);

                    wsgest.UPD_Forma_Pago(obj);
                    Response.Redirect("frm_Grid_Forma_Pago.aspx");
                }
            }

            catch (Exception exc)
            {
                Alert_Mensaje.Attributes["class"] = "alert alert-danger";
                mensaje_alerta = exc.ToString();
                titulo_mensaje_alerta = "Error: ";
                Alert_Mensaje.Visible = true;
            }
        }