Пример #1
0
        public List <EisppImportCrimeQualification> GetCrimeQualificationFromExcel(byte[] excelContent, int fromRow)
        {
            NPoiExcelService excelService = new NPoiExcelService(excelContent, 0);
            int  row            = fromRow;
            bool haveData       = true;
            var  structureItems = new List <EisppImportCrimeQualification>();
            int  blankRows      = 0;

            while (blankRows < 10)
            {
                var item = new EisppImportCrimeQualification();
                item.Row = row;
                excelService.rowIndex = row;
                excelService.colIndex = 0;
                item.GroupName4       = excelService.GetValue();
                item.GroupName3       = excelService.GetValue();
                item.GroupName2       = excelService.GetValue();
                item.Name             = excelService.GetValue();
                item.SystemCode       = excelService.GetValue();
                item.SystemName       = excelService.GetValue();
                item.Active           = excelService.GetValue();
                item.DateFrom         = excelService.GetValue();
                item.DateTo           = excelService.GetValue();
                haveData = !string.IsNullOrEmpty(item.Name) || !string.IsNullOrEmpty(item.SystemCode);
                if (haveData)
                {
                    blankRows = 0;
                    structureItems.Add(item);
                }
                else
                {
                    blankRows++;
                }
                row++;
            }
            return(structureItems);
        }
Пример #2
0
        public List <EisppImportNomenclature> GetNomenclatureFromExcel(byte[] excelContent, int fromRow)
        {
            NPoiExcelService excelService = new NPoiExcelService(excelContent, 0);
            int    row       = fromRow;
            bool   haveData  = true;
            var    nomItems  = new List <EisppImportNomenclature>();
            int    blankRows = 0;
            string groupCode = string.Empty;

            while (blankRows < 10)
            {
                var item = new EisppImportNomenclature();
                item.Row = row;
                excelService.rowIndex = row;
                excelService.colIndex = 0;
                item.GroupName        = excelService.GetValue();
                item.Name             = excelService.GetValue();
                item.SystemCode       = excelService.GetValue();
                item.SystemName       = excelService.GetValue();
                item.Active           = excelService.GetValue();
                item.DateFrom         = excelService.GetValue();
                item.DateTo           = excelService.GetValue();
                item.GroupCode        = groupCode;
                haveData = !string.IsNullOrEmpty(item.GroupName) && !string.IsNullOrEmpty(item.SystemCode);
                if (haveData)
                {
                    if (string.IsNullOrEmpty(item.Name))
                    {
                        groupCode      = item.SystemCode;
                        item.GroupCode = null;
                    }
                    blankRows = 0;
                    nomItems.Add(item);
                }
                else
                {
                    blankRows++;
                }
                row++;
            }
            return(nomItems);
        }
Пример #3
0
        public List <EisppImportEktte> GetEktteFromExcel(byte[] excelContent, int fromRow)
        {
            NPoiExcelService excelService = new NPoiExcelService(excelContent, 0);
            int  row        = fromRow;
            bool haveData   = true;
            var  ektteItems = new List <EisppImportEktte>();

            while (haveData)
            {
                var item = new EisppImportEktte();
                item.Row = row;
                excelService.rowIndex = row;
                excelService.colIndex = 0;
                item.Oblast           = excelService.GetValue();
                item.Obstina          = excelService.GetValue();
                item.TypeNM           = excelService.GetValue();
                item.Name             = excelService.GetValue();
                item.Rajon            = excelService.GetValue();
                item.SystemCode       = excelService.GetValue();
                item.SystemName       = excelService.GetValue();
                item.EktteCode        = excelService.GetValue();
                item.Active           = excelService.GetValue();
                item.DateFrom         = excelService.GetValue();
                item.DateTo           = excelService.GetValue();
                haveData = !string.IsNullOrEmpty(item.Oblast);
                if (haveData)
                {
                    ektteItems.Add(item);
                }
                row++;
            }
            return(ektteItems);
        }