/// <summary> /// 页面绑定控件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonEmpower_Click(object sender, EventArgs e) { //获取当前选择的菜单项 var index = ConvertHelper.Cint0(hidId.Text); //获取当前用户选择的全部记录Id var id = GridViewHelper.GetSelectedKeyIntArray(Grid1); //如果没有选择项,则直接退出 if (index == 0 || id == null || id.Length == 0) { return; } //添加到绑定表中 foreach (var i in id) { //检查当前控件是否已添加 //添加前判断一下本权限标签是否已添加过了,没有则进行添加 if (!PagePowerSignBll.GetInstence().Exist(x => x.MenuInfo_Id == index && x.PagePowerSignPublic_Id == i)) { var ppsp = PagePowerSignPublicBll.GetInstence().GetModelForCache(i); if (ppsp == null) { continue; } var model = new PagePowerSign(); model.MenuInfo_Id = index; model.PagePowerSignPublic_Id = i; model.CName = ppsp.CName; model.EName = ppsp.EName; PagePowerSignBll.GetInstence().Save(this, model); } } BindGrid(); }
/// <summary> /// Grid点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid4_RowCommand(object sender, FineUI.GridCommandEventArgs e) { GridRow gr = Grid4.Rows[e.RowIndex]; //获取当前点击列的主键ID int id_public = int.Parse(gr.DataKeys[0].ToString()); switch (e.CommandName) { case "IsOrNotLink": string id_menu = GridViewHelper.GetSelectedKey(Grid3, true); //获取未分配的 勾选的Id if (Grid3.SelectedRowIndexArray.Length > 1 || Grid3.SelectedRowIndexArray.Length == 0) { Alert.Show("请选择一行!", MessageBoxIcon.Warning); break; } //更新状态 // MenuInfoBll.GetInstence().UpdateIsDisplay(this, ConvertHelper.Cint0(id), ConvertHelper.Cint0(e.CommandArgument)); if (e.CommandArgument == "0") { //删除PagePowerSign if (Grid3.SelectedRowIndexArray.Length == 0) { Alert.Show("请搜选菜单项!", MessageBoxIcon.Information); } GridRow gr1 = Grid3.Rows[Grid3.SelectedRowIndex]; menuInfoId_ = int.Parse(gr1.Values[0].ToString()); var model1 = new Solution.DataAccess.DataModel.PagePowerSignPublic(x => x.Id == id_public); var model_p = PagePowerSign.SingleOrDefault(x => x.PagePowerSignPublic_Id == model1.Id && x.MenuInfo_Id == menuInfoId); // PagePowerSignBll.GetInstence().GetModel(model1.Id, menuInfoId_, true); //获取PagePowerSign表 PagePowerSignBll.GetInstence().Delete(this, model_p.Id); int id = ConvertHelper.Cint0(hidId.Text); //获取页面传值 var model = new DataAccess.Model.Position(); //获取指定ID的菜单内容,如果不存在,则创建一个菜单实体 model = PositionBll.GetInstence().GetModelForCache(x => x.Id == id); string new_control = model.ControlPower.Replace(id_menu + "|" + id_public + ",", ""); // model.ControlPower = new_control; PositionBll.GetInstence().UpdateValue(this, id, "ControlPower", new_control, "", true, false); //.UpdateControlPower(this, id, new_control, false, false); // PositionBll.GetInstence().SetModelForCache(model); } else //添加PagePowerSign //Solution.DataAccess.Model.PagePowerSign model = new DataAccess.Model.PagePowerSign(); //model.PagePowerSignPublic_Id = (int)id; //model.CName = { var model1 = new Solution.DataAccess.DataModel.PagePowerSignPublic(x => x.Id == id_public); Solution.DataAccess.DataModel.PagePowerSign pps = new DataAccess.DataModel.PagePowerSign(); pps.PagePowerSignPublic_Id = model1.Id; pps.CName = model1.Cname; pps.EName = model1.Ename; pps.MenuInfo_Id = int.Parse(id_menu); PagePowerSignBll.GetInstence().Save(this, pps); int id = ConvertHelper.Cint0(hidId.Text); //获取页面传值 var model = new DataAccess.Model.Position(); //获取指定ID的菜单内容,如果不存在,则创建一个菜单实体 model = PositionBll.GetInstence().GetModelForCache(x => x.Id == id); string new_control = model.ControlPower + id_menu + "|" + id_public + ","; //model.ControlPower = new_control; PositionBll.GetInstence().UpdateValue(this, id, "ControlPower", new_control, "", true, false); //PositionBll.GetInstence().UpdateControlPower(this, id, new_control, false, false); //PositionBll.GetInstence().SetModelForCache(model); } //重新加载 conditionList = new List <ConditionFun.SqlqueryCondition>(); conditionList.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, "1", Comparison.Equals, "1", false, false)); //bll.BindGrid(Grid1, 0, sortList); bll.BindGrid(Grid4, 0, 0, conditionList, sortList); break; } }