//数据绑定 void Bind() { int gid = Str2Int(q("id"), 0); Daiv_OA.Entity.SchoolGradeEntity model = new Daiv_OA.Entity.SchoolGradeEntity(); model = new Daiv_OA.BLL.SchoolGradeBLL().GetEntity(gid); this.Name.Text = model.Name; string sql = ""; if (schId > 0) { sql = " ID=" + schId; } Daiv_OA.BLL.SchoolBLL dp = new Daiv_OA.BLL.SchoolBLL(); DataSet ds = dp.GetList(sql); for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { ListItem listItem = new ListItem(); listItem.Text = ds.Tables[0].Rows[j]["Name"].ToString(); listItem.Value = ds.Tables[0].Rows[j]["ID"].ToString(); this.ddlGid.Items.Add(listItem); } this.ddlGid.SelectedValue = model.SchoolID.ToString(); ds.Clear(); }
//数据绑定 void Bind() { int gid = Str2Int(q("id"), 0); Daiv_OA.Entity.SchoolEntity model = new Daiv_OA.Entity.SchoolEntity(); model = new Daiv_OA.BLL.SchoolBLL().GetEntity(gid); this.Name.Text = model.Name; this.Address.Text = model.Address; this.SchoolSerie.Text = model.SchoolSerie; }
private PagedDataSource pds() { string sql = string.Format(@"select * from OA_School where IsDeleted = 0", UserId); DataSet ds = new Daiv_OA.BLL.SchoolBLL().Getall(sql); //this.user_repeater.DataBind(); //this.user_repeater.DataSource = new Daiv_OA.BLL.UserBLL().Getall(sql); //this.user_repeater.DataBind(); PagedDataSource pds = new PagedDataSource(); pds.DataSource = ds.Tables[0].DefaultView; pds.AllowPaging = true; //允许分页 pds.PageSize = 8; //单页显示项数 pds.CurrentPageIndex = Convert.ToInt32(Request.QueryString["page"]); return(pds); }
//删除数据 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 Page_Load(object sender, EventArgs e) { User_Load("schgrade-list"); //学校ID string shid = Request["shid"]; if (!string.IsNullOrEmpty(shid)) { try { schId = Convert.ToInt32(shid); } catch (Exception) { } } if (!this.IsPostBack) { string sql = ""; if (schId > 0) { sql = " ID=" + schId; } Daiv_OA.BLL.SchoolBLL dp = new Daiv_OA.BLL.SchoolBLL(); DataSet ds = dp.GetList(sql); for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { ListItem listItem = new ListItem(); listItem.Text = ds.Tables[0].Rows[j]["Name"].ToString(); listItem.Value = ds.Tables[0].Rows[j]["ID"].ToString(); this.ddlGid.Items.Add(listItem); } ds.Clear(); } }