Esempio n. 1
0
        /// <summary>
        /// Выполнение импорта в соответствии с требуемым действием.
        /// </summary>
        /// <param name="action">Действие.</param>
        /// <param name="xlsxPath">Входной файл.</param>
        /// <param name="extraParameters">Дополнительные параметры.</param>
        /// <param name="logger">Логировщик.</param>
        /// <returns>Соответствующий тип сущности.</returns>
        static void ProcessByAction(string action, string xlsxPath, Dictionary <string, string> extraParameters, NLog.Logger logger)
        {
            switch (action)
            {
            case "importcompany":
                logger.Info("Импорт сотрудников");
                logger.Info("-------------");
                EntityProcessor.Procces(typeof(Employee), xlsxPath, Constants.SheetNames.Employees, extraParameters, logger);
                logger.Info("Импорт НОР");
                logger.Info("-------------");
                EntityProcessor.Procces(typeof(BusinessUnit), xlsxPath, Constants.SheetNames.BusinessUnits, extraParameters, logger);
                logger.Info("Импорт подразделений");
                logger.Info("-------------");
                EntityProcessor.Procces(typeof(Department), xlsxPath, Constants.SheetNames.Departments, extraParameters, logger);
                break;

            case "importcompanies":
                EntityProcessor.Procces(typeof(Company), xlsxPath, Constants.SheetNames.Companies, extraParameters, logger);
                break;

            case "importpersons":
                EntityProcessor.Procces(typeof(Person), xlsxPath, Constants.SheetNames.Persons, extraParameters, logger);
                break;

            case "importcontracts":
                EntityProcessor.Procces(typeof(Contract), xlsxPath, Constants.SheetNames.Contracts, extraParameters, logger);
                break;

            case "importsupagreements":
                EntityProcessor.Procces(typeof(SupAgreement), xlsxPath, Constants.SheetNames.SupAgreements, extraParameters, logger);
                break;

            case "importincomingletters":
                EntityProcessor.Procces(typeof(IncomingLetter), xlsxPath, Constants.SheetNames.IncomingLetters, extraParameters, logger);
                break;

            case "importoutgoingletters":
                EntityProcessor.Procces(typeof(OutgoingLetter), xlsxPath, Constants.SheetNames.OutgoingLetters, extraParameters, logger);
                break;

            case "importorders":
                EntityProcessor.Procces(typeof(Order), xlsxPath, Constants.SheetNames.Orders, extraParameters, logger);
                break;

            default:
                break;
            }
        }