示例#1
0
        public WXCustomMenu AddCustomMenu(WXCustomMenu cm)
        {
            WXCustomMenu parent = null;

            if (cm.ParentID.HasValue)
            {
                parent = _cmr.GetCustomMenu(cm.ParentID.Value);
            }
            if (parent != null)
            {
                cm.Depth = parent.Depth + 1;
            }
            else
            {
                cm.Depth = 0;
            }
            cm.CeateTime = cm.LastUpdateTime = DateTime.Now;
            var id = _cmr.Insert(cm);

            if (id > 0)
            {
                return(this.GetCustomMenu((int)id));
            }
            return(null);
        }
示例#2
0
        private WXCustomMenu AddRootMenu(int merchants_ID)
        {
            var cm = new WXCustomMenu();

            cm.Merchants_ID = merchants_ID;
            cm.Name         = "菜单管理";
            return(this.AddCustomMenu(cm));
        }
示例#3
0
 public JsonResult AddChild(WXCustomMenu cm)
 {
     if (cm.ParentID.HasValue)
     {
         //JsonSMsg rMsg = new JsonSMsg();
         //rMsg.Status = -1;
         //rMsg.Message = "参数错误!";
         // var ccm = _cms.AddCustomMenu(cm.Name, cm.Type, cm.OrderNum, cm.Content, cm.Graphic_ID, cm.Url, CurrentUserMerchantsID.Value, cm.ParentID.Value);
         cm.Merchants_ID = CurrentMerchants.ID;
         var ccm = _cms.AddCustomMenu(cm);
         return(Json(ccm));
     }
     return(Json(null));
 }
示例#4
0
        public int SaveMenu(ref WXCustomMenu cm)
        {
            cm.LastUpdateTime = DateTime.Now;
            var id = _cmr.Update(cm);

            if (id > 0)
            {
                cm = this.GetCustomMenu(cm.ID);
            }
            else
            {
                cm = null;
            }
            return(id);
        }
示例#5
0
        public JsonResult ChangeMenuName(WXCustomMenu cm)
        {
            JsonSMsg rMsg = new JsonSMsg();

            if (!string.IsNullOrEmpty(cm.Name))
            {
                var b = _cms.SaveMenu(ref cm);
                if (b > 0)
                {
                    rMsg.Status  = 0;
                    rMsg.Message = "success";
                    rMsg.Data    = cm;
                }
                else
                {
                    rMsg.Status  = 0;
                    rMsg.Message = "fail";
                }
            }
            return(Json(rMsg));
        }