Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string sessionUser;
            int    userID;

            try
            {
                DataAccessLayer dao = new DataAccessLayer();
                if (Session["userEmail"] != null)
                {
                    sessionUser      = Session["userEmail"].ToString();
                    hiddenUser.Value = sessionUser;
                    userID           = dao.getUserID(sessionUser);
                    SqlDataReader reader       = dao.GetFavouritePropertiesID(userID);
                    DataTable     favList      = new DataTable();
                    string        _propertyIds = string.Empty;
                    while (reader.Read())
                    {
                        int propertyID = reader.GetInt32(0);
                        _propertyIds += string.Concat(propertyID, ",");
                    }
                    _propertyIds         = _propertyIds.TrimEnd(',');
                    favList              = dao.GetUserFavouriteProperties(userID, _propertyIds, Constants.propertyEnabled);
                    Repeater1.DataSource = favList;
                    Repeater1.DataBind();
                }
                else
                {
                    Response.Redirect("Login.aspx");
                }
            }
            catch (Exception)
            {
                Console.Write("error");
            }
        }