public ActionResult Select(string pageId, string showCheckbox, string selectIds)
 {
     try
     {
         TreeSelectModel model = new TreeSelectModel();
         model.PageId = pageId;
         model.TreeId = TreeId.StoreSiteTreeId;
         UserInfo  sysUser = CacheInit.GetUserInfo(HttpContext);
         DataTable list    = new DataTable();
         if (HttpContext.Cache["StoreSiteTree"] == null)
         {
             StoreSiteRepository srep = new StoreSiteRepository();
             list = srep.GetStoreSiteTree(sysUser);
             HttpContext.Cache.Add("StoreSiteTree", list, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero, CacheItemPriority.High, null);
         }
         else
         {
             list = (DataTable)HttpContext.Cache["StoreSiteTree"];
         }
         model.DataTree = list;
         if (showCheckbox == "true")
         {
             model.ShowCheckBox = true;
         }
         model.SelectId  = selectIds;
         model.SearchUrl = Url.Action("SearchTree", "StoreSite", new { Area = "BasicData" });
         return(PartialView("TreeSelect", model));
     }
     catch (Exception ex)
     {
         AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "StoreSiteController.Select", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         return(Content("[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html"));
     }
 }
 public ActionResult SearchTree(string pageId, string pySearch)
 {
     try
     {
         UserInfo            sysUser = CacheInit.GetUserInfo(HttpContext);
         StoreSiteRepository urep    = new StoreSiteRepository();
         DataTable           list    = new DataTable();
         if (HttpContext.Cache["StoreSiteTree"] == null)
         {
             list = urep.GetStoreSiteTree(sysUser);
             //根据拼音首字母检索,现不用。
             //DataColumn col = new DataColumn("PY");
             //list.Columns.Add(col);
             //foreach (DataRow dr in list.Rows)
             //{
             //    dr["PY"] = PinYin.GetFirstPinyin(DataConvert.ToString(dr["storeSiteName"]));
             //}
             HttpContext.Cache.Add("StoreSiteTree", list, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero, CacheItemPriority.High, null);
         }
         else
         {
             list = (DataTable)HttpContext.Cache["StoreSiteTree"];
         }
         var dtResult = TreeBusiness.GetSearchDataTable(pySearch, list);
         if (dtResult.Rows.Count > 0)
         {
             string treeString = AppTreeView.TreeViewString(pageId, TreeId.StoreSiteTreeId, dtResult, "", false);
             return(Content(treeString, "text/html"));
         }
         else
         {
             return(Content("0", "text/html"));
         }
     }
     catch (Exception ex)
     {
         AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "StoreSiteController.SearchTree", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         return(Content("[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html"));
     }
 }