예제 #1
0
        void modificaRegistro()
        {
            if (this.IsValid)
            {
                string mensaje = "";

                BLCliente oModifica = new BLCliente();

                bool resultado = false;

                try
                {
                    ///Aquí se va a optener los datos para ingresar la información a la BD
                    ///

                    string cedulaBusqueda = txtcedulaBuscar.Text;

                    string nombre = this.txtNombre.Text;

                    string apellido1 = this.txtApellido1.Text;

                    string apellido2 = this.txtApellido2.Text;

                    string cedula = this.txtCedula.Text;

                    string genero = this.ddGenero.SelectedValue;

                    DateTime fechaNacimiento = Convert.ToDateTime(this.txtFechanacimiento.Text);

                    string direccion = this.txtDireccion.Text;

                    string telefono1 = this.txtTelefono1.Text;

                    string telefono2 = this.txtTelefono2.Text;

                    string correo = this.txtCorreo.Text;

                    int idProvincia = Convert.ToInt16(this.ddProvincia.SelectedValue);

                    int idCanton = Convert.ToInt16(this.ddCanton.SelectedValue);

                    int idDistrito = Convert.ToInt16(this.ddDistrito.SelectedValue);

                    /// se llama al procedimiento almacenado para ingresar la información

                    resultado = oModifica.ModificaCliente(cedulaBusqueda, cedula, genero, fechaNacimiento, nombre, apellido1, apellido2, direccion, telefono1, telefono2, correo, idProvincia, idCanton, idDistrito);
                }
                catch (Exception excepcionCapturada)
                {
                    mensaje += $"Ocurrió un error: {excepcionCapturada.Message} ";
                }
                finally
                {
                    /// si la variable resultado es verdadera implica que no hubo errores

                    if (resultado)
                    {
                        mensaje += "El registro fue modificado";
                    }
                }

                ///motrar el mensaje

                Response.Write("<script>alert('" + mensaje + "')</script>");
            }
        }