/// <summary> /// 加载数据 /// </summary> private void LoadData() { CodeGroupEntity entity = new CodeGroupEntity(this.CodeGroupID); txtCodeGroupName.Text = entity.CodeGroupName; txtCodeGroupKey.Text = entity.CodeGroupKey; txtMemo.Text = entity.Memo; }
/// <summary> /// 更新 /// </summary> private void Update() { CodeGroupEntity entity = new CodeGroupEntity(this.CodeGroupID); entity.CodeGroupName = txtCodeGroupName.Text; entity.CodeGroupKey = txtCodeGroupKey.Text; entity.Memo = txtMemo.Text; entity.IsDeleted = false; new CodeGroupRule().Update(entity); }
/// <summary> /// 保存 /// </summary> private void Save() { CodeGroupEntity entity = new CodeGroupEntity(); entity.CodeGroupName = txtCodeGroupName.Text; entity.CodeGroupKey = txtCodeGroupKey.Text; entity.Memo = txtMemo.Text; entity.IsDeleted = false; new CodeGroupRule().Add(entity); }
/// <summary> /// toolbar事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void toolbar_MenuItemClick(object sender, MenuEventArgs e) { long ID = 0; switch (e.Item.Value) { case "Delete": if (e.Item.Value == "Delete") { int succeed = 0; string CodeGroupNames = ""; for (int j = 0; j < tvOU.CheckedNodes.Count; j++) { Infragistics.WebUI.UltraWebNavigator.Node tn = (Infragistics.WebUI.UltraWebNavigator.Node)tvOU.CheckedNodes[j]; long CodeGroupID = NDConvert.ToInt64(tn.DataKey.ToString()); CodeGroupEntity entity = new CodeGroupEntity(CodeGroupID); if (!CodeQuery.IsExistCode(CodeGroupID)) { entity.IsDeleted = true; new CodeGroupRule().Update(entity); succeed++; } else { CodeGroupNames += "[" + entity.CodeGroupName + "]"; } } if (succeed > 0) { BindTreeView(); PageHelper.ShowMessage("删除成功!"); } if (CodeGroupNames != "") { string msgErr = "代码组名称为" + CodeGroupNames + "的记录不可删除!\\n\\n" + "可先删除代码组中包含的代码记录后再删除该代码组!"; PageHelper.ShowExceptionMessage(msgErr); } } break; case "Update": ID = NDConvert.ToInt64(((Infragistics.WebUI.UltraWebNavigator.Node)tvOU.CheckedNodes[0]).DataKey.ToString()); Page.ClientScript.RegisterStartupScript(this.GetType(), "更新", "showModalWindow('CodeGroupEditLY', '修改',750, 220, '../../web/SysManager/CodeGroupEdit.aspx?Operation=2&ID=' + " + ID + ");", true); break; } }