コード例 #1
0
ファイル: frm_Raza.aspx.cs プロジェクト: juahidma/petnet-web
        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_Raza obj = new WSGestion.MOD_Raza();

                    obj.RAZ_descripcion = txt_nombre.Value;
                    obj.RAZ_id_raza = 0;

                    wsgest.CRE_Raza(obj);
                    Response.Redirect("frm_Grid_Raza.aspx");
                }

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

                    obj.RAZ_descripcion = txt_nombre.Value;
                    obj.RAZ_id_raza = Convert.ToInt32(txt_codigo.Value.ToString());

                    wsgest.UPD_Raza(obj);
                    Response.Redirect("frm_Grid_Raza.aspx");
                }
            }

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