//修改单词包类型 public int UpdateCourseContentType(CourseContentType cct) { string sql = @"update CourseContentType set CCT_ID=@a,CCT_DESC=@b where id=@c"; SqlParameter[] par = new SqlParameter[] { new SqlParameter("@c", cct.CCT_ID), new SqlParameter("@a", cct.CCT_NAME), new SqlParameter("@b", cct.CCT_DESC) }; return(SQLHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, par)); }
/// <summary> /// 查询单词包类别id /// </summary> /// <param name="cd"></param> /// <returns></returns> public object QueryCourseContTypeID(CourseContentType cd) { string sqlTest = @"select CCT_ID from CourseContentType where CCT_NAME=@name"; SqlParameter[] par = { new SqlParameter("@name", cd.CCT_NAME) }; return(SQLHelper.ExecuteScalar(sqlTest, CommandType.Text, par)); }
//添加单词包类型 public int AddCourseContentType(CourseContentType cct) { string sql = "insert into CourseContentType values(@a,@b)"; SqlParameter[] par = { new SqlParameter("@a", cct.CCT_NAME), new SqlParameter("@b", cct.CCT_DESC) }; return(SQLHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, par)); }
/// <summary> /// 添加单词包类型 /// </summary> /// <param name="c"></param> /// <returns></returns> public int AddCoursesContentType(CourseContentType cct) { string sql = "insert into CourseContentType(CCT_NAME,CCT_DESC) values(@name,@desc)"; SqlParameter[] par = new SqlParameter[2] { //new SqlParameter("@id",cct.CCT_ID), new SqlParameter("@name", cct.CCT_NAME), new SqlParameter("@desc", cct.CCT_DESC), }; return(SQLHelper.ExecuteNonQuery(sql, CommandType.Text, par)); }
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(); } }
//查询单词包类型 public List <CourseContentType> SeleteCourseContentType() { string sql = "selete * from CourseContentType"; List <CourseContentType> lcct = new List <CourseContentType>(); SqlDataReader sdr = SQLHelper.ExecuteReader(sql, System.Data.CommandType.Text, null); if (sdr.HasRows) { while (sdr.Read()) { CourseContentType cct = new CourseContentType(); cct.CCT_ID = Convert.ToInt32(sdr["CCT_ID"].ToString()); cct.CCT_NAME = sdr["CCT_NAME"].ToString(); cct.CCT_DESC = sdr["CCT_DESC"].ToString(); lcct.Add(cct); } } sdr.Close(); return(lcct); }
/// <summary> /// 查询所有单词包类别 /// </summary> /// <returns></returns> public List <CourseContentType> QueryCourseContentTypeAll() { string sql = "select * from coursecontenttype"; List <CourseContentType> list = new List <CourseContentType>(); SqlDataReader msdr = SQLHelper.ExecuteReader(sql, CommandType.Text, null); if (msdr.HasRows) { while (msdr.Read()) { CourseContentType cct = new CourseContentType(); cct.CCT_ID = int.Parse(msdr["CCT_ID"].ToString()); cct.CCT_NAME = msdr["CCT_NAME"].ToString(); cct.CCT_DESC = msdr["CCT_DESC"].ToString(); list.Add(cct); } } msdr.Close(); return(list); }
// GET: eLearning/CourseContents/Create public async Task <ActionResult> Create(int?courseId, int?moduleId, CreateContentFrom createContentFrom, CourseContentType courseContentType, string courseTitle) { if (courseId == null) { TempData["ErrorMessage"] = "Could not find a course to create the content to."; return(Redirect(Request.UrlReferrer.ToString())); } CreateOrEditContentModel model = new CreateOrEditContentModel { ContentType = courseContentType, PageTitle = courseTitle, FileDocument = new FileDocument(), CreateContentFrom = createContentFrom, CourseId = courseId.Value, IsFeedbackOn = 0, }; if (createContentFrom == CreateContentFrom.Module) { model.CourseModuleId = moduleId.Value; } await GetAllQuestions(courseId.Value); if (courseContentType == CourseContentType.Audio) { await GetAllAudio(courseId.Value); } if (courseContentType == CourseContentType.Document) { await GetAllDocument(courseId.Value); } return(View(model)); }
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("添加异常"); } }
public int UpdateCourseContentType(CourseContentType cct) { return(dct.UpdateCourseContentType(cct)); }
public int AddCourseContentType(CourseContentType cct) { return(dct.AddCourseContentType(cct)); }
/// <summary> /// 根据名称查找单词包类型ID /// </summary> /// <param name="cct"></param> /// <returns></returns> public object QueryCourseContTypeID(CourseContentType cct) { return(cct_dal.QueryCourseContTypeID(cct)); }
/// <summary> /// 单词包类型添加 /// </summary> /// <param name="cct"></param> /// <returns></returns> public int AddCourseContentType(CourseContentType cct) { return(cct_dal.AddCoursesContentType(cct)); }