Exemplo n.º 1
0
        protected void gvwDatos_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            try
            {
                int inIndice = Convert.ToInt16(e.CommandArgument);
                if (e.CommandName.Equals("Editar"))
                {
                    lblOpcion.Text      = "2";
                    txtCodigo.Text      = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text;
                    txtDescripcion.Text = String.IsNullOrEmpty(gvwDatos.Rows[inIndice].Cells[1].Text) ? String.Empty : gvwDatos.Rows[inIndice].Cells[1].Text;
                }
                else if (e.CommandName.Equals("Eliminar"))
                {
                    lblOpcion.Text = "3";
                    logica.Models.clsTipodeArquitectura obclsTipodeArquitectura = new logica.Models.clsTipodeArquitectura
                    {
                        lgCodigo      = Convert.ToInt32(((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text),
                        stDescripcion = String.Empty,
                    };

                    Controllers.TipodeArquitecturaControllers obTipodeArquitectura = new Controllers.TipodeArquitecturaControllers();

                    ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('MENSAJE!', '" + obTipodeArquitectura.setAdmintrarTiposdeArquitecturaController(obclsTipodeArquitectura, Convert.ToInt32(lblOpcion.Text)) + "!', 'success')</Script>");

                    lblOpcion.Text = txtCodigo.Text = txtDescripcion.Text = String.Empty;
                    getTiposdeArquitectura();
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('ERROR!', '" + ex.Message + "!', 'ERROR')</Script>");
            }
        }
Exemplo n.º 2
0
 void getTiposdeArquitectura()
 {
     try
     {
         Controllers.TipodeArquitecturaControllers tipodeArquitecturaControllers = new Controllers.TipodeArquitecturaControllers();
         DataSet dsConsulta = tipodeArquitecturaControllers.getConsultarTiposdeArquitecturaController();
         if (dsConsulta.Tables[0].Rows.Count > 0)
         {
             gvwDatos.DataSource = dsConsulta;
         }
         else
         {
             gvwDatos.DataSource = null;
         }
         gvwDatos.DataBind();
     }
     catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('ERROR!', '" + ex.Message + "!', 'error')</Script>"); }
 }
Exemplo n.º 3
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(txtDescripcion.Text))
                {
                    stMensaje += "Ingrese Descripcion, ";
                }

                if (!String.IsNullOrEmpty(stMensaje))
                {
                    throw new Exception(stMensaje.TrimEnd(','));
                }

                logica.Models.clsTipodeArquitectura clsTipodeArquitectura = new logica.Models.clsTipodeArquitectura
                {
                    lgCodigo      = Convert.ToInt64(txtCodigo.Text),
                    stDescripcion = txtDescripcion.Text,
                };

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

                ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> alert('Mensaje!,'" + obtipodeArquitecturaControllers.setAdmintrarTiposdeArquitecturaController(clsTipodeArquitectura, Convert.ToInt32(lblOpcion.Text)) + "')</Script>");
                lblOpcion.Text = txtCodigo.Text = txtDescripcion.Text = String.Empty;
                getTiposdeArquitectura();
            }
            catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> alert('" + ex.Message + "')</Script>"); }
        }