protected void Page_Load(object sender, EventArgs e)
        {
            ddResearchRefer.Enabled = CheckBox1.Checked;

            CarryWorkCalculate cwcl = new CarryWorkCalculate(HttpContext.Current.User.Identity.Name);

            GridView1.DataSource = cwcl.Research().ToList();
            GridView1.DataBind();

            Label1.Text = cwcl.SumOfResearch_Main().ToString();

            ResearchDataContext tcd = new ResearchDataContext();
            GridView2.DataSource = cwcl.Research_Article().ToList();
            GridView2.DataBind();

            Label2.Text = cwcl.SumOfResearch_Article().ToString();

            Label3.Text = cwcl.SumOfResearch().ToString();
        }
        public IQueryable<ArticleClass> Research_Article()
        {
            // Create ResearchDataContext
            ResearchDataContext tcd = new ResearchDataContext();

            var q = from p in tcd.Articles
                    join r in tcd.Researches
                    on p.ResearchId equals r.ResearchId into joined
                    from j in joined.DefaultIfEmpty()
                    from s in tcd.PublishTypes
                    where p.UserName == username
                    where p.DurationId == durationId
                    where p.PublishTypeId == s.PublishTypeId
                    select new ArticleClass()
                    {
                        ArticleName = p.ArticleName,
                        UserName = p.UserName,
                        PublishTypeId = p.PublishTypeId,
                        ResearchId = p.ResearchId == null ? null : p.ResearchId,
                        PercentOfWork = j.PercentWork == null ? "Null" : j.PercentWork.ToString(),
                        IsHeader = j.IsHeader == null ? "Null" : j.IsHeader.ToString(),
                        ResearchName = j.ResearchName,
                        PublishType = s.PublishType1,
                        ArticleId = p.ArticleId
                    };

            return q;
        }
        //===================================== Reseaching ===============================================
        public IQueryable<ResearchClass> Research()
        {
            // Create TeachDirect
            ResearchDataContext tcd = new ResearchDataContext();

            // TeachingDirectTable
            var q = from p in tcd.Researches
                    where p.UserName == username
                    where p.DurationId == durationId
                    select new ResearchClass()
                                      {
                                          ResearchId = p.ResearchId,
                                          ResearchName = p.ResearchName,
                                          UserName = p.UserName,
                                          IsHeader = Convert.ToBoolean(p.IsHeader),
                                          PercentWork = Convert.ToDouble(p.PercentWork)
                                      };

            return q;
        }