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>"); } }
public String setAdmintrarTiposdeArquitecturaController(logica.Models.clsTipodeArquitectura obclsTiposdeArquitecturaModels, int inOpcion) { try { logica.BL.clsTipodeArquitectura obclsTiposdeArquitectura = new logica.BL.clsTipodeArquitectura(); return(obclsTiposdeArquitectura.setAdministrarTiposdeArquitectura(obclsTiposdeArquitecturaModels, inOpcion)); } catch (Exception ex) { throw ex; } }
public void verficar_TipodeArquitectura() { //Arrange logica.BL.clsTipodeArquitectura obclsTipodeArquitectura = new logica.BL.clsTipodeArquitectura(); logica.Models.clsTipodeArquitectura obclsTipodeArquitecturaModels = new logica.Models.clsTipodeArquitectura { lgCodigo = 5, stDescripcion = "Leonardo " }; //Act string mensaje = obclsTipodeArquitectura.setAdministrarTiposdeArquitectura(obclsTipodeArquitecturaModels, 1); //Assert Assert.AreEqual("Se realizo proceso con exito", mensaje); }
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>"); } }