Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();
            mydb = new MySQL_connection();
            sqlIns = new SQLInserter();
            businessDicts = new List<List<Dictionary<string, string>>>();
            reviewDicts = new List<Dictionary<string, string>>();
            userDicts = new List<Dictionary<string, string>>();
            string[] ex = new string[]{ "hours", "neighborhoods", "friends", "compliments", "elite" };

            json = new JSON(ex);
            //json.Convert("yelp_business.json", "Test2.txt");
            // json.Convert("yelp_review.json", "Text3.txt");
            //json.Convert("yelp_user.json", "Text4.txt");
            //businessDicts = sqlIns.JSON_to_Dict_Business("Test2.txt"); //change business table to dictionaries
            //reviewDicts = sqlIns.JSON_to_Dict_Review("Text3.txt");
            userDicts = sqlIns.JSON_to_Dict_User("Text4.txt");
            if (mydb.OpenConnection() == true)
            {
            }

            //sqlIns.Dict_to_SQL_Business(businessDicts, mydb.connect);
            //sqlIns.Dict_to_SQL_Review(reviewDicts,mydb.connect);
            sqlIns.Dict_to_SQL_User(userDicts, mydb.connect);
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();
            mydb          = new MySQL_connection();
            sqlIns        = new SQLInserter();
            businessDicts = new List <List <Dictionary <string, string> > >();
            reviewDicts   = new List <Dictionary <string, string> >();
            userDicts     = new List <Dictionary <string, string> >();
            string[] ex = new string[] { "hours", "neighborhoods", "friends", "compliments", "elite" };

            json = new JSON(ex);
            //json.Convert("yelp_business.json", "Test2.txt");
            // json.Convert("yelp_review.json", "Text3.txt");
            //json.Convert("yelp_user.json", "Text4.txt");
            //businessDicts = sqlIns.JSON_to_Dict_Business("Test2.txt"); //change business table to dictionaries
            //reviewDicts = sqlIns.JSON_to_Dict_Review("Text3.txt");
            //userDicts = sqlIns.JSON_to_Dict_User("Text4.txt");
            if (mydb.OpenConnection() == true)
            {
            }

            //sqlIns.Dict_to_SQL_Business(businessDicts, mydb.connect);
            //sqlIns.Dict_to_SQL_Review(reviewDicts,mydb.connect);
            //sqlIns.Dict_to_SQL_User(userDicts, mydb.connect);
        }
Esempio n. 3
0
        //List<List<Dictionary<string, string>>> businessDicts;
        //List<Dictionary<string, string>> reviewDicts;
        //List<Dictionary<string, string>> userDicts;
        public Form1()
        {
            InitializeComponent();
            sqlIns = new SQLInserter();
            mydb   = new MySQL_connection();
            //businessDicts = new List<List<Dictionary<string, string>>>();
            //reviewDicts = new List<Dictionary<string, string>>();
            //userDicts = new List<Dictionary<string, string>>();
            string[] ex = new string[] { "hours", "neighborhoods", "friends", "compliments", "elite" };

            json = new JSON(ex);
            //json.Convert("yelp_business.json", "Test2.txt");
            //json.Convert("yelp_review.json", "Text3.txt");
            //json.Convert("yelp_user.json", "Text4.txt");
            //businessDicts = sqlIns.JSON_to_Dict_Business("Test2.txt"); //change business table to dictionaries
            //reviewDicts = sqlIns.JSON_to_Dict_Review("Text3.txt");
            //userDicts = sqlIns.JSON_to_Dict_User("Text4.txt");
            if (mydb.OpenConnection() == true)
            {
            }

            //sqlIns.Dict_to_SQL_Business(businessDicts, mydb.connect);
            //sqlIns.Dict_to_SQL_Review(reviewDicts, mydb.connect);
            //sqlIns.Dict_to_SQL_User(userDicts, mydb.connect);


            //****** set up business category checklist ******
            //must make a list of strings that just holds category because all
            //we're looking for is category
            List <string> categoryC = new List <string>();

            categoryC.Add("category");
            string qStr = "SELECT distinct category FROM categories ORDER BY category;";
            List <List <string> > qResult = mydb.SQLSELECTExec(qStr, categoryC);

            //copy query results to the dropdown
            for (int i = 0; i < qResult[0].Count(); i++)
            {
                busDemCheckedListBox.Items.Add(qResult[0][i]);
                checkedListBox1.Items.Add(qResult[0][i]);
            }
        }
Esempio n. 4
0
        private void ViewReviews_Load(object sender, EventArgs e)
        {
            mydb = new MySQL_connection();
            mydb.OpenConnection();
            List <List <string> > res = mydb.SQLSELECTExec(query, new List <string>()
            {
                "date", "stars", "text", "user_id", "useful"
            });

            dataGridView1.Rows.Clear();
            dataGridView1.Refresh();
            //place the given information into the dataGridView Search result table
            for (int j = 0; j < res.Count(); j++)// At 1 so it doesn't include id
            {
                //since each row in qResults contains all of one type of data ie names or cities
                //we have to add a new row each time we go through i
                for (int i = 0; i < res[j].Count(); i++)
                {
                    dataGridView1.Rows.Add();
                    dataGridView1.Rows[i].Cells[j].Value = res[j][i];
                }
            }
        }