コード例 #1
0
        /*
         * public int AddIngredient() {
         *  string sql = "INSERT INTO whatsfordinner.ingredient(name, measure_type) VALUES (@name, @measure_type)";
         *
         *  NpgsqlCommand command = new NpgsqlCommand(sql, conn);
         *  command.Parameters.AddWithValue("@name", "test1");
         *  command.Parameters.AddWithValue("@measure_type", "test2");
         *
         *  return NonQuery(command, "whatsfordinner.ingredient");
         * }
         *
         * public int AddOneTestAccount() {
         *  string sql = "INSERT INTO accounts(username, password, email, settings, preferences) VALUES (@username, @password, @email, @settings, @preferences)";
         *
         *  NpgsqlCommand command = new NpgsqlCommand(sql, conn);
         *  command.Parameters.AddWithValue("@username", "andrejas");
         *  command.Parameters.AddWithValue("@password", "drdrois");
         *  command.Parameters.AddWithValue("@email", "*****@*****.**");
         *  command.Parameters.AddWithValue("@settings", "noget med settings");
         *  command.Parameters.AddWithValue("@preferences", "noget med preferences");
         *
         *  return NonQuery(command, "accounts");
         * }
         *
         * public int AddTwoTestAccount() {
         *  string sql = "INSERT INTO accounts(username, password, email, settings, preferences) VALUES (@username, @password, @email, @settings, @preferences), (@username, @password, @email, @settings, @preferences)";
         *
         *  NpgsqlCommand command = new NpgsqlCommand(sql, conn);
         *  command.Parameters.AddWithValue("@username", "andrejas");
         *  command.Parameters.AddWithValue("@password", "drdrois");
         *  command.Parameters.AddWithValue("@email", "*****@*****.**");
         *  command.Parameters.AddWithValue("@settings", "noget med settings");
         *  command.Parameters.AddWithValue("@preferences", "noget med preferences");
         *
         *  return NonQuery(command, "accounts");
         * }
         */
        public static void dbMassEntityInsert()
        {
            DBController dbc = new DBController();

            dbc.AddAccount(ModelDebug.GetTestAccount());
            dbc.AddIngredient(ModelDebug.GetTestIngredient());
            dbc.AddRetailer(ModelDebug.GetTestRetailer());
            dbc.AddRecipe(ModelDebug.GetTestRecipe());
            dbc.AddComment(ModelDebug.GetTestComment());

            dbc.Close();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: RevBlood/sw8program
        static void jsonstuff()
        {
            JSONDebug.JSONAccountDebug(ModelDebug.GetTestAccount());
            JSONDebug.JSONCommentDebug(ModelDebug.GetTestComment());
            JSONDebug.JSONIngredientDebug(ModelDebug.GetTestIngredient());
            JSONDebug.JSONRecipeDebug(ModelDebug.GetTestRecipe());
            JSONDebug.JSONRetailerDebug(ModelDebug.GetTestRetailer());

            JSONDebug.JSONFavorisesDebug(ModelDebug.GetTestFavorises());
            JSONDebug.JSONHasEatenDebug(ModelDebug.GetTestHasEaten());
            JSONDebug.JSONIngredientInDebug(ModelDebug.GetTestIngredientIn());
            JSONDebug.JSONOffersDebug(ModelDebug.GetTestOffers());
            JSONDebug.JSONPicturesDebug(ModelDebug.GetTestPictures());
        }
コード例 #3
0
        public static void dbMassInsert()
        {
            DBController dbc = new DBController();

            dbc.AddAccount(ModelDebug.GetTestAccount());
            dbc.AddIngredient(ModelDebug.GetTestIngredient());
            dbc.AddRetailer(ModelDebug.GetTestRetailer());
            dbc.AddRecipe(ModelDebug.GetTestRecipe());
            dbc.AddComment(ModelDebug.GetTestComment());

            dbc.AddFavorises(ModelDebug.GetTestFavorises());
            dbc.AddHasEaten(ModelDebug.GetTestHasEaten());
            dbc.AddIngredientIn(ModelDebug.GetTestIngredientIn());
            dbc.AddOffers(ModelDebug.GetTestOffers());
            dbc.AddPictures(ModelDebug.GetTestPictures());

            dbc.Close();
        }