Prizm.Main.Synch.Export.DataExporter.Export C# (CSharp) Method

Export() public method

public Export ( ) : ExportResult
return ExportResult
        public override ExportResult Export()
        {
            IList<Pipe> pipesToExport = new List<Pipe>();
            IList<Joint> jointsToExport = new List<Joint>();
            IList<Component> componentsToExport = new List<Component>();
            try
            {
                pipesToExport = exportRepo.PipeRepo.GetPipesToExport();
                jointsToExport = exportRepo.JointRepo.GetJointsToExport();
                componentsToExport = exportRepo.ComponentRepo.GetComponentsToExport();
            }
            catch(RepositoryException ex)
            {
                log.Warn(this.GetType().Name + " | " + ex.ToString());
            }

            exportRepo.PortionRepo.BeginTransaction();

            Portion portion = new Portion()
            {
                ExportDateTime = DateTime.Now,
                IsExport = true,
                PortionNumber = exportRepo.PortionRepo.GetPortionNumber(exportRepo.ProjectRepo.GetSingle()),
                Project = exportRepo.ProjectRepo.GetSingle()
            };

            foreach(var pipe in pipesToExport)
            {
                portion.Pipes.Add(pipe);
            }

            foreach(var joint in jointsToExport)
            {
                portion.Joints.Add(joint);
            }

            foreach(var component in componentsToExport)
            {
                portion.Components.Add(component);
            }

            exportRepo.PortionRepo.SaveOrUpdate(portion);
            exportRepo.PortionRepo.Commit();

            return Export(portion);
        }

Same methods

DataExporter::Export ( Portion portion ) : ExportResult