/// <summary> /// 查询专业所有学科 /// </summary> /// <param name="model">专业学科的实体对象</param> /// <returns>DataTable数据表</returns> public DataTable GetAllSepc_Subjects(Sepc_SubjectsModel model) { string sql = "select b.Subjects_ID 学科编号,Subjects_Name 学科名称 from Sepc_Subjects a join Subjects b on a.Subjects_ID=b.Subjects_ID where Sepc_ID=@0"; DataTable dt = SqlHelper.GetDataTable(sql, model.Sepc_ID); return(dt); }
void GetAllSepc_Subjects() { Sepc_SubjectsBLL Sepc_Subjects = new Sepc_SubjectsBLL(); Sepc_SubjectsModel model = new Sepc_SubjectsModel(); model.Sepc_ID = Speciality_ID; dataGridView1.DataSource = Sepc_Subjects.GetAllSepc_Subjects(model); }
public bool SeleSepc_Subjects(Sepc_SubjectsModel model) { string sql = "select * from Sepc_Subjects where Sepc_ID=@0 and Subjects_ID=@1"; SqlDataReader dr = SqlHelper.ExReader(sql, model.Sepc_ID, model.Subjects_ID); bool b = dr.Read(); dr.Close(); return(b); }
private void button2_Click(object sender, EventArgs e) { Sepc_SubjectsBLL Sepc_Subjects = new Sepc_SubjectsBLL(); Sepc_SubjectsModel model = new Sepc_SubjectsModel(); model.Sepc_ID = Speciality_ID; model.Subjects_ID = Convert.ToInt32(this.dataGridView1.SelectedRows[0].Cells["学科编号"].Value); Sepc_Subjects.DeleSepc_Subjects(model); GetAllSepc_Subjects(); }
private void button1_Click(object sender, EventArgs e) { Sepc_SubjectsBLL Sepc_Subjects = new Sepc_SubjectsBLL(); Sepc_SubjectsModel model = new Sepc_SubjectsModel(); model.Sepc_ID = Speciality_ID; model.Subjects_ID = Convert.ToInt32(this.comboBox1.SelectedValue); bool b = Sepc_Subjects.SeleSepc_Subjects(model); if (b == true) { MessageBox.Show("该专业下已经存在该科目,请重新选择"); return; } Sepc_Subjects.AddSepc_Subjects(model); GetAllSepc_Subjects(); }
public bool SeleSepc_Subjects(Sepc_SubjectsModel model) { bool b = Sepc_Subjects.SeleSepc_Subjects(model); return(b); }
/// <summary> /// 获取专业下所有学科 /// </summary> /// <param name="model">专业学科的实体对象</param> /// <returns>DataTable数据表</returns> public DataTable GetAllSepc_Subjects(Sepc_SubjectsModel model) { DataTable dt = Sepc_Subjects.GetAllSepc_Subjects(model); return(dt); }
/// <summary> /// 删除专业下的学科 /// </summary> /// <param name="model">学科专业的实体对象</param> public void DeleSepc_Subjects(Sepc_SubjectsModel model) { Sepc_Subjects.DeleSepc_Subjects(model); }
/// <summary> /// 为专业添加学科 /// </summary> /// <param name="model">专业学科的实体对象</param> public void AddSepc_Subjects(Sepc_SubjectsModel model) { Sepc_Subjects.AddSepc_Subjects(model); }
/// <summary> /// 为专业删除学科的数据访问方法 /// </summary> /// <param name="model">专业学科的实体对象</param> public void DeleSepc_Subjects(Sepc_SubjectsModel model) { string sql = "delete Sepc_Subjects where Sepc_ID=@0 and Subjects_ID=@1"; SqlHelper.ExNonQuery(sql, "专业删除学科", model.Sepc_ID, model.Subjects_ID); }
/// <summary> /// 为专业添加学科的数据访问方法 /// </summary> /// <param name="model">专业学科的实体对象</param> public void AddSepc_Subjects(Sepc_SubjectsModel model) { string sql = "insert into Sepc_Subjects values(@0,@1)"; SqlHelper.ExNonQuery(sql, "为专业添加学科", model.Sepc_ID, model.Subjects_ID); }