public ActionResult InitSelectTree(string refOrganizationId) { try { var organizationList = HttpRuntime.Cache.GetOrInsert <List <Models.Shared.Organization> >("Organizations", () => OrganizationDataAccessor.GetAllOrganizations()); RequestResult result = MSpecificationDataAccessor.GetTreeItems(organizationList, 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 e) { var error = new Error(MethodBase.GetCurrentMethod(), e); Logger.Log(error); return(PartialView("_Error", error)); } }
public ActionResult GetSelectTreeItems(string refOrganizationId, string organizationId, string materialType) { string jsonTree = string.Empty; try { var organizationList = HttpRuntime.Cache.GetOrInsert <List <Models.Shared.Organization> >("Organizations", () => OrganizationDataAccessor.GetAllOrganizations()); RequestResult result = MSpecificationDataAccessor.GetTreeItems(organizationList, new Guid(refOrganizationId), new Guid(organizationId), materialType); 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)); }
public ActionResult InitTree() { try { var organizationList = 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 = MSpecificationDataAccessor.GetTreeItems(organizationList, account.RootOrganizationId, "", Session["Account"] as Account); } else { result = MSpecificationDataAccessor.GetRootTreeItem(organizationList, 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)); } }