/// <summary> /// toolbar /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void toolbar_MenuItemClick(object sender, MenuEventArgs e) { switch (e.Item.Value) { case "Delete": int succeed = 0; for (int i = 0; i < grid.Rows.Count; i++) { CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem"); if (chkItem != null && chkItem.Checked == true) { this.FID = NDConvert.ToInt64(grid.DataKeys[i]["FID"].ToString()); MenuFunctionEntity entity = new MenuFunctionEntity(FID); entity.IsDeleted = true; new MenuFunctionRule().Update(entity); succeed++; } } if (succeed > 0) { BindGridView(); PageHelper.ShowMessage("删除成功!"); } break; } }
/// <summary> /// 更新 /// </summary> private void Update() { MenuFunctionEntity entity = new MenuFunctionEntity(this.FID); entity.FCode = txtFCode.Text.Trim(); entity.FName = txtFName.Text.Trim(); if (rdoIsShow.SelectedValue == "0") { entity.IsShow = false; } else { entity.IsShow = true; } new MenuFunctionRule().Update(entity); }
/// <summary> /// 新增 /// </summary> private void Save() { MenuFunctionEntity entity = new MenuFunctionEntity(); entity.FCode = txtFCode.Text.Trim(); entity.FName = txtFName.Text.Trim(); entity.IsDeleted = false; entity.MenuID = this.MenuID; if (rdoIsShow.SelectedValue == "0") { entity.IsShow = false; } else { entity.IsShow = true; } entity.SortIndex = MenuFunctionQuery.MaxSortIndex(this.MenuID); new MenuFunctionRule().Add(entity); }
/// <summary> /// grid按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { int RowIndex = NDConvert.ToInt32(e.CommandArgument.ToString()); this.FID = NDConvert.ToInt64(grid.DataKeys[RowIndex].Values["FID"].ToString()); MenuFunctionEntity entity = new MenuFunctionEntity(this.FID); switch (e.CommandName) { case "Modify": this.CurOperation = (int)OperationEnum.UPDATE; txtFName.Text = entity.FName; txtFCode.Text = entity.FCode; for (int i = 0; i < rdoIsShow.Items.Count; i++) { if (entity.IsShow && rdoIsShow.Items[i].Value == "1") { rdoIsShow.Items[i + 1].Selected = false; rdoIsShow.Items[i].Selected = true; } else if (!entity.IsShow && rdoIsShow.Items[i].Value == "0") { rdoIsShow.Items[i].Selected = true; } } break; case "Del": entity.IsDeleted = true; new MenuFunctionRule().Update(entity); PageHelper.ShowMessage("删除成功!"); BindGridView(); break; } }