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