Пример #1
0
        /// <summary>
        /// Borra la instancia de la base de datos
        /// </summary>
        /// <param name="conn">La conexión a SQLite.</param>
        /// <returns>
        /// Verdadero si se borra el elemento
        /// </returns>
        public bool Delete(SQLite_Connector conn)
        {
            string condition = String.Format(" conn_id = {0} AND conn_type = 1 ", this.Id);
            var tot = conn.SelectValue<long>("SELECT Count(conn_id) FROM destination WHERE" + condition);
            if (tot == 0)
            {
                Boolean ctoFlag = false, tabFlag = false;//, destTab;
                //El circuito borrará los componentes
                string[] keys = this.Circuitos.Keys.ToArray();
                foreach (string key in keys)
                    ctoFlag = this.Circuitos[key].Delete(conn);

                tabFlag = conn.DeletebyColumn(this.TableName, this.PrimaryKey, this.Id);
                if (tabFlag)
                {
                    TabalimApp.CurrentProject.Tableros.Remove(this.Id);
                    ////Tambien se debe borrar de la tabla destination
                    //string condition = String.Format(" conn_id = {0} AND conn_type = 1 ", this.Id);
                    //destTab = conn.Delete("destination", condition);
                }
                return ctoFlag && tabFlag;
            }
            else
                return false;
        }
Пример #2
0
        /// <summary>
        /// Borra la instancia de la base de datos
        /// </summary>
        /// <param name="conn">La conexión a SQLite.</param>
        /// <returns>
        /// Verdadero si se borra el elemento
        /// </returns>
        public bool Delete(SQLite_Connector conn)
        {
            Boolean cmpFlag = conn.DeletebyColumn(this.TableName, this.PrimaryKey, this.Id);

            if (cmpFlag)
            {
                Circuito.Componentes.Remove(this.Id);
                if (Circuito.Componentes.Count == 0)
                {
                    Circuito.Delete(conn);
                }
                TabalimApp.CurrentTablero.Componentes.Remove(this.Id);
            }
            return(cmpFlag);
        }
Пример #3
0
        /// <summary>
        /// Borra la instancia de la base de datos
        /// </summary>
        /// <param name="conn">La conexión a SQLite.</param>
        /// <returns>
        /// Verdadero si se borra el elemento
        /// </returns>
        public bool Delete(SQLite_Connector conn)
        {
            Boolean succed = conn.DeletebyColumn(this.TableName, this.PrimaryKey, this.Id);

            if (succed)
            {
                //Tambien se debe borrar de la tabla destination
                string condition = String.Format(" conn_id = {0} AND conn_type = 0 ", this.Id);
                succed = conn.Delete("destination", condition);
                if (succed)//Actualizar la memoria
                {
                    //ToDo
                }
            }
            return(succed);
        }
Пример #4
0
        /// <summary>
        /// Borra la instancia de la base de datos
        /// </summary>
        /// <param name="conn">La conexión a SQLite.</param>
        /// <returns>
        /// Verdadero si se borra el elemento
        /// </returns>
        /// <exception cref="NotImplementedException"></exception>
        public bool Delete(SQLite_Connector conn)
        {
            Boolean succed = conn.DeletebyColumn(this.TableName, this.PrimaryKey, this.Id);

            if (succed)
            {
                //Tambien se debe borrar de la tabla destination
                string condition = String.Format(" alim_id = {0} ", this.Id);
                succed = conn.Delete("destination", condition);
                if (succed)//Actualizar la memoria
                {
                    runtime.TabalimApp.CurrentProject.Lineas.Remove(this.Id);
                }
            }
            return(succed);
        }
Пример #5
0
        /// <summary>
        /// Borra la instancia de la base de datos
        /// </summary>
        /// <param name="conn">La conexión a SQLite.</param>
        /// <returns>
        /// Verdadero si se borra el elemento
        /// </returns>
        public bool Delete(SQLite_Connector conn)
        {
            Boolean cmpFlag = false, ctoFlag = false;

            int[] ids = this.Componentes.Keys.ToArray();
            foreach (int id in ids)
            {
                cmpFlag = this.Componentes[id].Delete(conn);
            }
            ctoFlag = conn.DeletebyColumn(this.TableName, this.PrimaryKey, this.Id);
            if (ctoFlag)
            {
                TabalimApp.CurrentTablero.Circuitos.Remove(this.ToString());
            }
            return(ctoFlag && cmpFlag);
        }