Esempio n. 1
0
        /// <summary>
        /// 获得按钮列表
        /// </summary>
        /// <param name="account">账号</param>
        /// <param name="mid"></param>
        /// <returns></returns>
        public IList <Button> GetButtons(string account, int mid)
        {
            try
            {
                var br = new ButtonR();
                if (account.Equals("@ADMIN"))
                {
                    return(br.FindList(i => i.MenuId == mid));
                }
                else if (account.Equals("ADMIN"))
                {
                    return(br.FindList(i => i.MenuId == mid && i.Stopping == false));
                }

                const string sql = @"select b.Id,b.ButtonName,b.ClassName,b.FuncName,b.Stopping,b.MenuId 
                                    from Sys_ButtonUserMap a
                                    left join Sys_Button b on a.ButtonId=b.Id
                                    left join G_Users u on a.UserId=u.Id
                                    where u.Account=@Account
                                          and Stopping=0";
                return(br.QueryList(sql, new { Account = account }));
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 保存按钮
 /// </summary>
 /// <param name="btn"></param>
 /// <param name="err"></param>
 /// <returns></returns>
 public bool SaveButton(Button btn, ref string err)
 {
     try
     {
         var br = new ButtonR();
         if (btn.Id > 0)
         {
             return(br.Update(btn) > 0);
         }
         return(br.Insert(btn) > 0);
     }
     catch
     {
         return(false);
     }
 }