public static bool Del(int intID) { WxMenuInfo dataById = WxMenu.GetDataById(intID); bool result; if (dataById.ChildCount > 0) { result = false; } else if (BizBase.dbo.DeleteModel <WxMenuInfo>(dataById)) { if (dataById.ParentID > 0) { BizBase.dbo.UpdateTable(string.Concat(new object[] { "update weixin_WxMenu set ChildCount=ChildCount-1,ChildIDs=REPLACE(ChildIDs,',", intID, "','') where AutoID=", dataById.ParentID })); } if (!string.IsNullOrEmpty(dataById.EventKey)) { AutoRly.DelEventKey(dataById.EventKey); } result = true; } else { result = false; } return(result); }
public static WxStatus Update(WxMenuInfo entity, AutoRlyInfo eventKey) { WxMenuInfo dataById = WxMenu.GetDataById(entity.AutoID); WxStatus result; if (WxMenu.Update(entity)) { if (entity.Type == "view" && !string.IsNullOrEmpty(dataById.EventKey)) { AutoRly.DelEventKey(dataById.EventKey); } else if (entity.Type == "click" && dataById.Type != "click" && eventKey != null) { AutoRly.Add(eventKey); } else if (entity.Type == "click" && dataById.Type == "click" && eventKey != null) { AutoRlyInfo eventRly = AutoRly.GetEventRly(dataById.EventKey); if (eventRly != null) { eventRly.MsgText = eventKey.MsgText; eventRly.Description = eventKey.Description; eventRly.MediaPath = eventKey.MediaPath; eventRly.LinkUrl = eventKey.LinkUrl; eventRly.AutoTimeStamp = DateTime.Now; AutoRly.Update(eventRly); } } result = WxStatus.修改成功; } else { result = WxStatus.修改失败; } return(result); }