//数据绑定 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(); }
//更新 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.SchoolGradeEntity model = new Entity.SchoolGradeEntity(); Daiv_OA.BLL.ContactBLL contactBll = new Daiv_OA.BLL.ContactBLL(); Daiv_OA.BLL.SchoolGradeBLL SchoolGradeBll = new Daiv_OA.BLL.SchoolGradeBLL(); model = SchoolGradeBll.GetEntity(Str2Int(q("id"), 0)); model.SchoolID = int.Parse(this.ddlGid.SelectedValue); model.Name = this.Name.Text; Entity.SchoolGradeEntity sgEntity = SchoolGradeBll.GetEntityByNameAndScId(model.Name, model.SchoolID); if (sgEntity != null && sgEntity.ID != model.ID) { FinalMessage("已经存在:此学校的班级:" + model.Name, "SchoolGrade_Edit.aspx?id=" + model.ID + "&shid=" + schId, 0); return; } SchoolGradeBll.Update(model); logHelper.logInfo("修改设备成功!操作人:" + UserId); FinalMessage("操作成功", "SchoolGrade_List.aspx?shid=" + schId, 0); }
//删除数据 protected void lbDel_Click(object sender, CommandEventArgs e) { User_Load("sch-list"); string oname = Getoname(); Daiv_OA.BLL.SchoolGradeBLL SchoolGradeBll = new Daiv_OA.BLL.SchoolGradeBLL(); Daiv_OA.BLL.UserBLL userBll = new BLL.UserBLL(); int sid = Convert.ToInt32(e.CommandArgument); Entity.SchoolGradeEntity SchoolGradeEntity = SchoolGradeBll.GetEntity(sid); SchoolGradeBll.Delete(sid); logHelper.logInfo("删除年级成功!操作人:" + oname); string stuStr = Newtonsoft.Json.JsonConvert.SerializeObject(SchoolGradeEntity); logHelper.logInfo("删除年级:" + stuStr); Adminlogadd(oname); Bind(); }
private PagedDataSource pds() { string whereSql = ""; if (schId > 0) { whereSql = " and SchoolID=" + schId; } string sql = string.Format(@"select sg.*,s.Name as SchoolName from OA_SchoolGrade sg join OA_School s on sg.SchoolID=s.ID where sg.IsDeleted = 0 {0}", whereSql); DataSet ds = new Daiv_OA.BLL.SchoolGradeBLL().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); }