public static void AuditoriaAddImg(IAudImageMng oMng, IAuditoriaCAEApp o, IDbTransaction trans, string path) { try { //path = Path.Combine(path, o.Referencia + @"\"); System.IO.Directory.CreateDirectory(path); string filePath = string.Empty; string fileName = string.Empty; for (int indEAUF = 0; indEAUF < o.PLstAudImg.Count; indEAUF++) { IAudImage itemFile = o.PLstAudImg[indEAUF]; itemFile.Id_operation_aud = o.Id; var bytes = Convert.FromBase64String(itemFile.Path); fileName = o.prefixImg + indEAUF + "_.jpeg"; filePath = Path.Combine(path, fileName); using (var imageFile = new FileStream(filePath, FileMode.Create)) { imageFile.Write(bytes, 0, bytes.Length); imageFile.Flush(); } itemFile.Path = filePath; oMng.O_Aud_Img = itemFile; oMng.add(trans); } } catch { throw; } }
public static void getCasc028(string FilePath, string rptPath, ICasc028 o, DataSet ds) { try { CultureInfo ci = new CultureInfo("es-MX"); ReportDocument reporte = new ReportDocument(); reporte.Load(rptPath); #region Imagenes DataTable dt028 = ds.Tables["casc028"]; string fileImagePath = string.Empty; int imgSide = 1; DataRow dr = null; for (int indFile = 0; indFile < o.PAudOperation.PLstAudImg.Count; indFile++) { IAudImage itemFile = o.PAudOperation.PLstAudImg[indFile]; switch (imgSide) { case 1: dr = dt028.NewRow(); dr["imgLeft"] = getImg(itemFile.Path); dt028.Rows.Add(dr); break; case 2: dr["imgCenter"] = getImg(itemFile.Path); break; case 3: dr["imgRight"] = getImg(itemFile.Path); imgSide = 0; break; } imgSide++; } reporte.SetDataSource(ds.Tables["casc028"]); #endregion #region Encabezado 2 reporte.SetParameterValue("cliente", o.Cliente); reporte.SetParameterValue("referencia", o.Referencia); reporte.SetParameterValue("informa", o.Informa); reporte.SetParameterValue("lugar", o.Lugar); reporte.SetParameterValue("fecha", o.Fecha); reporte.SetParameterValue("informado", o.Informado); reporte.SetParameterValue("relato", o.Relato); reporte.SetParameterValue("vigilancia", o.Vigilancia); reporte.SetParameterValue("testigo", o.Testigo); reporte.SetParameterValue("notificado", o.Notificado); #endregion reporte.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, FilePath); } catch { throw; } }