public static void GenerarInforme(decimal ajusteId, string tipoInforme, bool estadoValidacion, bool observado, string usuario, string ApplicationPath) { //ReportDocument informeBasico = getInforme(ajusteId, tipoInforme, ApplicationPath); Byte[] informeEnBytes = GetInformeInBytes(ajusteId, tipoInforme); tipoInforme = GetTipoInforme(tipoInforme); //MODIFICAR CON LA AGREGACION DE LA EXTENCION DEL PDF decimal estadoACambiar = -1; string nombreInforme = "PASA-IB-" + ajusteId + "-" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond + ".pdf"; switch (tipoInforme) { case "B": { nombreInforme = "PASA-IB-" + ajusteId + "-" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond + ".pdf"; estadoACambiar = 16; break; } case "P": { nombreInforme = "PASA-IP-" + ajusteId + "-" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond + ".pdf"; estadoACambiar = 17; break; } case "C": { nombreInforme = "PASA-IC-" + ajusteId + "-" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond + ".pdf"; estadoACambiar = 18; break; } case "F": { nombreInforme = "PASA-IF-" + ajusteId + "-" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond + ".pdf"; estadoACambiar = 20; break; } } //saveToFileSytem(informeBasico, nombreInforme, ApplicationPath); SaveInformeToFileSystem(informeEnBytes, nombreInforme, ApplicationPath); dsReporteTableAdapters.InformeBasicoSelectTableAdapter tainforme = new dsReporteTableAdapters.InformeBasicoSelectTableAdapter(); tainforme.Insert(ajusteId, nombreInforme, ApplicationPath + "\\informes\\" + nombreInforme, tipoInforme, estadoValidacion, observado, usuario); if ((estadoACambiar != -1) && (estadoValidacion)) { dsEstadoTableAdapters.administraEstadosTableAdapter ta = new dsEstadoTableAdapters.administraEstadosTableAdapter(); ta.cambiaEstadoAjuste(DateTime.Today, ajusteId, estadoACambiar, "SYSTEM"); } if (estadoValidacion) enviaNotificacionInformes(tipoInforme, ajusteId, ApplicationPath + "\\informes\\"); if (estadoValidacion) enviaNotificacionDias(tipoInforme, ajusteId); }
public static decimal dameCodigoEstado(decimal ajusteId) { dsEstadoTableAdapters.administraEstadosTableAdapter ta = new dsEstadoTableAdapters.administraEstadosTableAdapter(); decimal codigoEstadoAjuste = (decimal)((ta.dameCodigoEstadoActual(ajusteId) != null) ? ta.dameCodigoEstadoActual(ajusteId) : -1); return codigoEstadoAjuste; }