public static IList <ReportFile> ReadFiles(int year, int month) { //Put names of files here. string[] fileNames = new string[] { "{0:YYYYMMDD}----1234D.dat", "{0:YYYYMMDD}----5678D.dat" }; DateTime dateStart = new DateTime(year, month, 1); //start of month DateTime dateEnd = dateStart.AddMonths(1); //start of NEXT month (i.e. 1 day past end of this month) var reportList = new List <ReportFile>(); DateTime date = dateStart; while (date < dateEnd) //we don't actually get to dateEnd, just the day before it. { foreach (var fileTemplate in fileNames) { //insert the date in YYYYMMDD format var file = string.Format(fileTemplate, date); if (File.Exists(file)) { var report = new ReportFile() { Date = date, Path = file, Lines = GetReportLines(file) }; reportList.Add(report); } } //now jump to next day date = date.AddDays(1); } return(reportList); }
private void btnSelectFiles_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Файл CSV|*.CSV"; openFileDialog.Multiselect = true; DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.Cancel) { MessageBox.Show("Файл не выбран!", "Информация", MessageBoxButtons.YesNo, MessageBoxIcon.Information); return; } checkedLstFiles.Items.Clear(); foreach (string item in openFileDialog.FileNames) { ReportFile reportFile = new ReportFile() { ReportFileName = Path.GetFileName(item), ReportFullPath = Path.GetFullPath(item), ReportPath = Path.GetDirectoryName(item) }; checkedLstFiles.Items.Add(reportFile); } }
public void NewFile() { Microsoft.Win32.OpenFileDialog addFileOpenDialog = new Microsoft.Win32.OpenFileDialog(); addFileOpenDialog.Title = "Select Files:"; addFileOpenDialog.Filter = "All Files (*.*)|*.*"; addFileOpenDialog.FilterIndex = 1; addFileOpenDialog.Multiselect = true; // Display the FileOpen Dialog bool? userClickedOk = addFileOpenDialog.ShowDialog(); if (userClickedOk == true) { foreach (String file in addFileOpenDialog.FileNames) { ReportFile rFile = new ReportFile(); rFile.fileName = System.IO.Path.GetFileNameWithoutExtension(file); rFile.filePath = System.IO.Path.GetDirectoryName(file); rFile.fileType = System.IO.Path.GetExtension(file); rFile.fileOld = System.IO.Path.GetFullPath(file); rFile.fileNameNew = CleanupProcess(rFile.fileName); if(rFile.fileNameNew == null) { System.Windows.MessageBox.Show("Filename was not in an expected format:" + "\n" + "Could not find valid PN or PO."); return; } else reports.Add(rFile); } } // Refresh the ItemsSource in the DataGrid. this.fileGridSelected.ItemsSource = reports; // Force the DataGrid to redraw it's elements. this.fileGridSelected.Items.Refresh(); }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private ReportFile EntityGet() { ReportFile entity = new ReportFile(); entity.ID = HTDataID; return(entity); }
/// <summary> /// 新增 /// </summary> /// <param name="p_BE">要新增的实体</param> public void RAdd(ReportManage p_BE, BaseEntity[] p_BE2, ReportFile p_BE3) { try { IDBTransAccess sqlTrans = TransSysUtils.GetDBTransAccess(); try { sqlTrans.OpenTrans(); this.RAdd(p_BE, p_BE2, p_BE3, sqlTrans); sqlTrans.CommitTrans(); } catch (Exception TE) { sqlTrans.RollbackTrans(); throw TE; } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 新增 /// </summary> public override int EntityAdd() { ReportManageRule rule = new ReportManageRule(); ReportManage entity = EntityGet(); ReportFile entityFile = new ReportFile(); ReportFileModel entityFileModel = new ReportFileModel(); if (drpReportModelType.EditValue.ToString() == "使用系统模板") { entityFileModel.ID = SysConvert.ToInt32(drpReportModel.EditValue); entityFileModel.SelectByID(); entityFile.Context = entityFileModel.Context; entityFile.FileName = txtFileName.Text.Trim(); } if (drpReportModelType.EditValue.ToString() == "使用本地文件") { entityFile.Context = HttSoft.WinUIBase.FastReport.ConvertToBinaryByPath(txtFilePath.Text.Trim()); entityFile.FileName = txtFileName.Text.Trim(); } ReportManageDts[] entitydts = EntityDtsGet(); //entity.SubmitFlag = this.HTSubmitFlagInsertGet(); rule.RAdd(entity, entitydts, entityFile); return(entity.ID); }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private ReportFile EntityGet() { ReportFile entity = new ReportFile(); entity.ID = HTDataID; entity.SelectByID(); if (HTFormStatus == FormStatus.新增) { entity.Context = HttSoft.WinUIBase.FastReport.ConvertToBinaryByPath(txtFilePath.Text.Trim()); } if (HTFormStatus == FormStatus.修改) { if (txtFilePath.Text.Trim() != "") { entity.Context = HttSoft.WinUIBase.FastReport.ConvertToBinaryByPath(txtFilePath.Text.Trim()); } } entity.FileID = SysConvert.ToInt32(txtFileID.Text.Trim()); entity.FileType = SysConvert.ToInt32(txtFileType.Text.Trim()); entity.FileName = txtFileName.Text.Trim(); entity.FileExec = txtFileExec.Text.Trim(); entity.Remark = txtRemark.Text.Trim(); entity.Seq = SysConvert.ToInt32(txtSeq.Text.Trim()); //entity.MFlag = SysConvert.ToInt32(txtMFlag.Text.Trim()); if (txtUploadTime.DateTime != SystemConfiguration.DateTimeDefaultValue && txtUploadTime.Text != "") { entity.UploadTime = txtUploadTime.DateTime.Date; } return(entity); }
/// <summary> /// set reportFile entity /// </summary> /// <param name="loginID"></param> /// <param name="fileSavePath"></param> /// <param name="success"> </param> /// <param name="serverFileName"> </param> /// <param name="date"> </param> /// <param name="_ReportFile"> </param> /// <returns></returns> private ReportFile setReportFile(int loginID, string fileSavePath, bool success, string serverFileName, string date, ReportFile _ReportFile, string customerName) { string _Ext = Path.GetExtension(serverFileName); bool _CanDownload = false; if ((_Ext == ".XLSX") || (_Ext == ".xlsx") || (_Ext == ".xls") || (_Ext == ".pptx")) { _CanDownload = true; } if (_ReportFile == null) { _ReportFile = new ReportFile(); } _ReportFile.FK_LoginId = loginID; _ReportFile.FileName = Path.GetFileNameWithoutExtension(fileSavePath); _ReportFile.UpdateTime = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"); _ReportFile.Success = success; _ReportFile.ServerFileName = serverFileName; _ReportFile.Date = date; _ReportFile.CanDownload = _CanDownload; _ReportFile.IsDel = false; _ReportFile.ServerSimpleFileName = Path.GetFileName(serverFileName); _ReportFile.Flag = customerName; return(_ReportFile); }
/// <summary> /// 报告文件保存 /// </summary> /// <param name="reportFile"></param> /// <returns></returns> public ReportFile ReportFileSave(ReportFile reportFile) { if (reportFile.SeqNO == 0) { ReportFile findOneMax = db.ReportFile.Where(x => (x.ProjectId == reportFile.ProjectId && x.ShopId == reportFile.ShopId)).OrderByDescending(x => x.SeqNO).FirstOrDefault(); if (findOneMax == null) { reportFile.SeqNO = 1; } else { reportFile.SeqNO = findOneMax.SeqNO + 1; } reportFile.InDateTime = DateTime.Now; db.ReportFile.Add(reportFile); } else { ReportFile findOne = db.ReportFile.Where(x => (x.ProjectId == reportFile.ProjectId && x.ShopId == reportFile.ShopId && x.SeqNO == reportFile.SeqNO)).FirstOrDefault(); if (findOne == null) { reportFile.InDateTime = DateTime.Now; db.ReportFile.Add(reportFile); } else { findOne.ReportFileName = reportFile.ReportFileName; findOne.ReportFileType = reportFile.ReportFileType; findOne.Url_OSS = reportFile.Url_OSS; } } db.SaveChanges(); return(reportFile); }
static async Task <ReportFile> RunClientAsync(string accession, string fileType, int timezone, AOLToken sessionToken) { try { if (sessionToken == null || !sessionToken.IsValidToken) { //invalid session token then create one sessionToken = await CreatUserTokenAsync(new AOLUser()); ReportFile readFile = await GetLabReportFileAsync(fileType, sessionToken.Token, accession, timezone); readFile.SessionToken = sessionToken; return(readFile); } return(await GetLabReportFileAsync(fileType, sessionToken.Token, accession, timezone)); } catch (HttpRequestException hre) { throw new Exception($"Message: {hre.Message}/r/nStackTrace: {hre.StackTrace}/r/nSource:{hre.Source}", hre.InnerException); } catch (Exception ex) { throw new Exception($"Message: {ex.Message}/r/nStackTrace: {ex.StackTrace}/r/nSource:{ex.Source}", ex.InnerException); } }
/// <summary> /// 修改 /// </summary> public override void EntityUpdate() { ReportFileRule rule = new ReportFileRule(); ReportFile entity = EntityGet(); rule.RUpdate(entity); }
public void BackupFile(string destFolder, string fileToCopy, BackupStatus backupStatus) { IProgress <string> stateProgress = backupStatus.StateProgress as IProgress <string>; string DestFilePath = System.IO.Path.Combine(destFolder, Helpers.ExtractFileFolderNameFromFullPath(fileToCopy)); if (File.Exists(DestFilePath)) { if (CheckIfFileModified(DestFilePath, fileToCopy)) { ReplaceFile(fileToCopy, DestFilePath); stateProgress.Report($"The file {fileToCopy} has been modified, replacing it with new content in {DestFilePath}{Environment.NewLine}"); } else { stateProgress.Report($"The file {fileToCopy} already exists in {DestFilePath}{Environment.NewLine}"); } } else { try { File.Copy(fileToCopy, DestFilePath); stateProgress.Report($"Copying {fileToCopy}{Environment.NewLine}"); } catch (IOException excp) { backupStatus.DialogService.ShowMessageBox(excp.Message); ReportFile.WriteToLog(excp.Message); } }; }
public ReportFile Save(ReportFile reportFile) { if (reportFile == null) { throw new ArgumentNullException("reportFile"); } if (reportFile.CreateOn == default(DateTime)) { reportFile.CreateOn = DateTime.Now; } if (reportFile.CreateBy.Equals(Guid.Empty)) { reportFile.CreateBy = CurrentUserID; } var insert = new SqlInsert(ReportTable, true) .InColumns(columns) .Values( reportFile.Id, reportFile.ReportType, reportFile.Name, reportFile.FileId, reportFile.CreateBy.ToString(), TenantUtil.DateTimeToUtc(reportFile.CreateOn), CoreContext.TenantManager.GetCurrentTenant().TenantId) .Identity(0, 0, true); reportFile.Id = Db.ExecuteScalar <int>(insert); return(reportFile); }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(ReportManage p_BE, BaseEntity[] p_BE2, ReportFile p_BE3, IDBTransAccess sqlTrans) { try { this.RAdd(p_BE, sqlTrans); ReportManageDtsRule ruledts = new ReportManageDtsRule(); ruledts.RSave(p_BE, p_BE2, sqlTrans);//保存从表 ReportFileRule ruleFile = new ReportFileRule(); p_BE3.FileID = p_BE.ID; ruleFile.RAdd(p_BE3, sqlTrans); string sql = " UPDATE Data_ReportManage SET FileID = " + p_BE3.ID; sql += " WHERE ID =" + p_BE.ID; sqlTrans.ExecuteNonQuery(sql); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// Generates the report /// @see ITasklet#Execute /// </summary> /// <param name="contribution"></param> /// <param name="chunkContext"></param> /// <returns></returns> public RepeatStatus Execute(StepContribution contribution, ChunkContext chunkContext) { LocalReport report = new LocalReport { ReportPath = ReportFile.GetFileInfo().FullName }; if (Parameters != null && Parameters.Any()) { if (Logger.IsTraceEnabled) { Logger.Trace("{0} parameter(s) were given for the report ", Parameters.Count); } report.SetParameters(Parameters.Select(p => new ReportParameter(p.Key, p.Value))); } else { if (Logger.IsTraceEnabled) { Logger.Trace("No parameter was given for the report "); } } //DataSet DataSet ds = DbOperator.Select(Query, QueryParameterSource); //ReportDataSource ReportDataSource rds = new ReportDataSource { Name = DatasetName, Value = ds.Tables[0] }; report.DataSources.Add(rds); if (Logger.IsTraceEnabled) { Logger.Trace("Report init : DONE => Preparing to render"); } byte[] output = report.Render(ReportFormat); if (Logger.IsTraceEnabled) { Logger.Trace("Report init : rendering DONE => Preparing to serialize"); } //Create target directory if required OutFile.GetFileInfo().Directory.Create(); //dump to target file using (FileStream fs = new FileStream(OutFile.GetFileInfo().FullName, FileMode.Create)) { fs.Write(output, 0, output.Length); } if (Logger.IsTraceEnabled) { Logger.Info("Report init : serialization DONE - end of ReportTasklet execute."); } return(RepeatStatus.Finished); }
/// <summary> /// 修改 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Update(BaseEntity p_Entity) { try { ReportFile MasterEntity = (ReportFile)p_Entity; if (MasterEntity.ID == 0) { return(0); } //更新主表数据 StringBuilder UpdateBuilder = new StringBuilder(); UpdateBuilder.Append("UPDATE Data_ReportFile SET "); UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ","); UpdateBuilder.Append(" Context=@Context" + ","); UpdateBuilder.Append(" FileID=" + SysString.ToDBString(MasterEntity.FileID) + ","); UpdateBuilder.Append(" FileType=" + SysString.ToDBString(MasterEntity.FileType) + ","); UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ","); UpdateBuilder.Append(" FileName=" + SysString.ToDBString(MasterEntity.FileName) + ","); UpdateBuilder.Append(" FileExec=" + SysString.ToDBString(MasterEntity.FileExec) + ","); UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ","); if (MasterEntity.UploadTime != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" UploadTime=" + SysString.ToDBString(MasterEntity.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"))); } else { UpdateBuilder.Append(" UploadTime=null"); } UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID)); object[,] obja = new object[2, 1]; obja[0, 0] = "@Context"; obja[1, 0] = MasterEntity.Context; //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString(), obja); } else { AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString(), obja); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E); } }
public void RemoveFile() { // Check if an item is actually selected, first. if (fileGridSelected.SelectedIndex == -1) { System.Windows.MessageBox.Show("Please select an item to remove.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error); return; } // This gets the ReportFile that is bound to that item in the list, and puts it in a variable. // We know that it will be a ReportFile, the compiler doesn't, so we 'cast' it explicity. ReportFile selectedReportFile = (ReportFile)fileGridSelected.SelectedValue; // Now we get the index of the ReportFile bound to the item in the list. This is a search. int remIndex = reports.IndexOf(selectedReportFile); // Now we remove the report at the index we got reports.RemoveAt(remIndex); // Refresh the ItemsSource in the DataGrid. this.fileGridSelected.ItemsSource = reports; // Force the DataGrid to redraw it's elements. this.fileGridSelected.Items.Refresh(); }
public void SetUp() { this.reportFileRepository = new Mock <IReportFileRepository>(); this.filePathBuilderEngine = new Mock <IFilePathBuilderEngine>(); this.environmentTypeService = new Mock <IEnvironmentTypeService>(); this.servers = new List <EnvironmentServerEntity>(); this.reportFileService = new ReportFileService( this.reportFileRepository.Object, this.filePathBuilderEngine.Object, this.environmentTypeService.Object); this.reportPath = "report path"; this.reportFiles = new List <ReportFile>(); String[] fileContent1 = new String[1] { "filecontent1" }; String[] fileContent2 = new String[1] { "filecontent2" }; this.reportFiles.Add(new ReportFile("filename1", "filepath1", fileContent1)); this.reportFiles.Add(new ReportFile("filename2", "filepath2", fileContent2)); this.servers.Add(new EnvironmentServerEntity() { ServerName = "Bravura Server" }); String[] fileContent = new String[1] { "filecontent" }; this.reportFile = new ReportFile("filename", "filepath", fileContent); }
/// <summary> /// یک فایل گزارش را میگرداند /// </summary> /// <param name="fileId"></param> /// <returns></returns> private ReportFile GetReportFile(decimal fileId) { EntityRepository <ReportFile> reportFileReposiory = new EntityRepository <ReportFile>(); ReportFile file = reportFileReposiory.GetById(fileId, false); return(file); }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { ReportFile MasterEntity = (ReportFile)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM Data_ReportFile WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
public string Create(ReportFile instance) { if (instance == null) { throw new ArgumentNullException(); } return(this._repository.Create(instance)); }
public async Task <IEnumerable <ReportFile> > Get() => await Task.Run(async() => { await ReportFile.ConsolidateReportFiles(); using (var db = new Db()) { return(db.ReportFiles.OrderByDescending(r => r.CreatedAt).ToList()); } });
public void Update(ReportFile instance) { if (instance == null) { throw new ArgumentNullException(); } this._repository.Update(instance); }
/// <summary> /// 新增 /// </summary> public override int EntityAdd() { ReportFileRule rule = new ReportFileRule(); ReportFile entity = EntityGet(); rule.RAdd(entity); return(entity.ID); }
public async Task <ActionResult <HttpResponseMessage> > CaricaSmarriti() { var connectionString = RepositoryContext.ConnectionString; var isError = false; var exMessage = String.Empty; var isXlsFiles = IsDocumentUploaded(_uploadFolder, out string[] xlsFiles); _logger.LogInformation("Controller started!"); if (!isXlsFiles) { return(BadRequest("Nessun file excel caricato!")); } try { foreach (var excelfile in _dictFile.DictionaryOfFiles.Values) { var filenamepath = _uploadFolder + @"\" + excelfile; // add upload folder to path of filename await Task.Run(() => _outputNames.Add(OpenDocument(filenamepath, connectionString))); _logger.LogInformation("open excel document"); } _logger.LogInformation("Reading ended."); } catch (Exception ex) { _logger.LogInformation("Exception : " + ex.Message); isError = true; exMessage = ex.Message; } finally { if (isError) { // build filename append guid to end of filename to have unique name var fileName = "log_error_" + DateTime.Now.ToString("yyyy-MM-dd") + "_" + DateTime.Now.ToString("HH.mm.ss_") + Guid.NewGuid() + ".txt"; _outputNames.Add(fileName); ReportFile.InitFile(fileName); ReportFile.WriteLine("Problemi durante il caricamento dei codici"); ReportFile.WriteLine(exMessage); ReportFile.CloseFile(); CopyLogErrorFile2SharedFolder(fileName); } } // return all filename generated included file of errors if (isError) { isError = false; return(BadRequest("Problema durante la lettura del/i file di codici!")); } // Serialize text file to json var result = ConvertToFileContentResult(_outputNames); return(result); }
/// <summary> /// Adds the report properties. /// </summary> /// <param name="reportFile"> /// The report server reports. /// </param> /// <param name="propertiesString"> /// The properties string. /// </param> private void AddReportProperties(ReportFile reportFile, string propertiesString) { string[] strings; foreach (string propertery in propertiesString.Split(new[] { ';' })) { strings = propertery.Split(new[] { '=' }); reportFile.ReportServerProperties.Add(strings[0], strings[1]); } }
public ReportFile Save(ReportFile reportFile) { if (ProjectSecurity.IsVisitor(SecurityContext.CurrentAccount.ID)) { throw new SecurityException("Access denied."); } return(DaoFactory.ReportDao.Save(reportFile)); }
public override void SetVariables <T>(T data) { ReportFile.Load(GetReportMrtPath()); var formattedData = data as RedemptionStatement; if (formattedData != null) { ReportFile.Dictionary.Variables.Add("FundTitle", formattedData.FundTitle); ReportFile.Dictionary.Variables.Add("SeoRegisterNumberTitle", formattedData.SeoRegisterNumber); ReportFile.Dictionary.Variables.Add("ReportTitle", Category.GetEnumDescription()); ReportFile.Dictionary.Variables.Add("ReuestNumber", formattedData.RequestId); ReportFile.Dictionary.Variables.Add("RedemptionDate", formattedData.EmissionDate.ConvertMiladiToJalali(false)); if (formattedData.PartyType == (int)PartyType.Retail) { ReportFile.Dictionary.Variables.Add("RetailpPersonTitle", formattedData.PartyFullName); ReportFile.Dictionary.Variables.Add("IdNumber", formattedData.IdentityCard); ReportFile.Dictionary.Variables.Add("IssuePlace", ""); ReportFile.Dictionary.Variables.Add("BirthDate", formattedData.BirthDateJalali); ReportFile.Pages.GetComponentByName("Text6").Enabled = false; } else { ReportFile.Dictionary.Variables.Add("InstitutionalPersonTitle", formattedData.PartyFullName); ReportFile.Dictionary.Variables.Add("RegistrationNumber", formattedData.IdentityCard); ReportFile.Dictionary.Variables.Add("RegisterPlace", ""); ReportFile.Dictionary.Variables.Add("RegisterDate", formattedData.RegisterDateJalali); ReportFile.Pages.GetComponentByName("Text5").Enabled = false; } ReportFile.Dictionary.Variables.Add("NationalId", formattedData.NationalId); ReportFile.Dictionary.Variables.Add("EvidenceVolume", formattedData.EvidenceVolume); ReportFile.Dictionary.Variables.Add("RemainVolume", formattedData.RemainVolume); ReportFile.Dictionary.Variables.Add("Price", formattedData.Price); ReportFile.Dictionary.Variables.Add("TotalAmount", formattedData.TotalAmount); ReportFile.Dictionary.Variables.Add("NetAmount", formattedData.NetAmount); ReportFile.Dictionary.Variables.Add("FixedFee", formattedData.FixedFee); ReportFile.Dictionary.Variables.Add("VariableFee", formattedData.VariableFee); ReportFile.Dictionary.Variables.Add("EmissionDate", formattedData.EmissionDate.ConvertMiladiToJalali(false)); ReportFile.Dictionary.Variables.Add("AccountNumber", formattedData.CustomerAccountNumber); ReportFile.Dictionary.Variables.Add("AccountBrankBranch", formattedData.CustomerAccountBranchName ?? ""); ReportFile.Dictionary.Variables.Add("BankName", formattedData.BankName ?? ""); } ReportFile.Compile(); ReportFile.Render(); }
//public CurrencyImportManager ImportManager; protected override Core.Services.ServiceOutcome DoPipelineWork() { List <CurrencyRate> rates = new List <CurrencyRate>(); //TO DO : USE MAPPING CONFIGURATION FOR THIS SERVICE. foreach (DeliveryFile ReportFile in this.Delivery.Files) { bool isAttribute = Boolean.Parse(ReportFile.Parameters["XML.IsAttribute"].ToString()); var ReportReader = new XmlDynamicReader (ReportFile.OpenContents(), ReportFile.Parameters["XML.Path"].ToString()); using (ReportReader) { dynamic reader; while (ReportReader.Read()) { if (isAttribute) { reader = ReportReader.Current.Attributes; } else { reader = ReportReader.Current; } CurrencyRate currencyUnit = new CurrencyRate(); //Currency Code List <object> CurrencyData = reader["field"]; currencyUnit.Currency.Code = (((XmlDynamicObject)CurrencyData[0]).InnerText.Split('/')).Count() > 1 ?((XmlDynamicObject)CurrencyData[0]).InnerText.Split('/')[1]: string.Empty; if (string.IsNullOrEmpty(currencyUnit.Currency.Code)) { continue; } //Currecy Date currencyUnit.RateDate = DateTime.Now; //Currency Rate currencyUnit.RateValue = Convert.ToDecimal(((XmlDynamicObject)CurrencyData[1]).InnerText) == 0?0: 1 / Convert.ToDecimal(((XmlDynamicObject)CurrencyData[1]).InnerText); rates.Add(currencyUnit); } } CurrencyRate.SaveCurrencyRates(rates); //ImportManager.EndImport(); //} } return(Core.Services.ServiceOutcome.Success); }
private async Task AddFile(string fileName) { var fileObject = new ReportFile { FileName = fileName }; _context.Add(fileObject); await _context.SaveChangesAsync(); }
public void Remove(ReportFile report) { if (ProjectSecurity.IsVisitor(SecurityContext.CurrentAccount.ID)) { throw new SecurityException("Access denied."); } DaoFactory.ReportDao.Remove(report); FileEngine.MoveToTrash(report.FileId); }
/// <summary> /// Adds the file. /// </summary> /// <param name="file">The file.</param> /// <param name="data">The JSLint data.</param> public void AddFile(string file, IJSLintData data) { this.ProcessedFileCount += 1; if (!this.files.ContainsKey(file) && data.Warnings.Count > 0) { this.ErrorFileCount += 1; this.ErrorCount += data.Warnings.Count; var reportFile = new ReportFile() { ErrorCount = data.Warnings.Count, ErrorReport = data.Report }; this.files.Add(file, reportFile); } }