Beispiel #1
0
 /// <summary>
 /// 刷新
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bbiRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     DoWork("加载清单中...", "加载清单中...", () =>
     {
         viewModel              = new ContractBoqViewModel(ProjectNo, ProjectName);
         viewModel.ListChanged += RefreshBottomBar;
         viewModel.Load();
     }, (myException) =>
     {
         if (myException == null)
         {
             tlDetail.DataSource = viewModel.NodeList;
             RefreshStat();
         }
     });
 }
Beispiel #2
0
 /// <summary>
 /// 窗体装载
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmPrjBoq_Load(object sender, EventArgs e)
 {
     DoWork("加载清单中...", "加载清单中...", () =>
     {
         viewModel              = new ContractBoqViewModel(ProjectNo, ProjectName);
         viewModel.ListChanged += RefreshBottomBar;
         viewModel.Load();
     }, (myException) =>
     {
         if (myException == null)
         {
             tlDetail.DataSource = viewModel.NodeList;
             RefreshStat();
         }
     });
     //  this.ParentForm.Shown += ParentForm_Shown;
 }
        private void bbi_import_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ////导入WBS
            //if (openFileDialog1.ShowDialog() == DialogResult.OK)
            //{
            //    List<WBSline> lines = ExcelHelper.Import(openFileDialog1.FileName);
            //    lines.ForEach(m =>
            //    {
            //        m.ProjectNo = viewModel.ProjectNo;
            //    });
            //    IWBSBoq wbsBoq = new MeteringPaymentClient().GetIWBSBoqService();
            //    wbsBoq.ImportWBS(viewModel.Boq.WbsNo, lines);
            //}


            //导入关联
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                List <WbsInfo> lines     = ExcelHelper.ImportWbsInfo(openFileDialog1.FileName);
                IWBSBoq        wbsBoq    = new MeteringPaymentClient().GetIWBSBoqService();
                List <WbsInfo> leafLines = new List <WbsInfo>();
                lines.ForEach(m =>
                {
                    GetLeafNodes(leafLines, m);
                });
                ContractBoqViewModel cVModel = new ContractBoqViewModel(viewModel.ProjectNo, viewModel.ProjectName);
                cVModel.Load();
                int k = 0;
                leafLines.ForEach(m =>
                {
                    m.Details.ForEach(n =>
                    {
                        ContractBoi boi = cVModel.Boq.BoiList.Find(x => x.IItemCoe == n.BoiCode /*&& x.ItemName == n.BoiName*/);
                        if (boi != null)
                        {
                            viewModel.InsertNodeRelation(m.WbsCode, boi.ItemNo, n.Qty);
                        }
                        k++;
                    });
                });
            }


            ////更新图纸桩号
            //if (openFileDialog1.ShowDialog() == DialogResult.OK)
            //{
            //    List<WbsInfo> lines = ExcelHelper.ImportWbsInfo(openFileDialog1.FileName);
            //    IWBSBoq wbsBoq = new MeteringPaymentClient().GetIWBSBoqService();
            //    List<WbsInfo> leafLines = new List<WbsInfo>();
            //    lines.ForEach(m =>
            //    {
            //        GetLeafNodes(leafLines, m);
            //    });
            //    List<WBSLineNode> nodeList = new List<WBSLineNode>(viewModel.NodeBindingSource);
            //    leafLines.ForEach(m =>
            //    {
            //        WBSLineNode line = nodeList.Find(n => n.WbsSysCode == m.WbsCode);
            //        line.DrawNo = m.DrawNo;
            //        line.StartStakesNo = m.StartNo;
            //        line.EndStakesNo = m.EndNo;
            //    });
            //}
        }