Esempio n. 1
0
        public void Eliminar(int id)
        {
            TelefonoEntity entidad = new TelefonoEntity();

            entidad.IdTelefono = id;
            EjecutarComando(daComun.TipoComandoEnum.Eliminar, entidad);
        }
Esempio n. 2
0
        public void Insertar(TelefonoEntity entidad)
        {
            daContadores da = new daContadores();

            entidad.IdTelefono = da.TraerContador(daComun.Contador.Telefono) + 1;
            EjecutarComando(daComun.TipoComandoEnum.Insertar, entidad);
            da.Sumar(daComun.Contador.Telefono);
        }
Esempio n. 3
0
        private TelefonoEntity CrearEntidad(OdbcDataReader dr)
        {
            TelefonoEntity entidad = new TelefonoEntity();

            entidad.IdTelefono = Convert.ToInt32(dr["IdTelefono"]);
            entidad.IdCliente  = Convert.ToInt32(dr["IdCliente"]);
            entidad.Telefono   = dr["Telefono"].ToString();
            return(entidad);
        }
Esempio n. 4
0
        private void CrearParametros(OdbcCommand command, TelefonoEntity entidad)
        {
            OdbcParameter parameter = null;

            parameter       = command.Parameters.Add("?", OdbcType.Int);
            parameter.Value = entidad.IdCliente;

            parameter       = command.Parameters.Add("?", OdbcType.VarChar);
            parameter.Value = entidad.Telefono;
        }
Esempio n. 5
0
        public static void AgregarTelefono(string telefono, int idcliente)
        {
            TelefonoEntity tel = new TelefonoEntity();

            tel.IdCliente = idcliente;
            tel.Telefono  = telefono;
            daTelefono da = new daTelefono();

            da.Insertar(tel);
        }
Esempio n. 6
0
        private void EjecutarComando(daComun.TipoComandoEnum sqlCommandType, TelefonoEntity entidad)
        {
            OdbcConnection connection = null;
            OdbcCommand    command    = null;

            try {
                connection = (OdbcConnection)connectionDA.GetOpenedConnection();
                IDataParameter paramId = new OdbcParameter("?", OdbcType.Int);
                paramId.Value = entidad.IdTelefono;

                switch (sqlCommandType)
                {
                case daComun.TipoComandoEnum.Insertar:
                    command = new OdbcCommand(SQLInsert, connection);
                    command.Parameters.Add(paramId);
                    CrearParametros(command, entidad);
                    break;

                case daComun.TipoComandoEnum.Actualizar:
                    command = new OdbcCommand(SQLUpdate, connection);
                    command.Parameters.Add(paramId);
                    CrearParametros(command, entidad);
                    break;

                case daComun.TipoComandoEnum.Eliminar:
                    command = new OdbcCommand(SQLDelete, connection);
                    command.Parameters.Add(paramId);
                    CrearParametros(command, entidad);
                    break;
                }

                command.ExecuteNonQuery();
                connection.Close();
            } catch (Exception ex) {
                throw new daException(ex);
            } finally {
                if (command != null)
                {
                    command.Dispose();
                }

                if (connection != null)
                {
                    connection.Dispose();
                }
            }
        }
Esempio n. 7
0
 public void Actualizar(TelefonoEntity entidad)
 {
     EjecutarComando(daComun.TipoComandoEnum.Actualizar, entidad);
 }
Esempio n. 8
0
 public void Actualizar(TelefonoEntity entidad)
 {
     EjecutarComando(TipoComando.Actualizar, entidad);
 }
Esempio n. 9
0
 public void Insertar(TelefonoEntity entidad)
 {
     EjecutarComando(TipoComando.Insertar, entidad);
 }