Exemplo n.º 1
0
        public ActionResult InitSelectTree(string refOrganizationId)
        {
            try
            {
                var organizations = HttpRuntime.Cache.GetOrInsert <List <Models.Shared.Organization> >("Organizations", () => OrganizationDataAccessor.GetAllOrganizations());

                RequestResult result = CheckItemDataAccessor.GetTreeItems(organizations, new Guid(refOrganizationId), new Guid(), "");

                if (result.IsSuccess)
                {
                    return(PartialView("_SelectTree", JsonConvert.SerializeObject((List <TreeItem>)result.Data)));
                }
                else
                {
                    return(PartialView("_Error", result.Error));
                }
            }
            catch (Exception ex)
            {
                var err = new Error(MethodBase.GetCurrentMethod(), ex);

                Logger.Log(err);

                return(PartialView("_Error", err));
            }
        }
Exemplo n.º 2
0
        public ActionResult GetSelectTreeItem(string refOrganizationId, string organizationId, string type)
        {
            string jsonTree = string.Empty;

            try
            {
                var organizations = HttpRuntime.Cache.GetOrInsert <List <Models.Shared.Organization> >("Organizations", () => OrganizationDataAccessor.GetAllOrganizations());

                RequestResult result = CheckItemDataAccessor.GetTreeItems(organizations, new Guid(refOrganizationId), new Guid(organizationId), type);

                if (result.IsSuccess)
                {
                    jsonTree = JsonConvert.SerializeObject((List <TreeItem>)result.Data);
                }
                else
                {
                    jsonTree = string.Empty;
                }
            }
            catch (Exception ex)
            {
                Logger.Log(MethodBase.GetCurrentMethod(), ex);

                jsonTree = string.Empty;
            }

            return(Content(jsonTree));
        }
Exemplo n.º 3
0
        public ActionResult InitTree()
        {
            try
            {
                var organizations = HttpRuntime.Cache.GetOrInsert <List <Models.Shared.Organization> >("Organizations", () => OrganizationDataAccessor.GetAllOrganizations());

                var account = Session["Account"] as Account;

                RequestResult result = new RequestResult();

                if (account.RootOrganizationId == new Guid())
                {
                    result = CheckItemDataAccessor.GetTreeItems(organizations, account.RootOrganizationId, "", Session["Account"] as Account);
                }
                else
                {
                    result = CheckItemDataAccessor.GetRootTreeItems(organizations, account.RootOrganizationId, Session["Account"] as Account);
                }

                if (result.IsSuccess)
                {
                    return(PartialView("_Tree", JsonConvert.SerializeObject((List <TreeItem>)result.Data)));
                }
                else
                {
                    return(PartialView("_Error", result.Error));
                }
            }
            catch (Exception ex)
            {
                var err = new Error(MethodBase.GetCurrentMethod(), ex);

                Logger.Log(err);

                return(PartialView("_Error", err));
            }
        }