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; } }
protected void dl_Customer_ItemCommand(object source, DataListCommandEventArgs e) { Coures_Bll cb = new Coures_Bll(); c_id = int.Parse(e.Item.ItemIndex.ToString()) + 1; lab_words.Text = cb.GetCourse(c_id).C_vocabulary.ToString(); lab_words.DataBind(); //myRegisterTime.Text = uc_b.GetUserCollectByUIDandCID(u_id, c_id).UC_EndDay.ToString(); //myRegisterTime.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Coures_Bll cb = new Coures_Bll(); if (!Page.IsPostBack) { dl_Customer.DataSource = cb.QueryCouresAll(); dl_Customer.DataBind();//获取单词包名字和数量 myRegisterTime.Attributes.Add("onfocus", "javascript:myclick()"); } img_but.Attributes.Add("onmouseout", "this.src='images/set_btn.png'"); img_but.Attributes.Add("onmouseover", "this.src='images/set_btn_hover.png'"); u_id = Convert.ToInt32(Session["ID"].ToString()); }
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();//总单词数除以天数得到每天单词数 }
private void button1_Click(object sender, EventArgs e) { try { Coures c = new Coures(); if (textBox3.Text == null) { MessageBox.Show("单词包名称不能为空"); return; } else if (textBox4.Text == null) { MessageBox.Show("单词本英语个数不能为空"); return; } else { CourseContentType cct = new CourseContentType(); cct.CCT_NAME = comboBox1.Text.Trim(); CourseContentType_Bll cct_b = new CourseContentType_Bll(); int id = Convert.ToInt32(cct_b.QueryCourseContTypeID(cct)); c.C_NAME = textBox3.Text.Trim(); c.CCT_ID = id; c.C_vocabulary = Convert.ToInt32(textBox4.Text.ToString()); c.C_RELEASEDATE = DateTime.Now.ToString(); } Coures_Bll cb = new Coures_Bll(); int i = cb.AddCourses(c); if (i > 0) { MessageBox.Show("添加成功!"); } else { MessageBox.Show("添加失败!"); } } catch { MessageBox.Show("出现异常"); Close(); } }
private void button2_Click(object sender, EventArgs e) { try { if (comboBox1.Text == null) { MessageBox.Show("单词包类型不为空"); return; } if (textBox2.Text == null) { MessageBox.Show("单词名称不可为空"); return; } if (textBox3.Text == null) { MessageBox.Show("单词音标不可为空"); return; } if (textBox4.Text == null) { MessageBox.Show("单词释义不可为空"); return; } if (textBox5.Text == null) { MessageBox.Show("英文例句不可为空"); return; } if (textBox6.Text == null) { MessageBox.Show("中文例句不可为空"); return; } if (pictureBox1.Image == null) { MessageBox.Show("请选择单词正确图片"); return; } if (pictureBox2.Image == null) { MessageBox.Show("请选择单词错误图片1"); return; } if (pictureBox3.Image == null) { MessageBox.Show("请选择单词错误图片2"); return; } if (pictureBox4.Image == null) { MessageBox.Show("请选择单词错误图片3"); return; } else { Coures c = new Coures(); c.C_NAME = comboBox1.Text.Trim(); Coures_Bll cb = new Coures_Bll(); int id = Convert.ToInt32(cb.QueryCouresID(c)); cd.C_ID = id; cd.CD_NAME = textBox2.Text.Trim(); cd.CD_YINBIAO = textBox3.Text.Trim(); cd.CD_Mean = textBox4.Text.Trim(); cd.CD_SENEng = textBox5.Text.Trim(); cd.CD_SENChi = textBox6.Text.Trim(); cd.CD_VIDEO = textBox7.Text.Trim(); } CourseDetail_Bll cdb = new CourseDetail_Bll(); int i = cdb.AddCoursesDetails(cd); if (i > 0) { MessageBox.Show("添加成功"); } else { MessageBox.Show("添加失败"); } } catch { MessageBox.Show("添加异常"); } }