Пример #1
0
    public void ShowTreeView(object sender)
    {
        string flowCode = ((object[])sender)[0].ToString();
        string itemCode = ((object[])sender)[1].ToString();

        if (TheFlowMgr.LoadFlow(flowCode) == null)
        {
            ShowErrorMessage("Common.Business.Warn.FlowInvalid");
            return;
        }
        if (TheItemMgr.LoadItem(itemCode) == null)
        {
            ShowErrorMessage("Common.Business.Warn.ItemInvalid");
            return;
        }

        supplyChain = TheSupplyChainMgr.GenerateSupplyChain(flowCode, itemCode)[0];
        supplyChainDetailList = supplyChain.SupplyChainDetails;

        if (supplyChainDetailList != null && supplyChainDetailList.Count > 0)
        {
            MyOrgNode RootNode = new MyOrgNode();
            GenChildOrgNode(RootNode);
            OrgChartTreeView.Node = RootNode;
        }
    }
        public SupplyChain GenerateSupplyChain(Flow flow, FlowDetail flowDetail)
        {
            SupplyChain supplyChain = new SupplyChain();
            supplyChain.Flow = flow;
            supplyChain.FlowDetail = flowDetail;

            SupplyChainDetail supplyChainDetail = new SupplyChainDetail();
            supplyChainDetail.SupplyChain = supplyChain;
            supplyChainDetail.Id = 1;
            supplyChainDetail.ParentId = 0;
            supplyChainDetail.Flow = flow;
            supplyChainDetail.FlowDetail = flowDetail;
            supplyChainDetail.LocationTo = flowDetail.DefaultLocationTo == null ? null : flowDetail.DefaultLocationTo;
            supplyChainDetail.QuantityPer = 1;

            IList<SupplyChainDetail> supplyChainDetailList = new List<SupplyChainDetail>();
            supplyChainDetailList.Add(supplyChainDetail);
            this.GetSupplyChainDetail(supplyChainDetailList, supplyChainDetail);

            supplyChain.AddRangeSupplyChainDetail(supplyChainDetailList);
            return supplyChain;
        }