//添加 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.GradeEntity gradeEntity = new Entity.GradeEntity(); gradeEntity.Gname = this.Gname.Text; gradeEntity.GgradeName = ""; gradeEntity.GgradeID = Convert.ToInt32(Request["schGradeGid"]); gradeEntity.Mphone = this.Mphone.Text; try { gradeEntity.Gsnumber = int.Parse(this.Gsnumber.Text); } catch (Exception) { } if (this.Gdescription.Text != "") { gradeEntity.Gdescription = this.Gdescription.Text; } gradeEntity.MechID = UserId; int i = new Daiv_OA.BLL.GradeBLL().Add(gradeEntity); if (i > 0) { logHelper.logInfo("添加班级成功!"); FinalMessage("操作成功", "Grade_List.aspx?gid=" + gradeId, 0); } else if (i == 0) { FinalMessage("相同的班级已经存在", "", 1); } else if (i == -1) { FinalMessage("相同的年级已经存在", "", 1); } }
//更新 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.GradeEntity model = new Entity.GradeEntity(); model = new Daiv_OA.BLL.GradeBLL().GetEntity(Str2Int(q("id"), 0)); model.Gdescription = this.Gdescription.Text; model.Mphone = this.Mphone.Text; model.GgradeName = ""; model.Gname = this.Gname.Text; try { model.GgradeID = Convert.ToInt32(Request["schGradeGid"]); model.Gsnumber = Convert.ToInt32(this.Gsnumber.Text); } catch (Exception) { logHelper.logInfo("班级人数转换失败!操作人:" + UserId); } new Daiv_OA.BLL.GradeBLL().Update(model); logHelper.logInfo("修改班级成功!操作人:" + UserId); FinalMessage("操作成功", "Grade_List.aspx?gid=" + gradeId, 0); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Entity.GradeEntity model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Entity.GradeEntity model) { return(dal.Add(model)); }