コード例 #1
0
        public static SendingTask CreateSendingTask(string file, Folder folder)
        {
            var fileInfo = new System.IO.FileInfo(file);

            string recipient;

            if (fileInfo.Name.Substring(0, 1).Contains("Р") || fileInfo.Name.Substring(0, 1).Contains("P"))
            {
                var regionCode = string.Empty;
                if (fileInfo.Name.ToLower().Contains("uprmes"))
                {
                    regionCode = fileInfo.Name.Substring(3, 2);
                }
                else
                {
                    if (fileInfo.Name.ToLower().Contains("uprak"))
                    {
                        regionCode = fileInfo.Name.Substring(1, 2);
                    }
                }

                var fomsDataService = new FomsDataService(MainSheduler.MonitoringConfig.FomsDbConnectionString,
                                                          MainSheduler.Logger);
                recipient = fomsDataService.GetOkatoByInstitutionCode(regionCode);
            }
            else
            {
                recipient = (string.IsNullOrEmpty(folder.Recipient))
                            // Получатель первые 5 символов в названии файла если не указан в настройках для папки
                            // Пример для файла 57000-10756-04.uprmes это 57000
                    ? fileInfo.Name.Substring(0, 5)
                    : folder.Recipient;
            }

            return(new SendingTask()
            {
                Id = Guid.NewGuid(),
                Status = TaskStatus.New,
                Path = file,
                Recipient = recipient,
                Name = fileInfo.Name,
                CreateDate = fileInfo.CreationTime
            });
        }
コード例 #2
0
ファイル: ExcelDoc.cs プロジェクト: rdemint/qmsHero
 public ExcelDoc(System.IO.FileInfo fileInfo) : base()
 {
     this.FileInfo  = fileInfo;
     this.DocConfig = new ExcelDocConfig();
 }