//显示单词的方法 public void CourseDetails_Show() { Lv1.Items.Clear(); CourseDetail_Bll cb = new CourseDetail_Bll(); List <CourseDetails> c = new List <CourseDetails>(); c = cb.GetAll(); foreach (CourseDetails cc in c) { ListViewItem tt = new ListViewItem(cc.CD_ID.ToString()); Image im = GetPicture(cc.CD_RIGHT_PIC); Image im2 = GetPicture(cc.CD_WRONG_PIC1); Image im3 = GetPicture(cc.CD_WRONG_PIC2); Image im4 = GetPicture(cc.CD_WRONG_PIC3); Lv1.SmallImageList = imageList1; this.imageList1.Images.Add(im); this.imageList1.Images.Add(im2); this.imageList1.Images.Add(im3); this.imageList1.Images.Add(im4); tt.SubItems.Add(cc.CD_NAME.ToString()); tt.SubItems.Add(cc.CD_YINBIAO.ToString()); tt.SubItems.Add(cc.CD_Mean.ToString()); tt.SubItems.Add(cc.CD_SENEng.ToString()); Lv1.Items.Add(tt); } }
private void Manager_Load(object sender, EventArgs e) { timer1.Start();//动态显示时间 CourseDetail_Bll cd_b = new CourseDetail_Bll(); toolStripStatusLabel2.Text = cd_b.GetCount().ToString(); }
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; } }
private void toolStripButton1_Click(object sender, EventArgs e) { int id = Convert.ToInt32(Lv1.SelectedItems[0].Text); CourseDetail_Bll cb = new CourseDetail_Bll(); int d = cb.DeleteByid(id); if (d > 0) { MessageBox.Show("删除成功"); CourseDetails_Show(); } else { MessageBox.Show("删除失败"); } }
//显示图片 private void Lv1_Click(object sender, EventArgs e) { int id = Convert.ToInt32(Lv1.SelectedItems[0].Text); //RepastBLL.wordsManager w = new RepastBLL.wordsManager(); CourseDetail_Bll cb = new CourseDetail_Bll(); //RepastModel.Coursedetails ccc = w.picbyid(id); CourseDetails c = new CourseDetails(); c = cb.GetPicById(id); Image pic1 = GetPicture(c.CD_RIGHT_PIC); Image pic2 = GetPicture(c.CD_WRONG_PIC1); Image pic3 = GetPicture(c.CD_WRONG_PIC2); Image pic4 = GetPicture(c.CD_WRONG_PIC3); pictureBox1.Image = pic1; pictureBox2.Image = pic2; pictureBox3.Image = pic3; pictureBox4.Image = pic4; }
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("添加异常"); } }