static void InitData(long tid) { ExcelImportor auxiliaryDtl = new ExcelImportor(tid, new AuxiliaryDTL()); auxiliaryDtl.Import(); ExcelImportor accountSubjectDtl = new ExcelImportor(tid, new AccountSubjectDTL()); accountSubjectDtl.Import(); ExcelImportor systemProfileDtl = new ExcelImportor(tid, new SystemProfileDTL()); systemProfileDtl.Import(); ExcelImportor balanceSheetDtl = new ExcelImportor(tid, new BalanceSheetDTL()); balanceSheetDtl.Import(); ExcelImportor profitSheetDTL = new ExcelImportor(tid, new ProfitSheetDTL()); profitSheetDTL.Import(); ExcelImportor cashflowSheetDTL = new ExcelImportor(tid, new CashflowSheetDTL()); cashflowSheetDTL.Import(); }
static void InitData(long tid) { try { ExcelImportor auxiliaryDtl = new ExcelImportor(tid, new AuxiliaryDTL()); auxiliaryDtl.Import(); ExcelImportor accountSubjectDtl = new ExcelImportor(tid, new AccountSubjectDTL()); accountSubjectDtl.Import(); ExcelImportor systemProfileDtl = new ExcelImportor(tid, new SystemProfileDTL()); systemProfileDtl.Import(); ExcelImportor balanceSheetDtl = new ExcelImportor(tid, new BalanceSheetDTL()); balanceSheetDtl.Import(); ExcelImportor profitSheetDTL = new ExcelImportor(tid, new ProfitSheetDTL()); profitSheetDTL.Import(); ExcelImportor cashflowSheetDTL = new ExcelImportor(tid, new CashflowSheetDTL()); cashflowSheetDTL.Import(); } catch (FinanceException e) { logger.Error(e.Message); } }
public FinanceResponse Upload(HttpRequestMessage request) { try { string relativePath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; string path = Path.GetFullPath(relativePath + ".Cache/") + SerialNoService.GetUUID() + ".xls"; FileStream fs = new FileStream(path, FileMode.Append); BinaryWriter w = new BinaryWriter(fs); fs.Position = fs.Length; request.Content.CopyToAsync(fs).Wait(); w.Close(); fs.Close(); var query = request.GetQueryNameValuePairs(); string name = ""; foreach (var kv in query) { if (kv.Key == "name") { name = kv.Value; break; } } IImportHandler dtl = null; switch (name) { case "BalanceSheet": dtl = new BalanceSheetDTL(); break; case "ProfitSheet": dtl = new ProfitSheetDTL(); break; } if (dtl == null) { return(CreateResponse(FinanceResult.SYSTEM_ERROR)); } dtl.SetFileName(path); ExcelImportor importor = new ExcelImportor(long.Parse(Tid), dtl); importor.Import(); return(CreateResponse(FinanceResult.SUCCESS)); } catch { return(CreateResponse(FinanceResult.SYSTEM_ERROR)); } }