Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int          ProjectId    = int.Parse(Request.QueryString["Id"]);
            int          UserId       = int.Parse(((Session["user"] as User).Id).ToString());
            LikesManager likesManager = new LikesManager();

            Model.Likes likes = likesManager.GetModelByUserIdAndProjectId(UserId, ProjectId);
            //判断用户是否关注有该项目
            if (likes == null)
            {
                this.like.Text = "关注";
            }
            else
            {
                this.like.Text = "取消关注";
            }
            //获取项目数据
            ProjectManager projectManager = new ProjectManager();

            project = projectManager.GetModel(ProjectId);
            UserManager userManager = new UserManager();

            User = userManager.GetModel(project.OwnerId);
            SupportProject supportProject = new SupportProject();
            //获取评论
            CommentManager commentManager = new CommentManager();

            this.RepeaterComment.DataSource = commentManager.GetModelLinkUsers(UserId, ProjectId);
            this.RepeaterComment.DataBind();
            //获取回报内容
            Session["Return"]       = project.Return;
            Session["ReturnMiddle"] = project.ReturnMiddle;
            Session["ReturnMax"]    = project.ReturnMax;
            Session["ReturnTime"]   = project.ReturnTime;
            Session["Freight"]      = project.Freight;
            //获取支持者
            CalculationManager calculationManager = new CalculationManager();

            Session["Small"]          = calculationManager.CountSupportPeopleSmall(ProjectId);
            Session["Middle"]         = calculationManager.CountSupportPeopleMiddle(ProjectId);
            Session["Max"]            = calculationManager.CountSupportPeopleMax(ProjectId);
            Session["CountOfSupport"] = calculationManager.CountSupportWhereProjectId(ProjectId);
        }