Exemplo n.º 1
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            int userId = Convert.ToInt32(Session["UserId"]);
            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            int status = 0;
            switch (HiddenFieldMode.Value.ToLower())
              {
                    case "firstname":
                        status = ups.firstName(userId, TextBoxFirstName.Text);
                        break;
                    case "lastname":
                        status = ups.lastName(userId, TextBoxLastName.Text);
                        break;
                    case "username":
                        //-1 exists before -2 username not valid -3 no special char -4 enter username 1 successful
                        status = ups.username(userId, TextBoxUsername.Text);
                        HiddenFieldStatus.Value = status.ToString();
                        if (status != 1)
                        {
                            Classes.UserInfo ui = new Classes.UserInfo();
                            TextBoxUsername.Text = ui.getUsernameByUserId(userId);
                        }
                        break;
                    case "gender":
                        status = ups.gender(userId, Convert.ToInt16(DropDownListGender.SelectedValue));
                        break;
                    case "dob":
                        status = ups.birthDate(userId, HiddenFieldDOB.Value);
                        break;
                    case "about":
                        status = ups.about(userId, TextBoxAbout.Text);
                        break;
                    case "photo":
                        bool hasPhoto = Convert.ToBoolean(HiddenFieldValue.Value);
                        status = ups.hasPhoto(userId, hasPhoto);
                        break;
                    case "cover":
                        status = ups.cover(userId, Convert.ToInt16(HiddenFieldValue.Value));
                        break;
                    case "location":
                        status = ups.location(userId, Convert.ToInt32(HiddenFieldLocationId.Value));

                        Classes.Locations l = new Classes.Locations();
                        DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(DropDownListCity.SelectedValue));
                        if (dtLocation.Rows.Count == 0)
                        {
                            LabelLocation.Text = "Not Available!";
                        }
                        else
                        {
                            LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString();
                        }
                        break;
                    case "notifications":
                        bool getNotifications = Convert.ToBoolean(HiddenFieldNotifications.Value);
                        status = ups.notifications(userId, getNotifications);
                        break;
                    case "mobile":
                        status = ups.mobile(userId, Convert.ToInt64(TextBoxMobile.Text));
                        break;

               }
        }
Exemplo n.º 2
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            int userId = Convert.ToInt32(Session["UserId"]);

            Classes.UserProfileSet ups = new Classes.UserProfileSet();
            int status = 0;

            switch (HiddenFieldMode.Value.ToLower())
            {
            case "firstname":
                status = ups.firstName(userId, TextBoxFirstName.Text);
                break;

            case "lastname":
                status = ups.lastName(userId, TextBoxLastName.Text);
                break;

            case "username":
                //-1 exists before -2 username not valid -3 no special char -4 enter username 1 successful
                status = ups.username(userId, TextBoxUsername.Text);
                HiddenFieldStatus.Value = status.ToString();
                if (status != 1)
                {
                    Classes.UserInfo ui = new Classes.UserInfo();
                    TextBoxUsername.Text = ui.getUsernameByUserId(userId);
                }
                break;

            case "gender":
                status = ups.gender(userId, Convert.ToInt16(DropDownListGender.SelectedValue));
                break;

            case "dob":
                status = ups.birthDate(userId, HiddenFieldDOB.Value);
                break;

            case "about":
                status = ups.about(userId, TextBoxAbout.Text);
                break;

            case "photo":
                bool hasPhoto = Convert.ToBoolean(HiddenFieldValue.Value);
                status = ups.hasPhoto(userId, hasPhoto);
                break;

            case "cover":
                status = ups.cover(userId, Convert.ToInt16(HiddenFieldValue.Value));
                break;

            case "location":
                status = ups.location(userId, Convert.ToInt32(HiddenFieldLocationId.Value));

                Classes.Locations l          = new Classes.Locations();
                DataTable         dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(DropDownListCity.SelectedValue));
                if (dtLocation.Rows.Count == 0)
                {
                    LabelLocation.Text = "Not Available!";
                }
                else
                {
                    LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString();
                }
                break;

            case "notifications":
                bool getNotifications = Convert.ToBoolean(HiddenFieldNotifications.Value);
                status = ups.notifications(userId, getNotifications);
                break;

            case "mobile":
                status = ups.mobile(userId, Convert.ToInt64(TextBoxMobile.Text));
                break;
            }
        }
Exemplo n.º 3
0
        protected void getDataLocation()
        {
            hidePanels();
            PanelLocation.Visible = true;

            DataTable dt = new DataTable();
            DataSet ds = new DataSet();
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
            SqlDataAdapter sda = new SqlDataAdapter("sp_settingsLocationGet", sqlConn);
            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);

            //try
            //{
                sda.Fill(ds);
                dt = ds.Tables[0];
            //}
            //catch (Exception ex)
            //{

            //}
            //finally
            //{
                sqlConn.Close();
                sda.Dispose();
                sqlConn.Dispose();
            //}

            if (dt.Rows.Count == 0)// Profile doesn't exist
            {
                Response.Redirect("~/Error/NoProfileForSettings");
            }
            else
            {
                if (!IsPostBack)
                {
                    Classes.Locations l = new Classes.Locations();
                    DataTable dtCountries = l.countriesList();

                    List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                    DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                    for (int i = 0; i < dtCountries.Rows.Count; i++)
                    {
                        DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString()));
                    }

                    Classes.UserInfo ui = new Classes.UserInfo();
                    int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                    if (locationId == 0)
                    {
                        DropDownListCountry.SelectedValue = "0";
                    }
                    else
                    {
                        string countryCode = l.locationInfoOnlyId(locationId);

                        locationCity(countryCode);
                        DropDownListCountry.SelectedValue = countryCode;
                        DropDownListCity.SelectedValue = locationId.ToString();
                    }

                    DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString();
                    }
                }

                if (dt.Rows[0]["LocationId"].ToString() == "0")
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString());
                    DataTable dtLocation = new DataTable();
                    DataSet dsLocation = new DataSet();
                    SqlConnection sqlConnLocation = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                    SqlDataAdapter sdaLocation = new SqlDataAdapter("sp_locationInfoOnlyId", sqlConnLocation);
                    sdaLocation.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sdaLocation.SelectCommand.Parameters.Add("@CityId", SqlDbType.Int).Value = cityId;

                    //try
                    //{
                        sdaLocation.Fill(dsLocation);
                        dtLocation = dsLocation.Tables[0];
                    //}
                    //catch (Exception ex)
                    //{

                    //}
                    //finally
                    //{
                        sqlConnLocation.Close();
                        sdaLocation.Dispose();
                        sqlConnLocation.Dispose();
                    //}

                    locationCity(dtLocation.Rows[0]["CountryCode"].ToString());
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryCode"].ToString();
                    DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString();
                }

            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Explore");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Explore");
                }
            }

            //check user status
            string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue))

            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int userStatus      = ui.getUserStatus(UserId);
                switch (userStatus)
                {
                case 1:
                    Session["DoneCompletion"] = "1";
                    break;

                case 0:
                case 4:
                    Response.Redirect("~/Completion");
                    break;

                case 2:
                    Response.Redirect("~/Error/UserDisabled");
                    break;

                case 3:
                    Response.Redirect("~/Error/UserDeactivated");
                    break;
                }
            }

            if (!IsPostBack)
            {
                Classes.Explore    ex     = new Classes.Explore();
                Tuple <int, Int64> result = ex.startRecommending(UserId);

                int   status  = result.Item1;
                Int64 eventId = result.Item2;

                if (status == 1)
                {
                    Classes.Events ev = new Classes.Events();
                    DataTable      dt = ev.eventInfo(eventId, UserId);

                    HiddenFieldStatus.Value = "1";

                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());
                    int participants          = Convert.ToInt32(dt.Rows[0]["Participants"].ToString());

                    HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString();
                    HiddenFieldEventId.Value = dt.Rows[0]["EventId"].ToString();
                    LabelEventName.Text      = dt.Rows[0]["Name"].ToString();
                    Page.Title                      = dt.Rows[0]["Name"].ToString();
                    HiddenFieldDate.Value           = dt.Rows[0]["Date"].ToString();
                    LabelParticipants.Text          = (participants + 1).ToString();
                    LabelParticipantsAvailable.Text = (participantsAvailable + 1).ToString();
                    LabelDescriptions.Text          = dt.Rows[0]["Descriptions"].ToString();
                    LabelAddress.Text               = dt.Rows[0]["Address"].ToString();
                    HiddenFieldUsername.Value       = dt.Rows[0]["Username"].ToString();
                    HiddenFieldOwnerFullname.Value  = dt.Rows[0]["OwnerName"].ToString();
                    HiddenFieldTypeId.Value         = dt.Rows[0]["TypeId"].ToString();
                    HiddenFieldCoverId.Value        = dt.Rows[0]["CoverId"].ToString();
                    int OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString());

                    Classes.Locations l          = new Classes.Locations();
                    DataTable         dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CountryName"].ToString() + " - " + dtLocation.Rows[0]["CityName"].ToString();
                    }

                    //Owner photo url
                    if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString()))
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-100.jpg";
                    }
                    else
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Images/nophoto.png";
                    }
                    //owner rate
                    int RateCount      = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString());
                    int RateScore      = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString());
                    int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString());

                    if (RateCount >= RateSufficient)
                    {
                        int RatePercent = (20 * RateScore / RateCount);
                        HiddenFieldOwnerRateScore.Value = RatePercent.ToString();
                        HiddenFieldOwnerRateCount.Value = RateCount.ToString();
                    }
                    else
                    {
                        HiddenFieldOwnerRateScore.Value = "0";
                        HiddenFieldOwnerRateCount.Value = "0";
                    }

                    switch (dt.Rows[0]["Status"].ToString())
                    {
                    case "1":
                        LabelStatus.Text = "Available";
                        break;

                    case "2":
                        LabelStatus.Text = "Full";
                        break;

                    case "3":
                        LabelStatus.Text = "Passed";
                        break;
                    }

                    //bookmark
                    bool bookmarkStatus = ev.checkBookmark(UserId, eventId);

                    if (bookmarkStatus == true)
                    {
                        ButtonBookmark.Text = "Remove Bookmark";
                    }
                    else
                    {
                        ButtonBookmark.Text = "Add Bookmark";
                    }
                }
                else
                {
                    HiddenFieldStatus.Value      = "0";
                    HiddenFieldSmiley.Value      = ":)";
                    HiddenFieldMessage.Value     = "Unfortunatly there is no event to show now!";
                    HiddenFieldLinksNumber.Value = "4";

                    Classes.Done d = new Classes.Done();
                    Tuple <string, string, string, string> result2 = d.doneItem("A", "");
                    HiddenFieldLink1Text.Value  = result2.Item1;
                    HiddenFieldLink1Url.Value   = result2.Item2;
                    HiddenFieldLink1Image.Value = result2.Item3;
                    HiddenFieldLink1Color.Value = result2.Item4;

                    result2 = d.doneItem("B", "");
                    HiddenFieldLink2Text.Value  = result2.Item1;
                    HiddenFieldLink2Url.Value   = result2.Item2;
                    HiddenFieldLink2Image.Value = result2.Item3;
                    HiddenFieldLink2Color.Value = result2.Item4;

                    result2 = d.doneItem("C", "");
                    HiddenFieldLink3Text.Value  = result2.Item1;
                    HiddenFieldLink3Url.Value   = result2.Item2;
                    HiddenFieldLink3Image.Value = result2.Item3;
                    HiddenFieldLink3Color.Value = result2.Item4;

                    result2 = d.doneItem("E", "");
                    HiddenFieldLink4Text.Value  = result2.Item1;
                    HiddenFieldLink4Url.Value   = result2.Item2;
                    HiddenFieldLink4Image.Value = result2.Item3;
                    HiddenFieldLink4Color.Value = result2.Item4;
                }
            }
        }
Exemplo n.º 5
0
        protected void getDataLocation()
        {
            hidePanels();
            PanelLocation.Visible = true;

            DataTable      dt      = new DataTable();
            DataSet        ds      = new DataSet();
            SqlConnection  sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
            SqlDataAdapter sda     = new SqlDataAdapter("sp_settingsLocationGet", sqlConn);

            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);

            //try
            //{
            sda.Fill(ds);
            dt = ds.Tables[0];
            //}
            //catch (Exception ex)
            //{

            //}
            //finally
            //{
            sqlConn.Close();
            sda.Dispose();
            sqlConn.Dispose();
            //}

            if (dt.Rows.Count == 0)// Profile doesn't exist
            {
                Response.Redirect("~/Error/NoProfileForSettings");
            }
            else
            {
                if (!IsPostBack)
                {
                    Classes.Locations l           = new Classes.Locations();
                    DataTable         dtCountries = l.countriesList();

                    List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>();
                    DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                    for (int i = 0; i < dtCountries.Rows.Count; i++)
                    {
                        DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString()));
                    }

                    Classes.UserInfo ui = new Classes.UserInfo();
                    int locationId      = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                    if (locationId == 0)
                    {
                        DropDownListCountry.SelectedValue = "0";
                    }
                    else
                    {
                        string countryCode = l.locationInfoOnlyId(locationId);

                        locationCity(countryCode);
                        DropDownListCountry.SelectedValue = countryCode;
                        DropDownListCity.SelectedValue    = locationId.ToString();
                    }

                    DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString();
                    }
                }

                if (dt.Rows[0]["LocationId"].ToString() == "0")
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int            cityId          = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString());
                    DataTable      dtLocation      = new DataTable();
                    DataSet        dsLocation      = new DataSet();
                    SqlConnection  sqlConnLocation = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                    SqlDataAdapter sdaLocation     = new SqlDataAdapter("sp_locationInfoOnlyId", sqlConnLocation);
                    sdaLocation.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sdaLocation.SelectCommand.Parameters.Add("@CityId", SqlDbType.Int).Value = cityId;

                    //try
                    //{
                    sdaLocation.Fill(dsLocation);
                    dtLocation = dsLocation.Tables[0];
                    //}
                    //catch (Exception ex)
                    //{

                    //}
                    //finally
                    //{
                    sqlConnLocation.Close();
                    sdaLocation.Dispose();
                    sqlConnLocation.Dispose();
                    //}

                    locationCity(dtLocation.Rows[0]["CountryCode"].ToString());
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryCode"].ToString();
                    DropDownListCity.SelectedValue    = dt.Rows[0]["LocationId"].ToString();
                }
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check to see if the user logged in or is a guest
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login");
                }
            }

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable      dt = ev.eventInfo(Convert.ToInt32(Page.RouteData.Values["EventId"].ToString()), UserId);

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());

                    HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString();
                    LabelName.Text           = dt.Rows[0]["Name"].ToString();
                    Page.Title                      = dt.Rows[0]["Name"].ToString();
                    HiddenFieldDate.Value           = dt.Rows[0]["Date"].ToString();
                    HiddenFieldDuration.Value       = dt.Rows[0]["Duration"].ToString();
                    LabelParticipants.Text          = dt.Rows[0]["Participants"].ToString();
                    LabelParticipantsAvailable.Text = participantsAvailable.ToString();
                    LabelLanguages.Text             = dt.Rows[0]["Languages"].ToString(); //enhance
                    LabelDescriptions.Text          = dt.Rows[0]["Descriptions"].ToString();
                    HiddenFieldUsername.Value       = dt.Rows[0]["Username"].ToString();
                    HiddenFieldTypeId.Value         = dt.Rows[0]["TypeId"].ToString();
                    HiddenFieldCoverId.Value        = dt.Rows[0]["CoverId"].ToString();
                    int OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString());

                    Classes.Locations l          = new Classes.Locations();
                    DataTable         dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString() + " - " + dtLocation.Rows[0]["StateName"].ToString() + " - " + dtLocation.Rows[0]["CountryName"].ToString();
                    }

                    //Event photo url
                    //if (Convert.ToBoolean(dt.Rows[0]["EventHasPhoto"].ToString()))
                    //{
                    //    HiddenFieldEventPhotoUrl.Value = "Files/Events/" + Page.RouteData.Values["EventId"] + ".jpg";
                    //}
                    //else
                    //{
                    //    HiddenFieldEventPhotoUrl.Value = "Images/Moods/" + dt.Rows[0]["MoodId"].ToString() + "-big.png";
                    //}
                    //Owner photo url
                    if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString()))
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-220.jpg";
                    }
                    else
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Images/ProfilesPhotos/nophoto220.png";
                    }
                    //owner rate
                    int RateCount      = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString());
                    int RateScore      = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString());
                    int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString());

                    if (RateCount >= RateSufficient)
                    {
                        int RatePercent = (20 * RateScore / RateCount);
                        HiddenFieldOwnerRateScore.Value = RatePercent.ToString();
                        HiddenFieldOwnerRateCount.Value = RateCount.ToString();
                    }
                    else
                    {
                        HiddenFieldOwnerRateScore.Value = "0";
                        HiddenFieldOwnerRateCount.Value = "0";
                    }

                    switch (dt.Rows[0]["Status"].ToString())
                    {
                    case "1":
                        LabelStatus.Text = "Available";
                        break;

                    case "2":
                        LabelStatus.Text = "Full";
                        break;

                    case "3":
                        LabelStatus.Text = "Passed";
                        break;
                    }

                    //check to see if the user logged in or is a guest
                    if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString())
                    {
                        HyperLinkModify.Visible     = true;
                        HyperLinkModify.NavigateUrl = "~/Events/Modify/" + Page.RouteData.Values["EventId"].ToString();
                    }

                    //bookmark
                    int bookmarkStatus = ev.eventBookmark(UserId, Convert.ToInt64(Page.RouteData.Values["EventId"]));

                    if (bookmarkStatus == 1)
                    {
                        ButtonBookmark.Text = "Remove Bookmark";
                    }
                    else if (bookmarkStatus == 2)
                    {
                        ButtonBookmark.Text = "Add Bookmark";
                    }
                }


                ////////////////// participants list
                DataTable dtParticipants = ev.eventParticipants(Convert.ToInt32(Page.RouteData.Values["EventId"]));

                RepeaterParticipants.DataSource = dtParticipants;
                RepeaterParticipants.DataBind();

                if (RepeaterParticipants.Items.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }

                /////////////////////////////////////////////board messages
                getBoardMessages(Convert.ToInt64(Page.RouteData.Values["EventId"]), Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()));
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check to see if the user logged in or is a guest
            int UserId = 0;

            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0)
                    {
                        //Response.Redirect("~/Login");
                    }
                }
            }

            int buttonsStatus = 2; //0 guest 1 owner 2 user not requested 3 user requested 4 user participant
            int OwnerId       = -1;

            if (UserId == 0)
            {
                buttonsStatus = 0;
            }

            Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable      dt = ev.eventInfo(eventId, UserId);

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    int eventStatus = Convert.ToInt32(dt.Rows[0]["Status"].ToString());
                    if (eventStatus == 4)// event is banned
                    {
                        Response.Redirect("~/Error/EventNotFound");
                    }

                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());
                    int participants          = Convert.ToInt32(dt.Rows[0]["Participants"].ToString());

                    HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString();
                    HiddenFieldEventId.Value = Page.RouteData.Values["EventId"].ToString();
                    LabelName.Text           = dt.Rows[0]["Name"].ToString();
                    Page.Title                      = dt.Rows[0]["Name"].ToString();
                    HiddenFieldDate.Value           = dt.Rows[0]["Date"].ToString();
                    LabelParticipants.Text          = (participants + 1).ToString();
                    LabelParticipantsAvailable.Text = (participantsAvailable + 1).ToString();
                    LabelAddress.Text               = dt.Rows[0]["Address"].ToString();
                    LabelDescriptions.Text          = dt.Rows[0]["Descriptions"].ToString();
                    HiddenFieldUsername.Value       = dt.Rows[0]["Username"].ToString();
                    HiddenFieldOwnerFullname.Value  = dt.Rows[0]["OwnerName"].ToString();
                    HiddenFieldTypeId.Value         = dt.Rows[0]["TypeId"].ToString();
                    HiddenFieldCoverId.Value        = dt.Rows[0]["CoverId"].ToString();
                    OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString());

                    Classes.Locations l          = new Classes.Locations();
                    DataTable         dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CountryName"].ToString() + " - " + dtLocation.Rows[0]["CityName"].ToString();
                    }

                    //Owner photo url
                    if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString()))
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-100.jpg";
                    }
                    else
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Images/nophoto.png";
                    }
                    //owner rate
                    int RateCount      = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString());
                    int RateScore      = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString());
                    int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString());

                    if (RateCount >= RateSufficient)
                    {
                        int RatePercent = (20 * RateScore / RateCount);
                        HiddenFieldOwnerRateScore.Value = RatePercent.ToString();
                        HiddenFieldOwnerRateCount.Value = RateCount.ToString();
                    }
                    else
                    {
                        HiddenFieldOwnerRateScore.Value = "0";
                        HiddenFieldOwnerRateCount.Value = "0";
                    }

                    switch (dt.Rows[0]["Status"].ToString())
                    {
                    case "1":
                        LabelStatus.Text = "Available";
                        break;

                    case "2":
                        LabelStatus.Text = "Full";
                        break;

                    case "3":
                        LabelStatus.Text = "Passed";
                        break;
                    }

                    if (UserId != 0)
                    {
                        //check to see if the user logged in or is a guest
                        if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString())
                        {
                            HyperLinkModify.Visible     = true;
                            HyperLinkModify.NavigateUrl = "~/Events/Modify/" + eventId.ToString();
                            buttonsStatus = 1;
                        }

                        //bookmark
                        bool bookmarkStatus = ev.checkBookmark(UserId, eventId);

                        if (bookmarkStatus == true)
                        {
                            ButtonBookmark.Text = "Remove Bookmark";
                        }
                        else
                        {
                            ButtonBookmark.Text = "Add Bookmark";
                        }

                        HiddenFieldButtonStatus.Value = buttonsStatus.ToString();
                    }
                }

                ////////////////// participants list
                DataTable dtParticipants = ev.eventParticipants(eventId);

                RepeaterParticipants.DataSource = dtParticipants;
                RepeaterParticipants.DataBind();

                if (RepeaterParticipants.Items.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }

                /////////////////////////////////////////////board messages
                bool status = ev.allowBoard(UserId, eventId);

                if (status)
                {
                    getBoardMessages(eventId, Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()));
                    HiddenFieldBoardStatus.Value = "1";
                }
                else
                {
                    HiddenFieldBoardStatus.Value = "0";
                }
            }
            else
            {
                Page.Title = LabelName.Text;
            }

            if (UserId != 0)
            {
                if (UserId.ToString() == OwnerId.ToString())
                {
                    buttonsStatus = 1;
                }
                else
                {
                    Classes.Requests r = new Classes.Requests();
                    int requestStatus  = r.checkRequest(UserId, eventId);

                    if (requestStatus == 0)
                    {
                        buttonsStatus = 2;
                    }
                    else if (requestStatus == 1)
                    {
                        buttonsStatus = 3;
                    }
                    else if (requestStatus == 2)
                    {
                        buttonsStatus = 4;
                    }
                }
            }

            HiddenFieldRequestStatus.Value = buttonsStatus.ToString();
            HiddenFieldButtonStatus.Value  = buttonsStatus.ToString();
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check to see if the user logged in or is a guest
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login");
                }
            }

            if (!IsPostBack)
            {
                
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable dt = ev.eventInfo(Convert.ToInt32(Page.RouteData.Values["EventId"].ToString()), UserId);

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());

                    HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString();
                    LabelName.Text = dt.Rows[0]["Name"].ToString();
                    Page.Title = dt.Rows[0]["Name"].ToString();
                    HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString();
                    HiddenFieldDuration.Value = dt.Rows[0]["Duration"].ToString();
                    LabelParticipants.Text = dt.Rows[0]["Participants"].ToString();
                    LabelParticipantsAvailable.Text = participantsAvailable.ToString();
                    LabelLanguages.Text = dt.Rows[0]["Languages"].ToString(); //enhance
                    LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString();
                    HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString();
                    HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString();
                    HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString();
                    int OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString());

                    Classes.Locations l = new Classes.Locations();
                    DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString() + " - " + dtLocation.Rows[0]["StateName"].ToString() + " - " + dtLocation.Rows[0]["CountryName"].ToString();
                    }

                    //Event photo url
                    //if (Convert.ToBoolean(dt.Rows[0]["EventHasPhoto"].ToString()))
                    //{
                    //    HiddenFieldEventPhotoUrl.Value = "Files/Events/" + Page.RouteData.Values["EventId"] + ".jpg";
                    //}
                    //else
                    //{
                    //    HiddenFieldEventPhotoUrl.Value = "Images/Moods/" + dt.Rows[0]["MoodId"].ToString() + "-big.png";
                    //}
                    //Owner photo url
                    if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString()))
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-220.jpg";
                    }
                    else
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Images/ProfilesPhotos/nophoto220.png";
                    }
                    //owner rate
                    int RateCount = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString());
                    int RateScore = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString());
                    int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString());

                    if (RateCount >= RateSufficient)
                    {
                        int RatePercent = (20 * RateScore / RateCount);
                        HiddenFieldOwnerRateScore.Value = RatePercent.ToString();
                        HiddenFieldOwnerRateCount.Value = RateCount.ToString();
                    }
                    else
                    {
                        HiddenFieldOwnerRateScore.Value = "0";
                        HiddenFieldOwnerRateCount.Value = "0";
                    }

                    switch (dt.Rows[0]["Status"].ToString())
                    {
                        case "1":
                            LabelStatus.Text = "Available";
                            break;
                        case "2":
                            LabelStatus.Text = "Full";
                            break;
                        case "3":
                            LabelStatus.Text = "Passed";
                            break;
                    }

                    //check to see if the user logged in or is a guest
                    if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString())
                    {
                        HyperLinkModify.Visible = true;
                        HyperLinkModify.NavigateUrl = "~/Events/Modify/" + Page.RouteData.Values["EventId"].ToString();
                    }

                    //bookmark
                    int bookmarkStatus = ev.eventBookmark(UserId, Convert.ToInt64(Page.RouteData.Values["EventId"]));

                    if (bookmarkStatus == 1)
                    {
                        ButtonBookmark.Text = "Remove Bookmark";
                    }
                    else if (bookmarkStatus == 2)
                    {
                        ButtonBookmark.Text = "Add Bookmark";
                    }
                }


                ////////////////// participants list
                DataTable dtParticipants = ev.eventParticipants(Convert.ToInt32(Page.RouteData.Values["EventId"]));

                RepeaterParticipants.DataSource = dtParticipants;
                RepeaterParticipants.DataBind();

                if (RepeaterParticipants.Items.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }

                /////////////////////////////////////////////board messages
                getBoardMessages(Convert.ToInt64(Page.RouteData.Values["EventId"]), Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()));
            }
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check to see if the user logged in or is a guest
            int UserId = 0;
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0)
                    {
                        //Response.Redirect("~/Login");
                    }
                }
            }

            int buttonsStatus = 2; //0 guest 1 owner 2 user not requested 3 user requested 4 user participant
            int OwnerId = -1;
            if (UserId == 0)
            {
                buttonsStatus = 0;
            }

            Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString());

            if (!IsPostBack)
            {
                // get info
                Classes.Events ev = new Classes.Events();
                DataTable dt = ev.eventInfo(eventId, UserId);

                if (dt.Rows.Count == 0)// event doesn't exist
                {
                    Response.Redirect("~/Error/EventNotFound");
                }
                else
                {
                    int eventStatus = Convert.ToInt32(dt.Rows[0]["Status"].ToString());
                    if (eventStatus == 4)// event is banned
                    {
                        Response.Redirect("~/Error/EventNotFound");
                    }

                    //count available spots
                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());
                    int participants = Convert.ToInt32(dt.Rows[0]["Participants"].ToString());

                    HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString();
                    HiddenFieldEventId.Value = Page.RouteData.Values["EventId"].ToString();
                    LabelName.Text = dt.Rows[0]["Name"].ToString();
                    Page.Title = dt.Rows[0]["Name"].ToString();
                    HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString();
                    LabelParticipants.Text = (participants + 1).ToString();
                    LabelParticipantsAvailable.Text = (participantsAvailable + 1).ToString();
                    LabelAddress.Text = dt.Rows[0]["Address"].ToString();
                    LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString();
                    HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString();
                    HiddenFieldOwnerFullname.Value = dt.Rows[0]["OwnerName"].ToString();
                    HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString();
                    HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString();
                    OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString());

                    Classes.Locations l = new Classes.Locations();
                    DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CountryName"].ToString() + " - " + dtLocation.Rows[0]["CityName"].ToString();
                    }

                     //Owner photo url
                    if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString()))
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-100.jpg";
                    }
                    else
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Images/nophoto.png";
                    }
                    //owner rate
                    int RateCount = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString());
                    int RateScore = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString());
                    int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString());

                    if (RateCount >= RateSufficient)
                    {
                        int RatePercent = (20 * RateScore / RateCount);
                        HiddenFieldOwnerRateScore.Value = RatePercent.ToString();
                        HiddenFieldOwnerRateCount.Value = RateCount.ToString();
                    }
                    else
                    {
                        HiddenFieldOwnerRateScore.Value = "0";
                        HiddenFieldOwnerRateCount.Value = "0";
                    }

                    switch (dt.Rows[0]["Status"].ToString())
                    {
                        case "1":
                            LabelStatus.Text = "Available";
                            break;
                        case "2":
                            LabelStatus.Text = "Full";
                            break;
                        case "3":
                            LabelStatus.Text = "Passed";
                            break;
                    }

                    if (UserId != 0)
                    {
                        //check to see if the user logged in or is a guest
                        if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString())
                        {
                            HyperLinkModify.Visible = true;
                            HyperLinkModify.NavigateUrl = "~/Events/Modify/" + eventId.ToString();
                            buttonsStatus = 1;
                        }

                        //bookmark
                        bool bookmarkStatus = ev.checkBookmark(UserId, eventId);

                        if (bookmarkStatus == true)
                        {
                            ButtonBookmark.Text = "Remove Bookmark";
                        }
                        else
                        {
                            ButtonBookmark.Text = "Add Bookmark";
                        }

                        HiddenFieldButtonStatus.Value = buttonsStatus.ToString();
                    }
                }

                ////////////////// participants list
                DataTable dtParticipants = ev.eventParticipants(eventId);

                RepeaterParticipants.DataSource = dtParticipants;
                RepeaterParticipants.DataBind();

                if (RepeaterParticipants.Items.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }

                /////////////////////////////////////////////board messages
                bool status = ev.allowBoard(UserId, eventId);

                if (status)
                {
                    getBoardMessages(eventId, Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()));
                    HiddenFieldBoardStatus.Value = "1";
                }
                else
                {
                    HiddenFieldBoardStatus.Value = "0";
                }

            }
            else
            {
                Page.Title = LabelName.Text;
            }

            if (UserId != 0)
            {
                if (UserId.ToString() == OwnerId.ToString())
                {
                    buttonsStatus = 1;
                }
                else
                {
                    Classes.Requests r = new Classes.Requests();
                    int requestStatus = r.checkRequest(UserId, eventId);

                    if (requestStatus == 0)
                    {
                        buttonsStatus = 2;
                    }
                    else if (requestStatus == 1)
                    {
                        buttonsStatus = 3;
                    }
                    else if (requestStatus == 2)
                    {
                        buttonsStatus = 4;
                    }
                }
            }

            HiddenFieldRequestStatus.Value = buttonsStatus.ToString();
            HiddenFieldButtonStatus.Value = buttonsStatus.ToString();
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {

            //check login
            int UserId = 0;
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Explore");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Explore");
                }
            }

            //check user status
            string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue))
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int userStatus = ui.getUserStatus(UserId);
                switch (userStatus)
                {
                    case 1:
                        Session["DoneCompletion"] = "1";
                        break;
                    case 0:
                    case 4:
                        Response.Redirect("~/Completion");
                        break;
                    case 2:
                        Response.Redirect("~/Error/UserDisabled");
                        break;
                    case 3:
                        Response.Redirect("~/Error/UserDeactivated");
                        break;
                }
            }

            if (!IsPostBack)
            {
                Classes.Explore ex = new Classes.Explore();
                Tuple<int, Int64> result = ex.startRecommending(UserId);

                int status = result.Item1;
                Int64 eventId = result.Item2;

                if (status == 1)
                {
                    Classes.Events ev = new Classes.Events();
                    DataTable dt = ev.eventInfo(eventId, UserId);

                    HiddenFieldStatus.Value = "1";

                    int participantsAvailable = Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString());
                    int participants = Convert.ToInt32(dt.Rows[0]["Participants"].ToString());

                    HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString();
                    HiddenFieldEventId.Value = dt.Rows[0]["EventId"].ToString();
                    LabelEventName.Text = dt.Rows[0]["Name"].ToString();
                    Page.Title = dt.Rows[0]["Name"].ToString();
                    HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString();
                    LabelParticipants.Text = (participants + 1).ToString();
                    LabelParticipantsAvailable.Text = (participantsAvailable + 1).ToString();
                    LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString();
                    LabelAddress.Text = dt.Rows[0]["Address"].ToString();
                    HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString();
                    HiddenFieldOwnerFullname.Value = dt.Rows[0]["OwnerName"].ToString();
                    HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString();
                    HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString();
                    int OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString());

                    Classes.Locations l = new Classes.Locations();
                    DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CountryName"].ToString() + " - " + dtLocation.Rows[0]["CityName"].ToString();
                    }

                    //Owner photo url
                    if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString()))
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-100.jpg";
                    }
                    else
                    {
                        HiddenFieldOwnerPhotoUrl.Value = "Images/nophoto.png";
                    }
                    //owner rate
                    int RateCount = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString());
                    int RateScore = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString());
                    int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString());

                    if (RateCount >= RateSufficient)
                    {
                        int RatePercent = (20 * RateScore / RateCount);
                        HiddenFieldOwnerRateScore.Value = RatePercent.ToString();
                        HiddenFieldOwnerRateCount.Value = RateCount.ToString();
                    }
                    else
                    {
                        HiddenFieldOwnerRateScore.Value = "0";
                        HiddenFieldOwnerRateCount.Value = "0";
                    }

                    switch (dt.Rows[0]["Status"].ToString())
                    {
                        case "1":
                            LabelStatus.Text = "Available";
                            break;
                        case "2":
                            LabelStatus.Text = "Full";
                            break;
                        case "3":
                            LabelStatus.Text = "Passed";
                            break;
                    }

                    //bookmark
                    bool bookmarkStatus = ev.checkBookmark(UserId, eventId);

                    if (bookmarkStatus == true)
                    {
                        ButtonBookmark.Text = "Remove Bookmark";
                    }
                    else
                    {
                        ButtonBookmark.Text = "Add Bookmark";
                    }
                }
                else
                {
                    HiddenFieldStatus.Value = "0";
                    HiddenFieldSmiley.Value = ":)";
                    HiddenFieldMessage.Value = "Unfortunatly there is no event to show now!";
                    HiddenFieldLinksNumber.Value = "4";

                    Classes.Done d = new Classes.Done();
                    Tuple<string, string, string, string> result2 = d.doneItem("A", "");
                    HiddenFieldLink1Text.Value = result2.Item1;
                    HiddenFieldLink1Url.Value = result2.Item2;
                    HiddenFieldLink1Image.Value = result2.Item3;
                    HiddenFieldLink1Color.Value = result2.Item4;

                    result2 = d.doneItem("B", "");
                    HiddenFieldLink2Text.Value = result2.Item1;
                    HiddenFieldLink2Url.Value = result2.Item2;
                    HiddenFieldLink2Image.Value = result2.Item3;
                    HiddenFieldLink2Color.Value = result2.Item4;

                    result2 = d.doneItem("C", "");
                    HiddenFieldLink3Text.Value = result2.Item1;
                    HiddenFieldLink3Url.Value = result2.Item2;
                    HiddenFieldLink3Image.Value = result2.Item3;
                    HiddenFieldLink3Color.Value = result2.Item4;

                    result2 = d.doneItem("E", "");
                    HiddenFieldLink4Text.Value = result2.Item1;
                    HiddenFieldLink4Url.Value = result2.Item2;
                    HiddenFieldLink4Image.Value = result2.Item3;
                    HiddenFieldLink4Color.Value = result2.Item4;
                }
            }
        }