예제 #1
0
        public void CreateFile(IExcelRepository excelRepository, string path)
        {
            Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();

            if (xlApp == null)
            {
                return;
            }

            Microsoft.Office.Interop.Excel.Workbook  xlWorkBook;
            Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
            object misValue = System.Reflection.Missing.Value;

            xlWorkBook  = xlApp.Workbooks.Add(misValue);
            xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

            Save(excelRepository, xlWorkSheet);
            xlWorkSheet.Columns.AutoFit();

            xlApp.DisplayAlerts = false;
            xlWorkBook.SaveAs(path, Microsoft.Office.Interop.Excel.XlFileFormat.xlOpenXMLWorkbook, misValue,
                              misValue, misValue, misValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);


            xlWorkBook.Close(true, misValue, misValue);
            xlApp.Quit();

            Marshal.ReleaseComObject(xlWorkSheet);
            Marshal.ReleaseComObject(xlWorkBook);
            Marshal.ReleaseComObject(xlApp);
        }
예제 #2
0
        private void Save(IExcelRepository excelRepository, Microsoft.Office.Interop.Excel.Worksheet worksheet)
        {
            int counter = 0; int a = 0; int b = 0;

            foreach (DataRow row in excelRepository.GetData().Rows)
            {
                a++; b++;
                counter++;
                if (counter == 1)
                {
                    worksheet.Cells[a, b] = "Item";
                    b++;
                    worksheet.Cells[a, b] = "Operation";
                    b++;
                    worksheet.Cells[a, b] = "Sart Time";
                    b++;
                    worksheet.Cells[a, b] = "End Time";
                    b++;
                    worksheet.Cells[a, b] = "Count";
                    b = 0;
                    a++; b++;
                }
                worksheet.Cells[a, b] = row["Item"].ToString();
                b++;
                worksheet.Cells[a, b] = row["Name"].ToString();
                b++;
                worksheet.Cells[a, b] = row["StartTime"].ToString();
                b++;
                worksheet.Cells[a, b] = row["EndTime"].ToString();
                b++;
                worksheet.Cells[a, b] = row["Count"].ToString();
                b = 0;
            }
        }
예제 #3
0
 public AeronaveController(IAeronaveAppService aeronaveAppService, IExcelRepository <Aeronave> excelRepository, IAeronaveCsvRepository aeronaveCsvRepository, IModeloAeronaveAppService modeloAeronaveAppService)
 {
     _aeronaveAppService       = aeronaveAppService;
     _excelRepository          = excelRepository;
     _aeronaveCsvRepository    = aeronaveCsvRepository;
     _modeloAeronaveAppService = modeloAeronaveAppService;
 }
 public RareDiseaseController(ILocalMemoryCache localMemoryCache, ILogger <RareDiseaseController> logger, ILogRepository logRepository, IRdrDataRepository rdrDataRepository, INLPSystemRepository nLPSystemRepository, IExcelRepository excelRepository)
 {
     _localMemoryCache    = localMemoryCache;
     _logger              = logger;
     _logRepository       = logRepository;
     _rdrDataRepository   = rdrDataRepository;
     _nLPSystemRepository = nLPSystemRepository;
     _excelRepository     = excelRepository;
 }
예제 #5
0
 public FileExcelService(FileWrapper fw)
 {
     this.fw = fw;
     _fileExcelRepository   = new ExcelRepository();
     _excelDetailRepository = new ExcelDetailRepository();
     _oraTruckRepository    = new OraTruckRepository();
     _assignService         = new AssignService();
     _oraVoyageService      = new OraVoyageService();
     _oraVoyageRepository   = new OraVoyageRepository();
     _oraTruckService       = new OraTruckService();
 }
예제 #6
0
 public ExcelController(IHostingEnvironment host, IExcelRepository excelRepository,
                        IStudentRepository studentRepository, ILecturerRepository lecturerRepository,
                        IMapper mapper, IUnitOfWork unitOfWork)
 {
     this.host               = host;
     this.mapper             = mapper;
     this.unitOfWork         = unitOfWork;
     this.excelRepository    = excelRepository;
     this.studentRepository  = studentRepository;
     this.lecturerRepository = lecturerRepository;
 }
예제 #7
0
        public void EndCanBeDelimitted()
        {
            IEnumerable <ITestDomainObject> testData_Attributes;

            using (var context = Factory.FluentApi.GetContext())
                using (var fileOptions = Factory.GetExcelFileOptions())
                    using (IExcelRepository <DomainObject_FluentApi, int> repo
                               = Factory.FluentApi.GetRepo_EndIndicator(context, fileOptions)) {
                        Assert.Equal(UnitTestMetadata.ExcelDataCount, repo.Count());
                        Assert.Equal(UnitTestMetadata.ExcelDataCount, repo.GetAll().Count());
                    }
        }
예제 #8
0
 public ProjectController(ApplicationDbContext context, IMapper mapper, IUnitOfWork unitOfWork,
                          IProjectRepository projectRepository, IMajorRepository majorRepository,
                          IHostingEnvironment host, IExcelRepository excelRepository, ILecturerRepository lecturerRepository)
 {
     this.context           = context;
     this.mapper            = mapper;
     this.unitOfWork        = unitOfWork;
     this.projectRepository = projectRepository;
     this.majorRepository   = majorRepository;
     this.host               = host;
     this.excelRepository    = excelRepository;
     this.lecturerRepository = lecturerRepository;
 }
예제 #9
0
 public LecturerController(ApplicationDbContext context, IMapper mapper,
                           ILecturerRepository lecturerRepository, IUnitOfWork unitOfWork,
                           UserManager <ApplicationUser> userManager, IMajorRepository majorRepository,
                           IHostingEnvironment host, IExcelRepository excelRepository)
 {
     this.userManager        = userManager;
     this.context            = context;
     this.mapper             = mapper;
     this.lecturerRepository = lecturerRepository;
     this.majorRepository    = majorRepository;
     this.unitOfWork         = unitOfWork;
     this.host            = host;
     this.excelRepository = excelRepository;
 }
예제 #10
0
 public BoardController(IMapper mapper, IUnitOfWork unitOfWork,
                        IBoardRepository boardRepository, IGroupRepository groupRepository,
                        IBoardEnrollmentRepository boardEnrollmentRepository, IHostingEnvironment host,
                        IExcelRepository excelRepository, IConfiguration config)
 {
     this.mapper                    = mapper;
     this.unitOfWork                = unitOfWork;
     this.boardRepository           = boardRepository;
     this.groupRepository           = groupRepository;
     this.boardEnrollmentRepository = boardEnrollmentRepository;
     this.host            = host;
     this.excelRepository = excelRepository;
     this.config          = config;
 }
예제 #11
0
 public StudentController(IHubContext <PMSHub> hubContext, ApplicationDbContext context,
                          IMapper mapper, IStudentRepository studentRepository,
                          IUnitOfWork unitOfWork, UserManager <ApplicationUser> userManager,
                          IMajorRepository majorRepository, IHostingEnvironment host, IExcelRepository excelRepository)
 {
     this.userManager       = userManager;
     this.context           = context;
     this.mapper            = mapper;
     this.studentRepository = studentRepository;
     this.majorRepository   = majorRepository;
     this.unitOfWork        = unitOfWork;
     this.hubContext        = hubContext;
     this.host            = host;
     this.excelRepository = excelRepository;
 }
예제 #12
0
        public MainWindowViewModel(
            IEventAggregator eventAggregator,
            ILoggerFacade logger,
            IExcelRepository excelRepository,
            IOpenFileDialogService openFileDialogService,
            ApplicationState applicationState)
        {
            _eventAggregator       = eventAggregator;
            _logger                = logger;
            _excelRepository       = excelRepository;
            _openFileDialogService = openFileDialogService;
            _applicationState      = applicationState;

            FileOpenCommand = new DelegateCommand(FileOpen, CanFileOpen);
            SaveOpenCommand = new DelegateCommand(FileSave, CanFileSave);
            CancelCommand   = new DelegateCommand(Cancel, CanCancel);
            RunCloudCommand = new DelegateCommand(RunCloud, CanRunCloud);
        }
예제 #13
0
 public DiscountCodeController()
 {
     discountcodeRepository = new ExcelRepository <DiscountCode>(Path.GetDirectoryName(Application.ExecutablePath) + "\\" + ConfigurationManager.AppSettings["ExcelString"]);
 }
예제 #14
0
        public ProductRepositoryTests()
        {
            var xx = DateTime.Now.ToString("dd/MM/yyyy");

            productRepository = new ExcelRepository <Product>(@"D:\repos\Rpms\RPMS\RPMS\Configuration.xlsx");
        }
예제 #15
0
 public ProductController()
 {
     productRepository = new ExcelRepository <Product>(Path.GetDirectoryName(Application.ExecutablePath) + "\\" + ConfigurationManager.AppSettings["ExcelString"]);
 }
예제 #16
0
 public TaxController()
 {
     taxRepository = new ExcelRepository <Tax>(Path.GetDirectoryName(Application.ExecutablePath) + "\\" + ConfigurationManager.AppSettings["ExcelString"]);
 }
 public ExcelService(IExcelRepository repository)
 {
     this.repository = repository;
 }
 public ExcelService(IExcelRepository rep)
 {
     _rep = rep;
 }
예제 #19
0
 public ExcelController(IExcelRepository ExcelRepository)
 {
     _ExcelRepository = ExcelRepository;
 }
 public ExcelService(IExcelRepository repo)
 {
     repository = repo;
 }
예제 #21
0
 public ExcelController(IExcelRepository excelRepository)
 {
     _excelRepository = excelRepository;
 }
예제 #22
0
 /// <summary>
 /// Construtor de classe com acesso ao repositório
 /// </summary>
 /// <param name="repo">Repositório de Autorização</param>
 public ExcelController(IExcelRepository repo)
 {
     _repo = repo;
 }
 public FileUploadController(IExcelRepository excelRepository)
 {
     _excelRepository = excelRepository;
 }