public static EntityData GetUnitAllChildAndSelf(string parentCode) { EntityData data3; try { string text = ""; EntityData unitByCode = GetUnitByCode(parentCode); if (unitByCode.HasRecord()) { text = unitByCode.GetString("FullCode"); } else { text = "null"; } unitByCode.Dispose(); UnitStrategyBuilder builder = new UnitStrategyBuilder(); builder.AddStrategy(new Strategy(UnitStrategyName.UnderUnitCode, text)); string queryString = builder.BuildQueryChildCountString() + builder.GetDefaultOrder(); QueryAgent agent = new QueryAgent(); EntityData data2 = agent.FillEntityData("Unit", queryString); agent.Dispose(); data3 = data2; } catch (Exception exception) { throw exception; } return(data3); }
public static EntityData GetUnitBySortID(string SortID) { EntityData data2; try { UnitStrategyBuilder builder = new UnitStrategyBuilder(); builder.AddStrategy(new Strategy(UnitStrategyName.SortID, SortID)); string queryString = builder.BuildQueryChildCountString() + builder.GetDefaultOrder(); QueryAgent agent = new QueryAgent(); EntityData data = agent.FillEntityData("Unit", queryString); agent.Dispose(); data2 = data; } catch (Exception exception) { throw exception; } return(data2); }
public static EntityData GetUnitByUnitName(string UnitName, string projectCode) { EntityData data2; try { UnitStrategyBuilder builder = new UnitStrategyBuilder(); builder.AddStrategy(new Strategy(UnitStrategyName.UnitName, UnitName)); if (projectCode != "") { builder.AddStrategy(new Strategy(UnitStrategyName.ProjectCode, projectCode)); } string queryString = builder.BuildQueryChildCountString() + builder.GetDefaultOrder(); QueryAgent agent = new QueryAgent(); EntityData data = agent.FillEntityData("Unit", queryString); agent.Dispose(); data2 = data; } catch (Exception exception) { throw exception; } return(data2); }