Beispiel #1
0
 public void GetLoginBusinessAttributes()
 {
     if (businessLogInListBox.SelectedIndex > -1 && query.GetLoggedInBusiness() != null)
     {
         Classes.Business currLoginBusiness = query.GetLoggedInBusiness();
         var newObject = query.GetCurrentBusinessAttributes(currLoginBusiness.business_id);
         if (newObject.Count > 0)
         {
             StringBuilder sb = new StringBuilder();
             foreach (var item in newObject)
             {
                 if (!item.attribute_value.Equals("False"))
                 {
                     if (item.attribute_value.Equals("True"))
                     {
                         sb.AppendLine(item.attribute_name.ToString());
                     }
                     else
                     {
                         sb.AppendLine(item.attribute_name + " : " + item.attribute_value);
                     }
                 }
             }
             loggedInAttributes.Text = sb.ToString();
         }
     }
 }
Beispiel #2
0
 private void InsertCheckins()
 {
     if (searchDataGrid.SelectedIndex > -1)
     {
         Classes.Business currentBusiness = (Classes.Business)searchDataGrid.SelectedItem;
         query.InsertCheckins(currentBusiness);
     }
 }
Beispiel #3
0
 private void RemoveFromFavorites()
 {
     if (favoriteDataGrid.SelectedIndex > -1)
     {
         Classes.Business tempBusiness = (Classes.Business)favoriteDataGrid.SelectedItem;
         int updated = query.RemoveBusiness(tempBusiness.business_id);
         if (updated == 1)
         {
             LoadFavorites();
         }
     }
 }
Beispiel #4
0
 // try to get this on query setup
 private void GetCurrentBusinessDetails()
 {
     if (searchDataGrid.SelectedIndex > -1)
     {
         Classes.Business currentBusiness = (Classes.Business)searchDataGrid.SelectedItem;
         addressTextBox.Text  = currentBusiness.address;
         businessTextBox.Text = currentBusiness.name;
         List <Object[]> newObject = query.GetCurrentBusinessCategories(currentBusiness.business_id);
         StringBuilder   sb        = new StringBuilder();
         foreach (Object[] item in newObject)
         {
             sb.Append(item[0] + "\n");
         }
         categoryTextBox.Text = sb.ToString();
         sb        = new StringBuilder();
         newObject = query.GetCurrentBusinessAttributes(currentBusiness.business_id);
         foreach (Object[] item in newObject)
         {
             if (!item[1].ToString().Equals("False"))
             {
                 if (item[1].ToString().Equals("True"))
                 {
                     sb.AppendLine(item[0].ToString());
                 }
                 else
                 {
                     sb.AppendLine(item[0].ToString() + " : " + item[1].ToString());
                 }
             }
             //sb.Append(item[0] + " : " + item[1]+ "\n");
         }
         attributesTextBox.Text = sb.ToString();
         sb = new StringBuilder();
         DateTime      today    = DateTime.Now;
         Classes.Hours newHours = query.GetCurrentBusinessHours(currentBusiness.business_id, today.ToString("dddd"));
         if (newHours != null)
         {
             sb.Append("Today(" + newHours.hours_day + ")\n");
             sb.Append("Opens: " + newHours.hours_open.ToString("hh:mm") + "\n");
             sb.Append("Closed: " + newHours.hours_close.ToString("hh:mm"));
         }
         else
         {
             sb.Append("Today(" + today.ToString("dddd") + ")\n");
             sb.Append("Opens: N/A \n");
             sb.Append("Closed: N/A");
         }
         hoursTextBox.Text = sb.ToString();
         AddPin(new Location(currentBusiness.latitute, currentBusiness.longtitude), currentBusiness.name, Colors.Green);
     }
 }
Beispiel #5
0
        private void LoadFavorites()
        {
            favoriteDataGrid.Items.Clear();
            var businessList = query.GetUserFavorites();

            if (businessList != null)
            {
                foreach (var item in businessList)
                {
                    Classes.Business tempBusiness = query.GetBusinessDetails(item.business_id);
                    favoriteDataGrid.Items.Add(tempBusiness);
                }
            }
        }
Beispiel #6
0
        private void LoadFavorites()
        {
            favoriteDataGrid.Items.Clear();
            List <Object[]> businessList = query.GetUserFavorites();

            if (businessList != null)
            {
                foreach (Object[] item in businessList)
                {
                    Classes.Business tempBusiness = query.GetBusinessDetails(item[0].ToString());
                    favoriteDataGrid.Items.Add(tempBusiness);
                }
            }
        }
Beispiel #7
0
 public void GetLoginBusinessReviews()
 {
     if (businessLogInListBox.SelectedIndex > -1 && query.GetLoggedInBusiness() != null)
     {
         Classes.Business      currLoginBusiness = query.GetLoggedInBusiness();
         List <Classes.Review> reviewList        = query.GetBusinessReviews(currLoginBusiness);
         if (reviewList.Count > 0)
         {
             foreach (Classes.Review item in reviewList)
             {
                 businessLogInReviewDataGrid.Items.Add(item);
             }
         }
     }
 }
Beispiel #8
0
 public void GetLogInBusinessCheckins()
 {
     if (businessLogInListBox.SelectedIndex > -1 && query.GetLoggedInBusiness() != null)
     {
         Classes.Business currLoginBusiness = query.GetLoggedInBusiness();
         var checkinList = new List <Classes.Checkins>();
         List <Classes.Checkins> newObject = query.GetBusinessCheckinDays(currLoginBusiness);
         foreach (var checkinDay in newObject)
         {
             checkinList.Add(query.GetBusinessCheckins(currLoginBusiness, checkinDay.checkin_day));
         }
         GUISetup.WindowSetup createChart = new GUISetup.WindowSetup("My New Chart", checkinList);
         Window newChartWindow            = createChart.GetWindow();
         newChartWindow.Show();
     }
 }
Beispiel #9
0
 public void GetLoginBusinessCategories()
 {
     if (businessLogInListBox.SelectedIndex > -1 && query.GetLoggedInBusiness() != null)
     {
         Classes.Business currLoginBusiness = query.GetLoggedInBusiness();
         var newObject = query.GetCurrentBusinessCategories(currLoginBusiness.business_id);
         if (newObject.Count > 0)
         {
             StringBuilder sb = new StringBuilder();
             foreach (var item in newObject)
             {
                 sb.AppendLine(item.category_name);
             }
             loggedInCategories.Text = sb.ToString();
         }
     }
 }
Beispiel #10
0
 public void GetLoginBusinessDetails()
 {
     if (businessLogInListBox.SelectedIndex > -1)
     {
         Classes.Business tempBusiness = query.GetBusinessDetails(businessLogInListBox.SelectedItem.ToString());
         businessLogInNameTextBox.Text     = tempBusiness.name;
         businessLogInAddressTextBox.Text  = tempBusiness.address;
         businessLogInStateTextBox.Text    = tempBusiness.state;
         businessLogInCityTextBox.Text     = tempBusiness.city;
         businessLogInZipTextBox.Text      = tempBusiness.zipcode;
         businessLogInStarsTextBox.Text    = tempBusiness.stars.ToString();
         businessLogInCountTextBox.Text    = tempBusiness.review_count.ToString();
         businessLogInRatingTextBox.Text   = tempBusiness.review_rating.ToString();
         businessLogInCheckinsTextBox.Text = tempBusiness.num_checkins.ToString();
         businessLatitudeTextBox.Text      = tempBusiness.latitute.ToString();
         businessLongitudeTextBox.Text     = tempBusiness.longtitude.ToString();
         query.SetLoggedInBusiness(tempBusiness);
     }
 }
Beispiel #11
0
 public void GetLoginBusinessHours(String currentDay)
 {
     if (businessLogInListBox.SelectedIndex > -1 && query.GetLoggedInBusiness() != null)
     {
         Classes.Business currLoginBusiness = query.GetLoggedInBusiness();
         Classes.Hours    newHour           = query.GetCurrentBusinessHours(currLoginBusiness.business_id, currentDay);
         StringBuilder    sb = new StringBuilder();
         if (newHour != null)
         {
             sb.Append("Opens: " + newHour.hours_open.ToString("hh:mm") + "\n");
             sb.Append("Closed: " + newHour.hours_close.ToString("hh:mm"));
         }
         else
         {
             sb.Append("Opens: N/A \n");
             sb.Append("Closed: N/A");
         }
         loggedInHours.Text = sb.ToString();
     }
 }
Beispiel #12
0
 private void GetCurrentBusinessFriendReviews()
 {
     if (searchDataGrid.SelectedIndex > -1)
     {
         businessFriendReviewDataGrid.Items.Clear();
         List <Classes.User> newObject = query.GetFriends();
         if (newObject != null)
         {
             Classes.Business tempBusiness = (Classes.Business)favoriteDataGrid.SelectedItem;
             foreach (Classes.User item in newObject)
             {
                 Classes.Review newReview = query.GetBusinessFriendReviews(item.user_Id);
                 if (newReview != null)
                 {
                     businessFriendReviewDataGrid.Items.Add(newReview);
                 }
             }
         }
     }
 }
Beispiel #13
0
 public void GetLoginBusinessCategories()
 {
     if (businessLogInListBox.SelectedIndex > -1 && query.GetLoggedInBusiness() != null)
     {
         Classes.Business currLoginBusiness = query.GetLoggedInBusiness();
         List <Object[]>  newObject         = query.GetCategories(new List <String>()
         {
             currLoginBusiness.state,
             currLoginBusiness.city, currLoginBusiness.zipcode
         });
         if (newObject.Count > 0)
         {
             StringBuilder sb = new StringBuilder();
             foreach (Object[] item in newObject)
             {
                 sb.AppendLine(item[0].ToString());
             }
             loggedInCategories.Text = sb.ToString();
         }
     }
 }