public StatoPatrimonialeService(StatoPatrimoniale statoPatrimoniale) { _statoPatrimoniale = statoPatrimoniale; }
private void ScriviStatoPatrimoniale(int workBookindex, StatoPatrimoniale r, DTORendiconto rendiconto) { try { if (_handler.ExcelInstance == null) { //'creo una nuova istanza di excel _handler.OpenExcelApplication(true); } if (_handler.CurrentWorkbook == null) //'Aggiungo un nuovo documento ad excel { _handler.AddDocumentToExcel(_model); //'lo attivo _handler.ActivateWorkBook(); } //'seleziono lo sheet di interesse _handler.SelectSheetByIndex(workBookindex); _handler.FindReplaceCellValue(10, 10, "#prop#", rendiconto.Proprietario, false, OfficeExcelHandler.FindMode.Table); _handler.FindReplaceCellValue(10, 10, "#anno#", rendiconto.Anno.ToString(), false, OfficeExcelHandler.FindMode.Table); if (_settings.InventarioDisegnaOrizzontalmente) { int currentRow = 1 + _settings.InventarioRigaIniziale; int currentCol = 1; WriteBeniImmobiliOrizzontalmente(r.Immobili, ref currentRow, ref currentCol); WriteDepositiOrizzontalmente(r.Depositi, ref currentRow, ref currentCol); WritePolizzeOrizzontalmente(r.Polizze, ref currentRow, ref currentCol); WriteAutoOrizzontalmente(r.Autos, ref currentRow, ref currentCol); WriteMobiliOrizzontalmente(r.Mobili, ref currentRow, ref currentCol); WriteAccantonamentiTFROrizzontalmente(r.AccantonamentiTFR, ref currentRow, ref currentCol); WriteChiusureOrizzontalmente(r.Chiusure, ref currentRow, ref currentCol); } else { int currentRow = 1 + _settings.InventarioRigaIniziale; int currentCol = 1 + _settings.InventarioColonnaIniziale; WriteBeniImmobiliVerticalmente(r.Immobili, ref currentRow, currentCol); WriteDepositiVerticalmente(r.Depositi, ref currentRow, currentCol); WritePolizzeVerticalmente(r.Polizze, ref currentRow, currentCol); WriteAutoVerticalmente(r.Autos, ref currentRow, currentCol); WriteMobiliVerticalmente(r.Mobili, ref currentRow, currentCol); WriteAccantonamentiTFRVerticalmente(r.AccantonamentiTFR, ref currentRow, currentCol); WriteChiusureVerticalmente(r.Chiusure, ref currentRow, currentCol); } } catch (Exception) { _handler.Dispose(); throw; } }