//删除数据 protected void lbDel_Click(object sender, CommandEventArgs e) { User_Load("sch-list"); string oname = Getoname(); Daiv_OA.BLL.SchoolBLL SchoolBll = new Daiv_OA.BLL.SchoolBLL(); Daiv_OA.BLL.UserBLL userBll = new BLL.UserBLL(); int sid = Convert.ToInt32(e.CommandArgument); Entity.SchoolEntity SchoolEntity = SchoolBll.GetEntity(sid); SchoolBll.Delete(sid); logHelper.logInfo("删除学校成功!操作人:" + oname); string stuStr = Newtonsoft.Json.JsonConvert.SerializeObject(SchoolEntity); logHelper.logInfo("删除学校:" + stuStr); Adminlogadd(oname); Bind(); }
//更新 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.SchoolEntity model = new Entity.SchoolEntity(); Daiv_OA.BLL.ContactBLL contactBll = new Daiv_OA.BLL.ContactBLL(); Daiv_OA.BLL.SchoolBLL SchoolBll = new Daiv_OA.BLL.SchoolBLL(); model = SchoolBll.GetEntity(Str2Int(q("id"), 0)); model.Name = this.Name.Text; model.Address = this.Address.Text; model.SchoolSerie = this.SchoolSerie.Text; //判断该名称是否存在 Entity.SchoolEntity stemp = SchoolBll.GetEntityByName(model.Name); if (stemp != null && stemp.ID != model.ID) { FinalMessage("学校名称:" + model.Name + "已存在!", "School_Eidt.aspx?id=" + model.ID, 1); return; } SchoolBll.Update(model); logHelper.logInfo("修改学校成功!操作人:" + UserId); FinalMessage("操作成功", "School_List.aspx", 0); }
//添加 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.SchoolEntity SchoolEntity = new Entity.SchoolEntity(); Entity.UserEntity parent = new Entity.UserEntity(); Entity.ContactEntity contactEnitty = new Entity.ContactEntity(); //学校实体相关信息保存 SchoolEntity.Address = this.Address.Text; SchoolEntity.Name = this.Name.Text; SchoolEntity.SchoolSerie = this.SchoolSerie.Text; SchoolEntity.CreateDate = DateTime.Now; //保存数据 try { new Daiv_OA.BLL.SchoolBLL().Add(SchoolEntity); } catch (Exception ex) { FinalMessage("操作失败!" + ex.Message, "School_List.aspx", 1); return; } FinalMessage("操作成功", "School_List.aspx", 0); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Entity.SchoolEntity model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Entity.SchoolEntity model) { return(dal.Add(model)); }