示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null)
     {
         int  intServer = Int32.Parse(Request.QueryString["id"]);
         PDFs oPDF      = new PDFs(dsn, dsnAsset, dsnIP, intEnvironment);
         oPDF.CreateSCRequest(intServer, boolUsePNCNaming);
     }
 }
示例#2
0
        private void MovePdfdown(PdfDocument pdfDocument)
        {
            var index = PDFs.IndexOf(pdfDocument);

            if (index != PDFs.Count - 1)
            {
                PDFs.Move(index, index + 1);
            }
        }
示例#3
0
        private void MovePdfUp(PdfDocument pdfDocument)
        {
            var index = PDFs.IndexOf(pdfDocument);

            if (index != 0)
            {
                PDFs.Move(index, index - 1);
            }
        }
示例#4
0
 public void AddNewPDFs(string[] pdfNames)
 {
     foreach (var item in pdfNames)
     {
         try
         {
             PDFs.Add(new PDFModel(item));
         }
         catch (ApplicationException)
         {
         }
     }
 }
示例#5
0
        private void CombinePDFs()
        {
            PdfDocument CombinedPDf = new PdfDocument();
            var         totalPages  = PDFs.Select(x => x.PageCount).Aggregate((a, b) => a + b);

            foreach (var pdfDocument in this.PDFs)
            {
                foreach (var page in pdfDocument.Pages)
                {
                    CombinedPDf.AddPage(page);
                }
            }


            CombinedPDf.Save("CombinedPDF.pdf");
        }
示例#6
0
文件: Forms.cs 项目: radtek/ClearView
        public Forms(string _scripts_path, bool _use_pnc_naming, int _projectid)
        {
            oLog        = new EventLog();
            oLog.Source = "ClearView";
            DataSet dsConfig = new DataSet();

            dsConfig.ReadXml(_scripts_path + "birth.xml");
            intEnvironment = Int32.Parse(dsConfig.Tables[0].Rows[0]["environment"].ToString());
            intProduction  = Int32.Parse(dsConfig.Tables[0].Rows[0]["productionid"].ToString());
            string strDSN      = dsConfig.Tables[0].Rows[0]["DSN"].ToString();
            string strDSNAsset = dsConfig.Tables[0].Rows[0]["AssetDSN"].ToString();
            string strDSNIP    = dsConfig.Tables[0].Rows[0]["IpDSN"].ToString();

            dsn              = dsConfig.Tables[0].Rows[0][strDSN].ToString();
            dsnAsset         = dsConfig.Tables[0].Rows[0][strDSNAsset].ToString();
            dsnIP            = dsConfig.Tables[0].Rows[0][strDSNIP].ToString();
            boolAdd          = (dsConfig.Tables[0].Rows[0]["func_add"].ToString() == "1");
            boolSend         = (dsConfig.Tables[0].Rows[0]["func_send"].ToString() == "1");
            boolUsePNCNaming = _use_pnc_naming;
            oProject         = new Projects(0, dsn);
            intProject       = _projectid;

            oPDF = new PDFs(dsn, dsnAsset, dsnIP, intEnvironment);
        }
示例#7
0
        public string InitiateNextStep(int _requestid, int _answerid, int _modelid, int _environment, int _assign_pageid, int _view_pageid, string _dsn_asset, string _dsn_ip, string _dsn_service_editor, bool _initiate_next_step)
        {
            string strError = "";
            // Generate Next Task...
            Forecast  oForecast = new Forecast(0, dsn);
            Classes   oClass    = new Classes(0, dsn);
            Users     oUser     = new Users(0, dsn);
            Variables oVariable = new Variables(_environment);
            Functions oFunction = new Functions(0, dsn, _environment);
            Servers   oServer   = new Servers(0, dsn);
            Log       oLog      = new Log(0, dsn);
            DataSet   dsServers = oServer.GetAnswer(_answerid);
            int       intClass  = 0;

            Int32.TryParse(oForecast.GetAnswer(_answerid, "classid"), out intClass);
            bool boolPNC = (oClass.Get(intClass, "pnc") == "1");

            oLog.AddEvent(_answerid, "", "", "InitiateNextStep(" + _answerid + ")", LoggingType.Debug);

            bool boolStarted   = true;
            bool boolCompleted = true;
            bool boolFinished  = true;
            bool boolReady     = true;
            int  intServer     = 0;

            foreach (DataRow drServer in dsServers.Tables[0].Rows)
            {
                intServer = Int32.Parse(drServer["id"].ToString());
                if (boolStarted == true)
                {
                    boolStarted = (drServer["build_started"].ToString() != "");
                }
                if (boolCompleted == true)
                {
                    boolCompleted = (drServer["build_completed"].ToString() != "");
                }
                DataSet dsSteps = GetStepsDesign(_answerid, 0, intServer);
                foreach (DataRow drStep in dsSteps.Tables[0].Rows)
                {
                    //if (drStep["non_transparent"].ToString() != "1" && (drStep["created"].ToString() == "" || drStep["completed"].ToString() == ""))
                    if (drStep["created"].ToString() == "" || drStep["completed"].ToString() == "")
                    {
                        // One or more tasks are still open
                        oLog.AddEvent(_answerid, "", "", "InitiateNextStep...One or more tasks are still open (" + drStep["name"].ToString() + " ~ " + drStep["created"].ToString() + " ~ " + drStep["completed"].ToString() + " ~ " + drStep["username"].ToString() + ")", LoggingType.Debug);
                        boolFinished = false;
                        // Check to see if it is a Non-Transparent task
                        if (drStep["non_transparent"].ToString() != "1")
                        {
                            // drStep["non_transparent"].ToString() == "0" means that Non-Transparent == false meaning the task is Transparent and is required for READY flag to be set.
                            oLog.AddEvent(_answerid, "", "", "InitiateNextStep...A transparent task is open so design is not ready for Birth Certificate", LoggingType.Debug);
                            boolReady = false;
                        }
                    }
                }
            }

            if (_initiate_next_step == true)
            {
                if (boolFinished == false)
                {
                    // Initiate Next Step
                    oServer.GetExecution(intServer, _environment, _dsn_asset, _dsn_ip, _dsn_service_editor, _assign_pageid, _view_pageid);
                }
                else
                {
                    // All tasks have been completed, close the design for future tasks
                    oForecast.UpdateAnswerFinished(_answerid, DateTime.Now.ToString());
                }
            }

            if (boolReady == true && boolStarted == true && boolCompleted == true)
            {
                oLog.AddEvent(_answerid, "", "", "InitiateNextStep...All transparent tasks are completed. Mark the server(s) as READY and send Birth Certificate", LoggingType.Debug);
                // All TRANSPARENT tasks are completed, mark the server(s) as READY and send Birth Certificate.
                if (boolPNC == true)
                {
                    // Assume the workflow is done and notify requestor(s) and implementors
                    if (_answerid > 0)
                    {
                        // Send Birth Certificate
                        try
                        {
                            PDFs oPDF = new PDFs(dsn, _dsn_asset, _dsn_ip, _environment);
                            oPDF.CreateDocuments(_answerid, false, false, null, true, true, true, false, true, true);
                            oLog.AddEvent(_answerid, "", "", "InitiateNextStep...Birth Certificate sent", LoggingType.Debug);
                        }
                        catch (Exception exB)
                        {
                            strError = "There was a problem sending the Birth Certificate ~ " + exB.Message;
                            string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DEVELOPER_ERROR,EMAILGRP_PROVISIONING_SUPPORT");
                            oFunction.SendEmail("ERROR: Sending Birth Certificate Form", strEMailIdsBCC, "", "", "ERROR: Sending Birth Certificate Form", "<p>There was a problem sending the BIRTH CERTIFICATE form for Design # " + _answerid.ToString() + "</p><p>Error Message: " + exB.Message + "</p><p>Source: " + exB.Source + "</p><p>Stack Trace: " + exB.StackTrace + "</p>", true, false);
                        }
                    }
                }

                // Update the servers - build is ready.
                foreach (DataRow drServer in dsServers.Tables[0].Rows)
                {
                    oServer.UpdateBuildReady(Int32.Parse(drServer["id"].ToString()), DateTime.Now.ToString(), false);
                }
            }
            else
            {
                oLog.AddEvent(_answerid, "", "", "InitiateNextStep...Birth Certificate NOT sent", LoggingType.Debug);
            }
            return(strError);
        }
示例#8
0
        /// <summary>
        /// Determina que tipo de cuentas de correo utilizar
        /// </summary>
        /// <returns></returns>
        public bool tipoCorreo(string nombreCompuesto, string correoReceptor)
        {
            bool resultado = false;

            try
            {
                //Se obtiene credenciales para el envio del correo
                ManteUdoCorreos manteUdo = new ManteUdoCorreos();
                Correo          correo   = manteUdo.Consultar();

                if (correo != null)
                {
                    string[] adjuntos = new string[2];

                    PDFs pdf = new PDFs();

                    //FTP ftp = new FTP();

                    //ftp.descargarArchivos(nombreCompuesto + Mensaje.pdfExt, RutasCarpetas.RutaCarpetaAdjuntos, 6);
                    //ftp.EliminarFTP(6, nombreCompuesto + Mensaje.pdfExt);

                    //Se agregan las rutas de los archivos adjuntos
                    adjuntos[0] = RutasCarpetas.RutaCarpetaContingenciaComprobantes + nombreCompuesto + Mensaje.pdfExt;
                    if (ValidarAdenda(nombreCompuesto + ".xml"))
                    {
                        adjuntos[1] = RutasCarpetas.RutaCarpetaContingenciaSobresAdenda + nombreCompuesto + ".xml";
                        System.IO.File.Copy(RutasCarpetas.RutaCarpetaContingenciaSobresAdenda + nombreCompuesto + ".xml", RutasCarpetas.RutaCarpetaSobresComprobantesAdenda + nombreCompuesto + ".xml", true);
                        System.IO.File.Copy(RutasCarpetas.RutaCarpetaContingenciaSobres + nombreCompuesto + ".xml", RutasCarpetas.RutaCarpetaSobres + nombreCompuesto + ".xml", true);
                    }
                    else
                    {
                        adjuntos[1] = RutasCarpetas.RutaCarpetaContingenciaSobres + nombreCompuesto + ".xml";
                        System.IO.File.Copy(RutasCarpetas.RutaCarpetaContingenciaSobres + nombreCompuesto + ".xml", RutasCarpetas.RutaCarpetaSobres + nombreCompuesto + ".xml", true);
                    }

                    System.IO.File.Copy(RutasCarpetas.RutaCarpetaContingenciaSobresDgi + nombreCompuesto + ".xml", RutasCarpetas.RutaCarpetaSobresDgi + nombreCompuesto + ".xml", true);
                    System.IO.File.Delete(RutasCarpetas.RutaCarpetaContingenciaSobresDgi + nombreCompuesto + ".xml");
                    //adjuntos[1] = pdf.cambiarNombre(RutasCarpetas.RutaCarpetaSobresTemporales + nombreCompuesto + ".xml");

                    //System.IO.File.Copy(RutasCarpetas.RutaCarpetaContingenciaComprobantes + nombreCompuesto + Mensaje.pdfExt, RutasCarpetas.RutaCarpetaComprobantes + nombreCompuesto + Mensaje.pdfExt, true);

                    //0 == Gmail
                    if (correo.Opcion.Equals("0"))
                    {
                        ///Envia correo con una cuenta de gmail
                        Mail mail = new Mail(correoReceptor, correo.Cuenta, nombreCompuesto,
                                             Mensaje.pdfContenido, Mensaje.pdfServidorGmail, correo.Cuenta, correo.Clave, adjuntos, 587);
                        if (mail.enviarCorreoGmail())
                        {
                            if (!adjuntos[0].Equals(""))
                            {
                                //Borra el archivo de sobre copiado para enviar en el correo
                                System.IO.File.Delete(adjuntos[0]);
                            }
                            if (!adjuntos[1].Equals(""))
                            {
                                //Borra el archivo de sobre copiado para enviar en el correo
                                System.IO.File.Delete(adjuntos[1]);
                            }
                            resultado = true;
                        }
                    }
                    //1 == Outlook
                    else if (correo.Opcion.Equals("1"))
                    {
                        ///Envia correo con una cuenta de outlook
                        Mail mail = new Mail(correoReceptor, Mensaje.pdfAsunto, Mensaje.pdfContenido, adjuntos);
                        if (mail.enviarOutlook())
                        {
                            if (!adjuntos[0].Equals(""))
                            {
                                //Borra el archivo de sobre copiado para enviar en el correo
                                System.IO.File.Delete(adjuntos[1]);
                            }
                            if (!adjuntos[1].Equals(""))
                            {
                                //Borra el archivo de sobre copiado para enviar en el correo
                                System.IO.File.Delete(adjuntos[1]);
                            }
                            resultado = true;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }

            return(resultado);
        }
示例#9
0
        /// <summary>
        /// Metodo que llama a la generacion de documentos de tipo pdf
        /// Firmados digitalmente
        /// </summary>
        /// <param name="cfe"></param>
        /// <param name="cae"></param>
        /// <param name="kilosFactura"></param>
        /// <param name="tabla"></param>
        /// <param name="descuentoGeneral"></param>
        public void CrearPDF(CFE cfe, CAE cae, DatosPDF datosPdf, string tabla, List <ResguardoPdf> resguardoPdf, string tablaCabezal)
        {
            try
            {
                if (cae != null)
                {
                    RutasCarpetas rutas = new RutasCarpetas();
                    rutas.generarCarpetas();

                    //Llamada a metodo para comprobar si hay datos de firma digital
                    ObtenerFirmaDigital();

                    //Crear instancia de Pdfs
                    pdfs = new PDFs(cfe, cae, datosPdf.KilosFactura);

                    ////Se genera el archivo xml
                    //ArchivoXml archXml = new ArchivoXml();
                    //archXml.generarXml(cfe, cae);

                    //Crear pdf y validar creacion
                    #region Proceso_WebService
                    if (pdfs.CrearPDF(tabla, datosPdf, resguardoPdf, tablaCabezal))
                    //if (pdfs.CrearPDF(tabla, datosPdf, resguardoPdf, tablaCabezal, cfe.OrigenFE)) *** Se comenta porque se hace esto para todos los casos!
                    #endregion Proceso_WebService
                    {
                        if (EventosPagina.errorRutaLogo)
                        {
                            //Se informa al usuario de que la ruta especificada para el logo es incorrecta
                            app.MessageBox(Mensaje.errRutaLogoIncorrecta);
                            EventosPagina.errorRutaLogo = false;
                        }

                        if (FrmEstadoContingencia.estadoContingencia.Equals("Y"))
                        {
                            AdminEventosUI.mostrarMensaje(Mensaje.sucFactura, AdminEventosUI.tipoMensajes.exito);
                        }
                        else
                        {
                            AdminEventosUI.mostrarMensaje(Mensaje.sucFacturaCorreo, AdminEventosUI.tipoMensajes.exito);
                        }
                    }
                    else
                    {
                        if (!EventosPagina.errorRutaLogo && !PDFs.errorCertificado && !PDFs.errorFirma && !PDFs.errorCorreo && !PDFs.errorImprimir)
                        {
                            AdminEventosUI.mostrarMensaje(Mensaje.errFalloGenerarPdf, AdminEventosUI.tipoMensajes.error);
                        }
                        if (EventosPagina.errorRutaLogo)
                        {
                            AdminEventosUI.mostrarMensaje(Mensaje.errRutaLogoIncorrecta, AdminEventosUI.tipoMensajes.error);
                            EventosPagina.errorRutaLogo = false;
                        }

                        if (PDFs.errorCertificado)
                        {
                            AdminEventosUI.mostrarMensaje(Mensaje.errDatosNoConfigurados, AdminEventosUI.tipoMensajes.error);
                            PDFs.errorCertificado = false;
                        }

                        if (PDFs.errorFirma)
                        {
                            AdminEventosUI.mostrarMensaje(Mensaje.errFalloFirmaPdf, AdminEventosUI.tipoMensajes.error);
                            PDFs.errorFirma = false;
                        }

                        if (PDFs.errorCorreo)
                        {
                            if (Mail.errorCorreo.Equals(""))
                            {
                                AdminEventosUI.mostrarMensaje(Mensaje.errConfErroneaCorreo, AdminEventosUI.tipoMensajes.error);
                            }
                            else
                            {
                                AdminEventosUI.mostrarMensaje(Mensaje.err + Mail.errorCorreo, AdminEventosUI.tipoMensajes.error);
                            }
                            PDFs.errorCorreo = false;
                        }
                        if (PDFs.errorImprimir)
                        {
                            AdminEventosUI.mostrarMensaje(Mensaje.errFalloImprimirPdf, AdminEventosUI.tipoMensajes.error);
                            PDFs.errorImprimir = false;
                        }
                    }
                }
                else
                {
                    AdminEventosUI.mostrarMensaje(Mensaje.errConfErroneaCae, AdminEventosUI.tipoMensajes.error);
                }
            }
            catch (Exception ex)
            {
                app.MessageBox("JobEnvioSobre/Error: " + ex.ToString());
            }
        }
示例#10
0
 private void RemovePdf(PdfDocument pdfDocument)
 {
     PDFs.Remove(pdfDocument);
 }
示例#11
0
        protected void b1_Click(object sender, EventArgs e)
        {
            id = Convert.ToInt32(Request.QueryString["id"].ToString());
            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select * from products where id=" + id + "";
            cmd.ExecuteNonQuery();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);

            foreach (DataRow dr in dt.Rows)
            {
                Names = dr["ProductName"].ToString();

                PlayBys = dr["PlayBy"].ToString();

                PDFs = dr["PDF"].ToString();

                OVEs = dr["OVE"].ToString();

                MIDIs = dr["MIDI"].ToString();

                //ProductCategorys = dr["ProductCategory"].ToString();

                Originals = dr["Original"].ToString();

                Sells = dr["Sell"].ToString();

                //  ProductQuantitys = dr["ProductQuantity"].ToString();

                Purchaselinks = dr["Purchaselink"].ToString();

                ProductImages = dr["ProductImage"].ToString();
            }
            con.Close();

            if (Request.Cookies["aa"] == null)
            {
                Response.Cookies["aa"].Value   = Names.ToString() + "&" + PlayBys.ToString() + "&" + PDFs.ToString() + "&" + OVEs.ToString() + "&" + MIDIs.ToString() + "&" + Sells.ToString() + "&" + ProductImages.ToString();
                Response.Cookies["aa"].Expires = DateTime.Now.AddDays(1);
            }
            else
            {
                Response.Cookies["aa"].Value   = Request.Cookies["aa"].Value + "|" + Names.ToString() + "&" + PlayBys.ToString() + "&" + PDFs.ToString() + "&" + OVEs.ToString() + "&" + MIDIs.ToString() + "&" + Sells.ToString() + "&" + ProductImages.ToString();
                Response.Cookies["aa"].Expires = DateTime.Now.AddDays(1);
            }
        }