コード例 #1
0
        void EliminarAdminRentals()
        {
            try
            {
                C_AdminRentals oAdminRentals = new C_AdminRentals();

                bool registroModificado =
                    oAdminRentals.
                    EliminaAdminRental(
                        Convert.ToInt16(this.hdldAdmin.Value));

                if (registroModificado)
                {
                    this.lblResultado.Text = "Registro eliminado";
                }
                else
                {
                    this.lblResultado.Text = "No fue posible eliminar";
                }
            }
            catch (Exception error)
            {
                this.lblResultado.Text = "Ocurrió un error:" + error.Message;
            }
        }
コード例 #2
0
        void CargaDatosAdminRentals()
        {
            ///obtener el valor del parámetro que fue asignado al hidden
            ///en el page_Load
            string llavePrimaria = this.hdldAdmin.Value;

            if (!string.IsNullOrEmpty(llavePrimaria))
            {
                int            id_AdminRentals = Convert.ToInt16(llavePrimaria);
                C_AdminRentals oAdminRentals   = new C_AdminRentals();
                ///Crear la instancia del objeto de retorno
                ///del procedimiento almacenado
                sp_RetornaAdminRentalID_Result resultadoSp = oAdminRentals.RetornaAdminRentalID(id_AdminRentals);

                ///validar que el procedimiento retorne un valor
                if (resultadoSp != null)
                {
                    this.txtCedula.Text          = resultadoSp.adr_Cedula;
                    this.txtNombre.Text          = resultadoSp.adr_Nombre;
                    this.txtSegundoNombre.Text   = resultadoSp.adr_SegundoNombre;
                    this.txtPrimerApellido.Text  = resultadoSp.adr_PrimerApellido;
                    this.txtSegundoApellido.Text = resultadoSp.adr_SegundoApellido;
                    this.txtFechaNacimiento.Text = resultadoSp.adr_FechaNacimiento.ToString();
                    this.txtTelefonoCasa.Text    = resultadoSp.adr_TelefonoCasa;
                    this.txtTelefonoCelular.Text = resultadoSp.adr_TelefonoCelular;
                    this.txtEmail.Text           = resultadoSp.adr_Email;
                }
            }
        }
コード例 #3
0
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            ///Verificar que todas las validaciones hayan sido
            ///satisfactorias
            if (this.IsValid)
            {
                int id_AdminRentals = 0;

                ///obtener del hiddenField el valor de la llave primaria
                id_AdminRentals = Convert.ToInt16(this.hdldAdmin.Value);

                try
                {
                    C_AdminRentals oAdminRentals = new C_AdminRentals();

                    if (oAdminRentals.ModificaAdminRentals(id_AdminRentals, this.txtCedula.Text,
                                                           this.txtNombre.Text, this.txtSegundoNombre.Text, this.txtPrimerApellido.Text, this.txtSegundoApellido.Text,
                                                           null, this.txtTelefonoCasa.Text, this.txtTelefonoCelular.Text, this.txtEmail.Text)
                        )
                    {
                        this.lblResultado.Text = "Registro Modificado";
                    }
                    else
                    {
                        this.lblResultado.Text = "No se pudo modificar";
                    }
                }
                catch (Exception error)
                {
                    this.lblResultado.Text = "No se pudo modificar";
                }
            }
        }
コード例 #4
0
        void AgregarAdminRentals()
        {
            try
            {
                string adr_Cedula          = this.txtCedula.Text.ToString();
                string adr_Nombre          = this.txtNombre.Text.ToString();
                string adr_SegundoNombre   = this.txtSegundoNombre.Text.ToString();
                string adr_PrimerApellido  = this.txtPrimerApellido.Text.ToString();
                string adr_SegundoApellido = this.txtSegundoApellido.Text.ToString();
                Nullable <System.DateTime> adr_FechaNacimiento = null;
                string adr_TelefonoCasa    = this.txtTelefonoCasa.Text.ToString();
                string adr_TelefonoCelular = this.txtTelefonoCelular.Text.ToString();
                string adr_Email           = this.txtEmail.Text.ToString();


                C_AdminRentals oAdminRentals        = new C_AdminRentals();
                bool           AdminRentalsInsertar =
                    oAdminRentals.InsertaAdminRentals(adr_Cedula, adr_Nombre, adr_SegundoNombre, adr_PrimerApellido, adr_SegundoApellido, adr_FechaNacimiento, adr_TelefonoCasa, adr_TelefonoCelular, adr_Email);


                if (AdminRentalsInsertar)
                {
                    this.lblResultado.Text = "Administrador agregado";
                }
                else
                {
                    this.lblResultado.Text = "No se pudo agregar el administrador";
                }
            }
            catch (Exception error)
            {
                this.lblResultado.
                Text = "Ocurrió un error:" + error.Message;
            }
        }
コード例 #5
0
        void CargaDatosGrid()
        {
            string cedula          = this.txtCedula.Text.ToString();
            string nombre          = this.txtNombre.Text.ToString();
            string segundonombre   = this.txtSegundoNombre.Text.ToString();
            string primerapellido  = this.txtPrimerApellido.Text.ToString();
            string segundoapellido = this.txtSegundoApellido.Text.ToString();
            string email           = this.txtEmail.Text.ToString();


            C_AdminRentals oAdminRentals = new C_AdminRentals();

            ///Asignarle la fuente de datos al grid
            this.grdListaAdminRentals.DataSource =
                oAdminRentals.RetornaAdminRental(cedula, nombre, segundonombre, primerapellido, segundoapellido, email);
            ///indicar al grid que se muestre
            this.grdListaAdminRentals.DataBind();
        }