public JsonResult GetAuthorityGroup()
 {
     try
     {
         string callId = (Session["caller"] as Caller).user_email;
         AuthorityQuery query = new AuthorityQuery { Type = 1, CallId = callId };
         functionGroupMgr = new FunctionGroupMgr(connectionString);
         List<Function> functions = functionGroupMgr.CallerAuthorityQuery(query);
         var result = from f in functions
                      group f by f.FunctionGroup into fgroup
                      select new { Id = fgroup.Min(m => m.RowId), Text = fgroup.Key };
         return Json(result);
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
     }
     return Json("[]");
 }
 public HttpResponseBase GetAuthorityFun(string id)
 {
     string json = string.Empty;
     try
     {
         string callId = (Session["caller"] as Caller).user_email;
         AuthorityQuery query = new AuthorityQuery { Type = 1, CallId = callId };
         if (!string.IsNullOrEmpty(id))
         {
             query.RowId = Convert.ToInt32(id);
         }
         functionGroupMgr = new FunctionGroupMgr(connectionString);
         List<Function> functions = functionGroupMgr.CallerAuthorityQuery(query);
         StringBuilder strJson = new StringBuilder("[");
         foreach (Function fun in functions)
         {
             strJson.Append("{");
             strJson.AppendFormat("text:\"{0}\",url:\"{1}\",id:\"{2}\",iconCls:\"{3}\",leaf:true", fun.FunctionName, fun.FunctionCode, fun.RowId, fun.IconCls);
             strJson.Append("}");
         }
         strJson.Append("]");
         json = strJson.ToString().Replace("}{", "},{");
     }
     catch (Exception ex)
     {
         json = "[]";
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
        public JsonResult GetAuthorityToolByUrl()
        {
            try
            {
                if (!string.IsNullOrEmpty(Request.Form["Url"]))
                {
                    functionMgr = new FunctionMgr(connectionString);
                    Function fun = functionMgr.Query(new Function { FunctionCode = Request.Form["Url"] }).FirstOrDefault();
                    if (fun != null)
                    {
                        string callId = (Session["caller"] as Caller).user_email;
                        AuthorityQuery query = new AuthorityQuery { Type = 2, CallId = callId };

                        query.RowId = fun.RowId;
                        functionGroupMgr = new FunctionGroupMgr(connectionString);
                        List<Function> functions = functionGroupMgr.CallerAuthorityQuery(query);
                        var result = from f in functions
                                     select new { id = f.FunctionCode, isEdit = f.UEdit };
                        return Json(result);
                    }
                }

            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }
            return Json("");
        }