private void DCB_Add_Load(object sender, EventArgs e) { CourseContentType_Bll cct_b = new CourseContentType_Bll(); List <CourseContentType> c = cct_b.QueryCourseContentTypeAll(); comboBox1.DataSource = c; comboBox1.DisplayMember = "CCT_NAME"; comboBox1.Text = ""; }
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 button1_Click(object sender, EventArgs e) { try { CourseContentType cct = new CourseContentType(); //if (textBox1.Text == null) //{ // MessageBox.Show("单词包类型ID不可为空"); // return; //} if (textBox2.Text == null) { MessageBox.Show("单词包类型名称不可为空"); return; } else { //cct.CCT_ID = Convert.ToInt32(textBox1.Text.Trim()); cct.CCT_NAME = textBox2.Text.Trim(); cct.CCT_DESC = textBox3.Text.Trim(); } CourseContentType_Bll cctb = new CourseContentType_Bll(); int i = cctb.AddCourseContentType(cct); if (i > 0) { MessageBox.Show("添加成功"); } else { MessageBox.Show("添加失败"); } } catch { MessageBox.Show("添加异常"); } }