Exemplo n.º 1
0
    protected void UnLike(object sender, EventArgs e)
    {
        LikeBusiness lb  = new LikeBusiness();
        ModernButton btn = (ModernButton)sender;

        string[]    ids         = btn.ID.Split('_');
        RegularUser regularUser = new RegularUser();

        regularUser.UserId = Int32.Parse(ids[0]);

        Hike hike = new Hike();

        hike.HikeId = Int32.Parse(ids[1]);

        Tuple <int, string> t = new Tuple <int, string>(0, "");

        t = lb.removeLike(regularUser, hike);

        Notification n = new Notification();

        n.Type    = t.Item1;
        n.Message = t.Item2;
        Session["NOTIFICATION"] = n;
        Response.Redirect("Notifications.aspx");
        //Response.Redirect("Wall.aspx");
    }
Exemplo n.º 2
0
    private void DisplayHike(RegularUser ru, Hike h, int id, int userId)
    {
        System.Web.UI.HtmlControls.HtmlGenericControl divContainerRow =
            new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
        divContainerRow.Attributes["class"] = "row";

        System.Web.UI.HtmlControls.HtmlGenericControl divContainerCol =
            new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
        divContainerCol.Attributes["class"] = "col-lg-12";

        System.Web.UI.HtmlControls.HtmlGenericControl divContainerPanelDefault =
            new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
        divContainerPanelDefault.Attributes["class"] = "panel panel-default";

        System.Web.UI.HtmlControls.HtmlGenericControl divContainerPanelHeading =
            new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
        divContainerPanelHeading.Attributes["class"] = "panel-heading";

        System.Web.UI.HtmlControls.HtmlGenericControl icon =
            new System.Web.UI.HtmlControls.HtmlGenericControl("i");
        icon.Attributes["class"] = "fa fa-road fa-fw";

        Label labelTitle = new Label();

        labelTitle.Text = "Caminata";

        System.Web.UI.HtmlControls.HtmlGenericControl divContainerPanelBody =
            new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
        divContainerPanelBody.Attributes["class"] = "panel-body";

        System.Web.UI.HtmlControls.HtmlGenericControl divContainerPanelBodyUser =
            new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
        divContainerPanelBodyUser.Attributes["class"] = "panel-group";

        System.Web.UI.HtmlControls.HtmlGenericControl horizontalLine =
            new System.Web.UI.HtmlControls.HtmlGenericControl("hr");

        System.Web.UI.HtmlControls.HtmlGenericControl divContainerPanelBodyAccordion =
            new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
        divContainerPanelBodyAccordion.Attributes["class"] = "panel-group";
        divContainerPanelBodyAccordion.Attributes["id"]    = "accordion_" + id.ToString();

        System.Web.UI.HtmlControls.HtmlGenericControl divContainerPanelFooter =
            new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
        divContainerPanelFooter.Attributes["class"] = "panel-footer";

        System.Web.UI.HtmlControls.HtmlGenericControl divContainerPanelFooterText =
            new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
        divContainerPanelFooterText.Attributes["class"] = "text-center";

        //Structure

        //divContainerPanelHeading
        divContainerPanelHeading.Controls.Add(icon);
        divContainerPanelHeading.Controls.Add(labelTitle);
        //divContainerPanelBody
        divContainerPanelBodyUser.Controls.Add(DisplayFriend(ru, id));
        divContainerPanelBodyAccordion.Controls.Add(DisplayHikeStart(h, id));

        List <Point> SortedList = h.Route.ListOfPoints.OrderBy(o => o.Pos).ToList();
        int          i          = 0;

        foreach (Point p in SortedList)
        {
            divContainerPanelBodyAccordion.Controls.Add(DisplayHikeRoute(p, id, i));
            ++i;
        }
        divContainerPanelBody.Controls.Add(divContainerPanelBodyUser);
        divContainerPanelBody.Controls.Add(horizontalLine);
        divContainerPanelBody.Controls.Add(divContainerPanelBodyAccordion);
        //divContainerPanelFooter
        LikeBusiness lb             = new LikeBusiness();
        RegularUser  oldregularUser = new RegularUser();

        oldregularUser.UserId = userId;
        if (lb.getLikeStatus(oldregularUser, h))
        {
            divContainerPanelFooterText.Controls.Add(addButton(userId, h, 1));
        }
        else
        {
            divContainerPanelFooterText.Controls.Add(addButton(userId, h, 0));
        }

        divContainerPanelFooter.Controls.Add(divContainerPanelFooterText);

        //divContainerPanelDefault
        divContainerPanelDefault.Controls.Add(divContainerPanelHeading);
        divContainerPanelDefault.Controls.Add(divContainerPanelBody);
        divContainerPanelDefault.Controls.Add(divContainerPanelFooter);

        divContainerCol.Controls.Add(divContainerPanelDefault);
        divContainerRow.Controls.Add(divContainerCol);
        rowContainer.Controls.Add(divContainerRow);
    }