Example #1
0
        public static int u_id; //用户ID
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                UserCollect_Bll uc_b = new UserCollect_Bll();
                Coures_Bll      cb   = new Coures_Bll();

                Button1.Attributes.Add("onmouseout", "this.src='Images/index_btn.png'");
                Button1.Attributes.Add("onmouseover", "this.src='Images/index_btn_hover.png'");

                u_id = Convert.ToInt32(Session["ID"].ToString());
                UserCollect uc = new UserCollect();
                uc   = uc_b.GetUserCollect(u_id);
                c_id = uc.C_ID;
                //Response.Write("<script>alert('" + c_id + "')</script>");

                lab_view.Text = cb.GetCourse(c_id).C_NAME.ToString();
                lab_view.DataBind(); //获取单词包名称

                Bind();              //剩余天数

                UserDownload     ud   = new UserDownload();
                UserDownload_Bll ud_b = new UserDownload_Bll();
                int count             = ud_b.GetCount(Convert.ToInt32(Session["ID"]), c_id);
                lab_view_finish.Text = count.ToString();
                lab_view_finish.DataBind();//完成单词数

                lab_view_number.Text = cb.GetCourse(c_id).C_vocabulary.ToString();
                lab_view_number.DataBind();//该单词包的总单词数

                DateTime now = DateTime.Now.Date;
                DateTime ts  = DateTime.Parse(uc_b.GetUserCollectUid(u_id).UC_StartDay.ToString()).Date;
                TimeSpan t1  = ts.Subtract(now);  //计算开始时间到结束时间天数差
                TimeSpan t2  = now.Subtract(now); //计算开始时间到结束时间天数差

                lab_xinxue.Text = "0";
                //if(t1!=t2)
                //{
                //    lab_xinxue.Text = "0";
                //}
                //else
                //{
                //    lab_xinxue.Text = Convert.ToString(Session["xinxue"].ToString());
                //}
                //获取今日新目标
                lab_view_words.Text = uc_b.GetUserCollectUid(u_id).UC_EveWord.ToString();
                lab_view_words.DataBind();//获取今日目标

                Users_Bll ub = new Users_Bll();
                Users     u  = new Users();
                u             = ub.GetUser(Convert.ToInt32(Session["ID"]));
                Lab_name.Text = u.U_NAME;
            }
        }