private void ProcessData(IWindsorContainer container)
        {
            log.Info("Start process data according to DssInboundControl table.");
            IList <DssInboundControl> dssInboundControlList = this.dssInboundControlMgr.GetDssInboundControl();

            if (dssInboundControlList != null && dssInboundControlList.Count > 0)
            {
                foreach (DssInboundControl dssInboundControl in dssInboundControlList)
                {
                    string      serviceName = dssInboundControl.ServiceName;
                    IInboundMgr processor   = container.Resolve <IInboundMgr>(serviceName);
                    processor.ProcessInboundRecord(dssInboundControl);
                }
            }
            else
            {
                log.Info("No record found in DssInboundControl table.");
            }

            log.Info("End process data according to DssInboundControl table.");
        }
Exemple #2
0
        private void ImportData(IWindsorContainer container)
        {
            log.Info("Start import data file according to DssInboundControl table.");
            IList <DssInboundControl> dssInboundControlList = this.dssInboundControlMgr.GetDssInboundControl();

            if (dssInboundControlList != null && dssInboundControlList.Count > 0)
            {
                foreach (DssInboundControl dssInboundControl in dssInboundControlList)
                {
                    string inFloder      = dssInboundControl.InFloder;
                    string filePattern   = dssInboundControl.FilePattern;
                    string serviceName   = dssInboundControl.ServiceName;
                    string archiveFloder = dssInboundControl.ArchiveFloder;
                    string errorFloder   = dssInboundControl.ErrorFloder;
                    string fileEncoding  = dssInboundControl.FileEncoding;

                    if (fileEncoding == null || fileEncoding.Trim() == string.Empty)
                    {
                        fileEncoding = this.defaultFileEncoding;
                    }

                    log.Info("Start import data, floder: " + inFloder + ", filePattern: " + filePattern + ", serviceName: " + serviceName);

                    string[] files = null;
                    if (Directory.Exists(inFloder))
                    {
                        if (filePattern != null)
                        {
                            files = Directory.GetFiles(inFloder, filePattern);
                        }
                        else
                        {
                            files = Directory.GetFiles(inFloder);
                        }
                    }

                    if (files != null && files.Length > 0)
                    {
                        try
                        {
                            IInboundMgr processor = container.Resolve <IInboundMgr>(serviceName);
                            processor.ProcessInboundFile(dssInboundControl, files);
                        }
                        catch (Exception ex)
                        {
                            log.Error("Process inbound error: ", ex);
                        }
                    }
                    else
                    {
                        log.Info("No files found to process.");
                    }
                }
            }
            else
            {
                log.Info("No record found in DssInboundControl table.");
            }

            log.Info("End import data file according to DssInboundControl table.");
        }