public ActionResult Insert(XinZhengQuYu entity) { if (ModelState.IsValid) { if (string.IsNullOrEmpty(entity.RecordType)) { entity.RecordType = RecordType.User.ToString(); } entity.CreatedBy = GetCurrentUserName(); entity.CreatedDate = DateTime.Now; _service.AddXinZhengQuYu(entity); _service.Save(); //this.GetCmp<Window>("windowXinZhengQuYu").Hide(); //TreePanel treePanel = this.GetCmp<TreePanel>("xinZhengQuYuTreePanel"); //treePanel.GetNodeById(entity.ParentId).Reload(); var parentNode = this.GetCmp <TreePanel>("xinZhengQuYuTreePanel").GetNodeById(entity.ParentId); parentNode.Set("leaf", false); parentNode.Reload(); parentNode.ExpandChildren(true); this.GetCmp <Window>("windowXinZhengQuYu").Hide(); } return(this.Direct()); }
public ActionResult Update(XinZhengQuYu entity) { if (ModelState.IsValid) { if (string.IsNullOrEmpty(entity.RecordType)) { entity.RecordType = RecordType.User.ToString(); } entity.LastModifiedBy = GetCurrentUserName(); entity.LastModifiedDate = DateTime.Now; _service.UpdateXinZhengQuYu(entity); _service.Save(); var window = this.GetCmp <Window>("windowXinZhengQuYu"); window.Hide(); TreePanel treePanel = this.GetCmp <TreePanel>("xinZhengQuYuTreePanel"); treePanel.GetNodeById(entity.Id).ParentNode().Reload(); return(this.Direct()); } return(this.Direct()); }