Example #1
0
        public void FillDB()
        {
            for (var i = 1; i <= 50; i++)
            {
                var apiHandler = new apiHandler();
                var root       = apiHandler.Root(i);

                foreach (var fugitive in root.items)
                {
                    using (var con = new NpgsqlConnection(cs))
                    {
                        con.Open();

                        var           queryBuilder = new queryBuilder();
                        NpgsqlCommand cmd          = queryBuilder.FillCommand(fugitive, con);

                        try
                        {
                            cmd.ExecuteNonQuery();
                        }
                        catch
                        {
                            //TODO: logging
                            throw;
                        }
                    }
                }
            }
        }
Example #2
0
        public void UpdateAProfile(Item2 item)
        {
            using (var con = new NpgsqlConnection(cs))
            {
                con.Open();

                var           querymaker = new queryBuilder();
                NpgsqlCommand cmd        = querymaker.UpdateOneEditedRecord(con, item);
                cmd.ExecuteNonQuery();
            }
        }
Example #3
0
        public void SelfDestruct()
        {
            using (var con = new NpgsqlConnection(cs))
            {
                con.Open();
                var queryBuilder = new queryBuilder();
                var cmd          = queryBuilder.Nuke(con);

                cmd.ExecuteNonQuery();
            }
        }
Example #4
0
        public void updateDB()
        {
            using (var con = new NpgsqlConnection(cs))
            {
                con.Open();
                var queryBuilder = new queryBuilder();
                var cmd          = queryBuilder.updateCommand(con);

                cmd.ExecuteNonQuery();
                FillDB();
            }
        }
Example #5
0
 public void addProfile(Item item, Image image)
 {
     using (var con = new NpgsqlConnection(cs))
     {
         con.Open();
         var queryBuilder = new queryBuilder();
         var cmd          = queryBuilder.addProfile(item, image, con);
         try
         {
             cmd.ExecuteNonQuery();
         }
         catch
         {
             throw;
         }
     }
 }
Example #6
0
 public void DeleteSighting(int sid)
 {
     using (var con = new NpgsqlConnection(cs))
     {
         con.Open();
         var queryBuilder = new queryBuilder();
         var cmd          = queryBuilder.deleteReport(con, sid);
         try
         {
             cmd.ExecuteNonQuery();
         }
         catch
         {
             throw;
         }
     }
 }
Example #7
0
 public void approveSighting(int report)
 {
     using (var con = new NpgsqlConnection(cs))
     {
         con.Open();
         var queryBuilder = new queryBuilder();
         var cmd          = queryBuilder.verifyReport(con, report);
         try
         {
             cmd.ExecuteNonQuery();
         }
         catch
         {
             throw;
         }
     }
 }
Example #8
0
 public void ReportSighting(ReportModel report)
 {
     using (var con = new NpgsqlConnection(cs))
     {
         con.Open();
         var queryBuilder = new queryBuilder();
         var cmd          = queryBuilder.AddReport(con, report);
         try
         {
             cmd.ExecuteNonQuery();
         }
         catch
         {
             throw;
         }
     }
 }