protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["xx"] != null) { xx = Convert.ToInt32(Request.QueryString["xx"]); } //进入页面后 首先加载出第一个单词的信息 if (xx < 2) { if (Session["ID"] != null) { if (Session["c_id"] == null) { Session["c_id"] = 1; } UserCollect_Bll uc_b = new UserCollect_Bll(); UserCollect uc = new UserCollect(); uc = uc_b.GetUserCollect(Convert.ToInt32(Session["ID"])); GetCourseID = uc.C_ID; CourseDetail_Bll cd_b = new CourseDetail_Bll(); CourseDetails cd = new CourseDetails(); cd = cd_b.QueryCourseDetails1(GetCourseID); Session["c_id"] = GetCourseID; Words_ID = cd.CD_ID; xx = Words_ID; Session["cd_id"] = Words_ID; Words_name = cd.CD_NAME; Learning_Words.Text = Words_name; Learning_Words_Sentence.Text = cd.CD_SENEng; Pic_1.ImageUrl = "getpic1.aspx?cd_id=" + Words_ID; Pic_2.ImageUrl = "getpic2.aspx?cd_id=" + Words_ID; Pic_3.ImageUrl = "getpic3.aspx?cd_id=" + Words_ID; Pic_4.ImageUrl = "getpic4.aspx?cd_id=" + Words_ID; } } else { UserCollect_Bll uc_b = new UserCollect_Bll(); UserCollect uc = new UserCollect(); uc = uc_b.GetUserCollect(Convert.ToInt32(Session["ID"])); GetCourseID = uc.C_ID; CourseDetail_Bll cd_b = new CourseDetail_Bll(); CourseDetails cd = new CourseDetails(); cd = cd_b.QueryCourseDetails1(GetCourseID, xx); Session["c_id"] = GetCourseID; Words_ID = cd.CD_ID; Session["cd_id"] = Words_ID; Words_name = cd.CD_NAME; Learning_Words.Text = Words_name; Learning_Words_Sentence.Text = cd.CD_SENEng; Pic_1.ImageUrl = "getpic1.aspx?cd_id=" + Words_ID; Pic_2.ImageUrl = "getpic2.aspx?cd_id=" + Words_ID; Pic_3.ImageUrl = "getpic3.aspx?cd_id=" + Words_ID; Pic_4.ImageUrl = "getpic4.aspx?cd_id=" + Words_ID; } }
public void Bind() { UserCollect_Bll uc_b = new UserCollect_Bll(); DateTime now = DateTime.Now.Date; DateTime myregistertime = DateTime.Parse(uc_b.GetUserCollectByUIDandCID(u_id, c_id).UC_EndDay.ToString()).Date; TimeSpan ts = myregistertime.Subtract(now);//计算开始时间到结束时间天数差 int t1 = ts.Days; // int t2 =Convert.ToInt32( BCZ.BLL.UserCollectBusiness.GetUserCollectByUIDandCID(u_id,c_id).uc_Days.ToString()); lab_view_days.Text = t1.ToString(); }
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; } }
public void Bind() { UserCollect_Bll uc_b = new UserCollect_Bll(); Coures_Bll cb = new Coures_Bll(); DateTime now = DateTime.Now.Date; DateTime myregistertime = DateTime.Parse(myRegisterTime.Text.Trim()).Date; TimeSpan ts = myregistertime.Subtract(now);//计算开始时间到结束时间天数差 days = ts.Days; daycount = Convert.ToInt32(uc_b.GetUserCollectByUIDandCID(u_id, c_id).UC_EveWord.ToString()); if (days > 0) { daycount = Convert.ToInt32(cb.GetCourse(c_id).C_vocabulary.ToString()) / days; } lab_words.Text = daycount.ToString();//总单词数除以天数得到每天单词数 }
/// <summary> /// 登录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { try { Users u = new Users(); u.U_NAME = txt_Name.Text.Trim(); u.U_PASSWORD = txt_psd.Text.Trim(); //判断用户是否进行了输入 if (IfInput(u.U_NAME, u.U_PASSWORD)) { bool b = ub.ExistsUsers(u); if (b) { UserCollect_Bll uc_b = new UserCollect_Bll(); Response.Cookies["name"].Value = txt_Name.Text.Trim(); Session["ID"] = ub.QueryUserID(u).ToString(); u_id = Convert.ToInt32(Session["ID"].ToString()); Session["c_id"] = uc_b.GetUserCollectUid(u_id).C_ID.ToString();//与数据库中数据进行对比 Response.Write("<script>alert('登录成功');</script>"); if (Convert.ToInt32(Session["c_id"]) == 0) { Response.Redirect("Plan/Select.aspx", false); } else { Response.Redirect("Recite Words/start.aspx", false); } } else { Response.Write("<script>alert('登录失败');</script>"); } } } catch { } }
protected void img_but_Click(object sender, ImageClickEventArgs e) { UserCollect_Bll uc_b = new UserCollect_Bll(); UserDownload_Bll ud_d = new UserDownload_Bll(); if (dl_Customer.SelectedIndex != null) { p = Convert.ToInt32(uc_b.GetUserCollectByUID(u_id).UC_ID.ToString()); if (p > 0) { //修改计划 UserCollect updatuc = new UserCollect(); updatuc.U_ID = u_id; updatuc.C_ID = c_id; updatuc.UC_StartDay = DateTime.Now; updatuc.UC_EndDay = Convert.ToDateTime(myRegisterTime.Text); updatuc.UC_ComDay = Convert.ToInt32(days); updatuc.UC_EveWord = daycount; //Response.Write("<script>alert('" + p + "')</script>"); bool flag = uc_b.ModifyUserCollectbyuid(updatuc); if (flag) { Response.Write("<script>alert('修改计划成功')</script>"); #region //向动态表添加用户动态数据 UserDownload ud = new UserDownload(); //if (BCZ.BLL.UserNewsBusiness.AddUserNews(usernews)) //{ //} #endregion Session["c_id"] = c_id;//获取单词包id用于传值 Response.Write("<script>window.top.location='../Recite Words/start.aspx'</script>"); } else { Response.Write("<script>alert('修改计划不成功')</script>"); } } else { //添加计划 UserCollect adduc = new UserCollect(); adduc.U_ID = u_id; adduc.C_ID = c_id; adduc.UC_StartDay = DateTime.Now; adduc.UC_EndDay = Convert.ToDateTime(myRegisterTime.Text); adduc.UC_ComDay = Convert.ToInt32(days); adduc.UC_EveWord = daycount; if (uc_b.AddUserCollect(adduc)) { Response.Write("<script>alert('添加计划成功')</script>"); #region //向用户进度表添加数据 //UserDownload ud = new UserDownload(); //ud. //string str = "今天我添加了" + BCZ.BLL.CourseBusiness.GetCourse(c_id).c_Name + "的计划"; //usernews.un_Content = str; //usernews.un_PublishTime = DateTime.Now.ToString(); //usernews.u_Id = u_id; //if (BCZ.BLL.UserNewsBusiness.AddUserNews(usernews)) //{ //} #endregion Session["c_id"] = c_id;//获取单词包id用于传值 //Response.Redirect("../Recite Words/start.aspx", true); Response.Write("<script>window.top.location='../Recite Words/start.aspx'</script>"); } else { Response.Write("<script>alert('添加计划不成功')</script>"); } } } }