示例#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;
                        }
                    }
                }
            }
        }
示例#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();
            }
        }
示例#3
0
        public void SelfDestruct()
        {
            using (var con = new NpgsqlConnection(cs))
            {
                con.Open();
                var queryBuilder = new queryBuilder();
                var cmd          = queryBuilder.Nuke(con);

                cmd.ExecuteNonQuery();
            }
        }
示例#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();
            }
        }
示例#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;
         }
     }
 }
示例#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;
         }
     }
 }
示例#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;
         }
     }
 }
示例#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;
         }
     }
 }