예제 #1
0
        private void Parse(PhoneExcelData excelData, PhoneColumnNames column, int i)
        {
            switch (column)
            {
            case PhoneColumnNames.Name:
                currentPhone.Name = _nameParser.TryParse(excelData, i);
                break;

            case PhoneColumnNames.Price:
                currentPhone.Price = _priceParser.TryParse(excelData, i);
                break;

            case PhoneColumnNames.Description:
                currentPhone.Description = _descriptionParser.TryParse(excelData, i);
                break;

            case PhoneColumnNames.Manufacturer:
                currentPhone.Manufacturer = new ManufacturerDto
                {
                    Id = _manufacturerParser.TryParse(excelData, i)
                };
                break;

            case PhoneColumnNames.RAM:
                currentPhone.RAM = _ramParser.TryParse(excelData, i);
                break;

            case PhoneColumnNames.ROM:
                currentPhone.ROM = _romParser.TryParse(excelData, i);
                break;

            case PhoneColumnNames.CPU:
                currentPhone.CPU = _cpuParser.TryParse(excelData, i);
                break;

            case PhoneColumnNames.BatteryCapacity:
                currentPhone.BatteryCapacity = _batteryCapacityParser.TryParse(excelData, i);
                break;

            case PhoneColumnNames.ScreenDiagonal:
                currentPhone.ScreenDiagonal = _screenDiagonalParser.TryParse(excelData, i);
                break;

            case PhoneColumnNames.Camera:
                currentPhone.Camera = _cameraParser.TryParse(excelData, i);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(column), column, null);
            }
        }
예제 #2
0
        private void Parse(ElectronicBookExcelData excelData, ElectronicBookColumnNames column, int i)
        {
            switch (column)
            {
            case ElectronicBookColumnNames.Name:
                currentElectronicBook.Name = _nameParser.TryParse(excelData, i);
                break;

            case ElectronicBookColumnNames.Price:
                currentElectronicBook.Price = _priceParser.TryParse(excelData, i);
                break;

            case ElectronicBookColumnNames.Description:
                currentElectronicBook.Description = _descriptionParser.TryParse(excelData, i);
                break;

            case ElectronicBookColumnNames.Manufacturer:
                currentElectronicBook.Manufacturer = new ManufacturerDto
                {
                    Id = _manufacturerParser.TryParse(excelData, i)
                };
                break;

            case ElectronicBookColumnNames.ScreenDiagonal:
                currentElectronicBook.ScreenDiagonal = _screenDiagonalParser.TryParse(excelData, i);
                break;

            case ElectronicBookColumnNames.ScreenType:
                currentElectronicBook.ScreenType = new ScreenTypeDto
                {
                    Id = _screenTypeParser.TryParse(excelData, i)
                };
                break;

            case ElectronicBookColumnNames.BatteryCapacity:
                currentElectronicBook.BatteryCapacity = _batteryCapacityParser.TryParse(excelData, i);
                break;

            case ElectronicBookColumnNames.WorkingTime:
                currentElectronicBook.WorkingTime = _workingTimeParser.TryParse(excelData, i);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(column), column, null);
            }
        }
예제 #3
0
        private void Parse(SmartWatchExcelData excelData, SmartWatchColumnNames column, int i)
        {
            switch (column)
            {
            case SmartWatchColumnNames.Name:
                currentSmartWatch.Name = _nameParser.TryParse(excelData, i);
                break;

            case SmartWatchColumnNames.Price:
                currentSmartWatch.Price = _priceParser.TryParse(excelData, i);
                break;

            case SmartWatchColumnNames.Description:
                currentSmartWatch.Description = _descriptionParser.TryParse(excelData, i);
                break;

            case SmartWatchColumnNames.Manufacturer:
                currentSmartWatch.Manufacturer = new ManufacturerDto
                {
                    Id = _manufacturerParser.TryParse(excelData, i)
                };
                break;

            case SmartWatchColumnNames.InterfaceForConnecting:
                currentSmartWatch.InterfaceForConnecting = new InterfaceForConnectingDto {
                    Id = _connectionTypeParser.TryParse(excelData, i)
                };
                break;

            case SmartWatchColumnNames.ScreenDiagonal:
                currentSmartWatch.ScreenDiagonal = _screenDiagonalParser.TryParse(excelData, i);
                break;

            case SmartWatchColumnNames.Pulsometer:
                currentSmartWatch.Pulsometer = _pulsometerParser.TryParse(excelData, i);
                break;

            case SmartWatchColumnNames.SimCard:
                currentSmartWatch.SimCard = _simCardParser.TryParse(excelData, i);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(column), column, null);
            }
        }