public static Musculo SingleSpecificSelect(string query)
        {
            Object[] columns = new Object[] { 0, "" };

            Musculo mus = DataBase.SingleSpecificSelect <Musculo>(TablesManager.Tables[tableId].tableName, columns, query);

            return(mus);
        }
        public static Musculo ReadValue(int id)
        {
            Object[] columns = new Object[] { 0, "" };

            Musculo muscle = DataBase.ReadValue <Musculo>(TablesManager.Tables[tableId].tableName,
                                                          TablesManager.Tables[tableId].colName[0], id, columns);

            return(muscle);
        }
        public static Musculo GetLast()
        {
            Object[] columns = new Object[] { 0, "" };

            Musculo muscle = DataBase.GetLast <Musculo>(TablesManager.Tables[tableId].tableName,
                                                        TablesManager.Tables[tableId].colName[0], columns);

            return(muscle);
        }
Beispiel #4
0
        /**
         * Função que lê dados já cadastrados anteriormente na relação musculo.
         */
        public static List <Musculo> Read()
        {
            DataBase banco = new DataBase();

            using (banco.conn = new SqliteConnection(GlobalController.instance.path))
            {
                banco.conn.Open();
                banco.cmd             = banco.conn.CreateCommand();
                banco.sqlQuery        = "SELECT * " + "FROM MUSCULO";
                banco.cmd.CommandText = banco.sqlQuery;
                IDataReader reader = banco.cmd.ExecuteReader();

                List <Musculo> muscles = new List <Musculo>();

                while (reader.Read())
                {
                    int    idMusculoTemp   = 0;
                    string nomeMusculoTemp = "null";

                    if (!reader.IsDBNull(0))
                    {
                        idMusculoTemp = reader.GetInt32(0);
                    }
                    if (!reader.IsDBNull(1))
                    {
                        nomeMusculoTemp = reader.GetString(1);
                    }

                    Musculo muscle = new Musculo(idMusculoTemp, nomeMusculoTemp);
                    muscles.Add(muscle);
                }

                reader.Close();
                reader = null;
                banco.cmd.Dispose();
                banco.cmd = null;
                banco.conn.Close();
                banco.conn = null;
                return(muscles);
            }
        }
Beispiel #5
0
        public static Musculo ReadValue(int id)
        {
            DataBase banco = new DataBase();

            using (banco.conn = new SqliteConnection(GlobalController.instance.path))
            {
                banco.conn.Open();
                banco.cmd      = banco.conn.CreateCommand();
                banco.sqlQuery = "SELECT * " + string.Format("FROM \"{0}\" WHERE \"{1}\" = \"{2}\";", TablesManager.Tables[tableId].tableName,
                                                             TablesManager.Tables[tableId].colName[0],
                                                             id);
                banco.cmd.CommandText = banco.sqlQuery;
                IDataReader reader = banco.cmd.ExecuteReader();

                reader.Read();

                int    idMusculoTemp   = 0;
                string nomeMusculoTemp = "null";

                if (!reader.IsDBNull(0))
                {
                    idMusculoTemp = reader.GetInt32(0);
                }
                if (!reader.IsDBNull(1))
                {
                    nomeMusculoTemp = reader.GetString(1);
                }

                Musculo muscle = new Musculo(idMusculoTemp, nomeMusculoTemp);

                reader.Close();
                reader = null;
                banco.cmd.Dispose();
                banco.cmd = null;
                banco.conn.Close();
                banco.conn = null;
                return(muscle);
            }
        }