Ejemplo n.º 1
0
 public String insertarDeportes(logica.Models.clsDeportes obclsDeportesModels)
 {
     try
     {
         logica.BL.clsDeportes obclsDeportes = new logica.BL.clsDeportes();
         return(obclsDeportes.addDeportes(obclsDeportesModels));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                String stMensaje = String.Empty;
                if (String.IsNullOrEmpty(txtCodigo.Text))
                {
                    stMensaje += "Ingrese Codigo, ";
                }
                if (String.IsNullOrEmpty(txtNombre.Text))
                {
                    stMensaje += "Ingrese Nombre, ";
                }
                if (!String.IsNullOrEmpty(stMensaje))
                {
                    throw new Exception(stMensaje.TrimEnd(','));
                }

                logica.Models.clsDeportes clsDeportes = new logica.Models.clsDeportes
                {
                    lgCodigo = Convert.ToInt64(txtCodigo.Text),
                    stNombre = txtNombre.Text
                };

                Controllers.DeportesControllers obDeportesControllers = new Controllers.DeportesControllers();
                if (String.IsNullOrEmpty(lblOpcion.Text))
                {
                    lblOpcion.Text = "1";
                }

                if (lblOpcion.Text.Equals("1"))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('Mensaje!,'" + obDeportesControllers.insertarDeportes(clsDeportes) + "!','success')</Script>");
                    lblOpcion.Text = txtCodigo.Text = txtNombre.Text = String.Empty;
                    getDeportes();
                }
                else if (lblOpcion.Text.Equals("2"))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('Mensaje!,'" + obDeportesControllers.updateDeportes(clsDeportes) + "!','success')</Script>");
                    lblOpcion.Text = txtCodigo.Text = txtNombre.Text = String.Empty;
                    getDeportes();
                }
            }
            catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> Swal('MENSAJE!', '" + ex.Message + "!','success')</Script>"); }
        }