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(txtCiudad.Text)) { stMensaje += "Ingrese Ciudad, "; } if (String.IsNullOrEmpty(txtLatitud.Text)) { stMensaje += "Ingrese Latitud, "; } if (String.IsNullOrEmpty(txtLongitud.Text)) { stMensaje += "Ingrese Longitud, "; } if (!String.IsNullOrEmpty(stMensaje)) { throw new Exception(stMensaje.TrimEnd(',')); } logica.Models.clsArquitectura clsArquitectura = new logica.Models.clsArquitectura { lgCodigo = Convert.ToInt64(txtCodigo.Text), clsDepartamentos = new logica.Models.clsDepartamentos { inCodigo = Convert.ToInt64(ddlDepartamento.SelectedValue) }, stNombre = txtNombre.Text, stCiudad = txtCiudad.Text, stLatitud = txtLatitud.Text, stLongitud = txtLongitud.Text, clsTipodeArquitectura = new logica.Models.clsTipodeArquitectura { lgCodigo = Convert.ToInt64(ddlTipoArquitectura.SelectedValue) } }; Controllers.ArquitecturaControllers obArquitecturaControllers = new Controllers.ArquitecturaControllers(); if (String.IsNullOrEmpty(lblOpcion.Text)) { lblOpcion.Text = "1"; } ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('Mensaje!,'" + obArquitecturaControllers.setAdministarArquitecturaController(clsArquitectura, Convert.ToInt32(lblOpcion.Text)) + "')</Script>"); lblOpcion.Text = txtCodigo.Text = txtNombre.Text = txtCiudad.Text = txtLatitud.Text = txtLongitud.Text = String.Empty; getArquitectura(); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> Swal('" + ex.Message + "')</Script>"); } }
public String setAdministarArquitecturaController(logica.Models.clsArquitectura obclsArquitecturaModels, int inOpcion) { try { logica.BL.clsArquitectura obclsArquitectura = new logica.BL.clsArquitectura(); return(obclsArquitectura.setAdministrarArquitectura(obclsArquitecturaModels, inOpcion)); } catch (Exception ex) { throw ex; } }
protected void gvwDatos_RowCommand(object sender, 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; txtNombre.Text = String.IsNullOrEmpty(gvwDatos.Rows[inIndice].Cells[2].Text) ? String.Empty : gvwDatos.Rows[inIndice].Cells[2].Text; txtCiudad.Text = String.IsNullOrEmpty(gvwDatos.Rows[inIndice].Cells[3].Text) ? String.Empty : gvwDatos.Rows[inIndice].Cells[3].Text; txtLatitud.Text = String.IsNullOrEmpty(gvwDatos.Rows[inIndice].Cells[4].Text) ? String.Empty : gvwDatos.Rows[inIndice].Cells[4].Text; txtLongitud.Text = String.IsNullOrEmpty(gvwDatos.Rows[inIndice].Cells[5].Text) ? String.Empty : gvwDatos.Rows[inIndice].Cells[5].Text; } else if (e.CommandName.Equals("Eliminar")) { lblOpcion.Text = "3"; logica.Models.clsArquitectura obclsArquitectura = new logica.Models.clsArquitectura { lgCodigo = Convert.ToInt32(((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text), clsDepartamentos = new logica.Models.clsDepartamentos { inCodigo = 0 }, stNombre = String.Empty, stCiudad = String.Empty, stLatitud = String.Empty, stLongitud = String.Empty, clsTipodeArquitectura = new logica.Models.clsTipodeArquitectura { lgCodigo = 0 } }; Controllers.ArquitecturaControllers obArquitecturaControllers = new Controllers.ArquitecturaControllers(); ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('MENSAJE!', '" + obArquitecturaControllers.setAdministarArquitecturaController(obclsArquitectura, Convert.ToInt32(lblOpcion.Text)) + "!', 'success')</Script>"); lblOpcion.Text = txtCodigo.Text = txtNombre.Text = txtCiudad.Text = txtLatitud.Text = txtLongitud.Text = String.Empty; getArquitectura(); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('ERROR!', '" + ex.Message + "!', 'ERROR')</Script>"); } }
public void verificar_Arquitectura() { //Arrange logica.BL.clsArquitectura obclsArquitectura = new logica.BL.clsArquitectura(); logica.Models.clsArquitectura obclsArquitecturaModels = new logica.Models.clsArquitectura { lgCodigo = 20, stNombre = "Prueba", stCiudad = "Cali", stLatitud = "121212", stLongitud = "1121212", clsDepartamentos = new logica.Models.clsDepartamentos { inCodigo = 1 }, clsTipodeArquitectura = new logica.Models.clsTipodeArquitectura { lgCodigo = 1 } }; //act string mensaje = obclsArquitectura.setAdministrarArquitectura(obclsArquitecturaModels, 1); //Assert Assert.AreEqual("Se realizo proceso con exito", mensaje); }