コード例 #1
0
        public void ImportFlowChartWUXI_M(FlowChartImport importItem, int accountID)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    FlowChart_Master flMasterItem = new FlowChart_Master();
                    flMasterItem = AutoMapper.Mapper.Map <FlowChart_Master>(importItem.FlowChartMasterDTO);
                    flowChartMasterRepository.Add(flMasterItem);

                    foreach (var detailDTOItem in importItem.FlowChartImportDetailDTOList)
                    {
                        var detailItem = AutoMapper.Mapper.Map <FlowChart_Detail>(detailDTOItem.FlowChartDetailDTO);
                        flMasterItem.FlowChart_Detail.Add(detailItem);

                        //var mgDataItem = AutoMapper.Mapper.Map<FlowChart_MgData>(detailDTOItem.FlowChartMgDataDTO);
                        //detailItem.FlowChart_MgData.Add(mgDataItem);
                    }
                    unitOfWork.Commit();
                    //将数据插入到中间表
                    flowChartMasterRepository.ExecSPTemp(importItem);
                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }