protected void submitButton_Click(object sender, EventArgs e) { //清空Label信息 this.ClearLabel(); //验证分类名称是否有效 if (!ValidateFLMC()) { return; } //验证专业分类是否有效 else if (!ValidateZYFL()) { return; } //验证通过则插入新记录 ZGCG_FL zgcgFL = new ZGCG_FL(); zgcgFL.flmc = this.flmcTextBox.Text.Trim(); zgcgFL.zyfl = this.zyflTextBox.Text.Trim(); //生成分类编码 String flbm = null; for (int i = 0; i < zgcgFL.zyfl.Length; i++) { flbm = flbm + zgcgFL.zyfl[i] + "0"; } this.flbmTextBox.Text = flbm; zgcgFL.flbm = flbm; //分类说明 zgcgFL.flsm = this.flsmTextBox.Text.Trim(); zgcgDAO.InsertZGCG_FL(zgcgFL); Response.Write("<Script>alert('添加中国成果分类成功')</Script>"); }
/// <summary> /// 更新一条分类信息 /// </summary> /// <param name="zgcg_fl">要更新的分类信息</param> /// <returns></returns> public Boolean UpdateZGCG_FL(ZGCG_FL zgcg_fl) { Boolean flag = true; int back = sqlMapper.Update("UpdateZGCG_FL", zgcg_fl); if (back <= 0) { flag = false; } return flag; }
/// <summary> /// 插入一条分类信息 /// </summary> /// <param name="zgcg_fl">分类信息</param> /// <returns></returns> public Boolean InsertZGCG_FL(ZGCG_FL zgcg_fl) { Boolean flag = true; try { sqlMapper.Insert("InsertZGCG_FL", zgcg_fl); } catch (Exception) { flag = false; } return flag; }