Exemple #1
0
        public ActionResult InitTree()
        {
            try
            {
                var account       = Session["Account"] as Account;
                var organizations = HttpRuntime.Cache.GetOrInsert <List <Models.Shared.Organization> >("Organization", () => OrganizationDataAccessor.GetAllOrganizations());

                RequestResult requestResult = new RequestResult();

                if (account.RootOrganizationId == new Guid())
                {
                    requestResult = PersonDataAccessor.GetTreeItem(organizations, account.RootOrganizationId, account);
                }
                else
                {
                    requestResult = PersonDataAccessor.GetRootTreeItem(organizations, account);
                }

                if (requestResult.IsSuccess)
                {
                    return(PartialView("_Tree", JsonConvert.SerializeObject((List <TreeItem>)requestResult.Data)));
                }
                else
                {
                    return(PartialView("_Error", requestResult.Error));
                }
            }
            catch (Exception e)
            {
                var error = new Error(MethodBase.GetCurrentMethod(), e);
                Logger.Log(error);
                return(PartialView("_Error", error));
                //throw;
            }
        }
Exemple #2
0
 public ActionResult InitSelectPersonTree(string ancestorOrganizationId)
 {
     try
     {
         var           organizatios  = HttpRuntime.Cache.GetOrInsert <List <Organization> >("Organizations", () => OrganizationDataAccessor.GetAllOrganizations());
         RequestResult requestResult = PersonDataAccessor.GetRootTreeItem(organizatios, Session["Account"] as Account);
         if (requestResult.IsSuccess)
         {
             return(PartialView("_SelectPersonTree", JsonConvert.SerializeObject((List <TreeItem>)requestResult.Data)));
         }
         else
         {
             return(PartialView("_Error", requestResult.Error));
         }
     }
     catch (Exception e)
     {
         var error = new Error(MethodBase.GetCurrentMethod(), e);
         Logger.Log(error);
         return(PartialView("_Error", error));
         //throw;
     }
 }