예제 #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_Dueno obj = new WSGestion.MOD_Dueno();

                    obj.DUE_nombre = txt_nombre.Value;
                    obj.DUE_telefono = txt_telefono.Value;
                    obj.DUE_pais = txt_pais.Value;
                    obj.DUE_celular = txt_celular.Value;
                    obj.DUE_apellido1 = txt_apellido1.Value;
                    obj.DUE_apellido2 = txt_apellido2.Value;
                    obj.DUE_codigo_postal = txt_codigo_postal.Value;
                    obj.DUE_email = txt_email.Value;
                    obj.DUE_cuidad = txt_cuidad.Value;

                    wsgest.CRE_Dueno(obj);
                    Response.Redirect("frm_Grid_Dueno.aspx");
                }

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

                    obj.DUE_nombre = txt_nombre.Value;
                    obj.DUE_telefono = txt_telefono.Value;
                    obj.DUE_pais = txt_pais.Value;
                    obj.DUE_celular = txt_celular.Value;
                    obj.DUE_apellido1 = txt_apellido1.Value;
                    obj.DUE_apellido2 = txt_apellido2.Value;
                    obj.DUE_codigo_postal = txt_codigo_postal.Value;
                    obj.DUE_cuidad = txt_cuidad.Value;
                    obj.DUE_email = txt_email.Value;
                    obj.DUE_id_dueno = Convert.ToInt32(txt_codigo.Value);

                    wsgest.UPD_Dueno(obj);
                    Response.Redirect("frm_Grid_Dueno.aspx");
                }
            }

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