Beispiel #1
0
        private void AddRestaurantsToList()
        {
            lblRestList.Text = "Restoran Listesi" + " (" + LoggedUser.Location + ")";
            panelRestourant.Controls.Clear();
            db.Connect();
            int             j     = 0;
            string          query = string.Format("SELECT * FROM Restaurants WHERE LocationID = '{0}' ORDER BY RestaurantRating ASC", LoggedUser.LocationID);
            MySqlDataReader dr    = db.GetQuery(query);

            while (dr.Read())
            {
                ucRestList ucTempRestList = new ucRestList(dr);
                /* Event Controls */
                ucTempRestList.Click += new EventHandler(Restaurant_Click);
                foreach (Control c in ucTempRestList.Controls)
                {
                    c.Click += new EventHandler(Restaurant_Click);
                }
                /* BG Color */
                if (j % 2 == 0)
                {
                    ucTempRestList.BackColor = Color.FromArgb(255, 245, 255);
                }
                panelRestourant.Controls.Add(ucTempRestList);
                j++;
            }
            db.Close();
        }
Beispiel #2
0
 private void LoadSelectedRestaurant(ucRestList ucTemp)
 {
     SelectedRestaurant = new Restaurant
     {
         ID            = ucTemp.RestID,
         LocationID    = ucTemp.LocationID,
         Name          = ucTemp.lblRestName.Text,
         MinOrderPrice = ucTemp.MinOrderPrice,
         OwnerID       = ucTemp.OwnerID,
         Rating        = Convert.ToSingle(ucTemp.bgRestRating.Text),
         Description   = ucTemp.lblRestDesc.Text
     };
 }