コード例 #1
0
        /// <summary>
        /// This routine generate an HTML Table based on StringCad (\t=split columns \n=split rows)
        /// </summary>
        /// <param name="sCad">String Chain that hols the data separated by \t and \n</param>
        /// <param name="xTitle">If bImage then Show the Title after</param>
        /// <param name="bFrame">True if Frame is required</param>
        /// <param name="bImage">True if an imgae shall be included</param>
        /// <param name="bComputerInfo">True if information like User, Computer and domain need to be included</param>
        /// <param name="bTimeStamp">True if Timestamp is required</param>
        /// <param name="bAppendRSWPowered">True if "Powered by RSW" at the end will be included</param>
        /// <returns></returns>
        private string RSFormaTable(string sCad, string xTitle, bool bFrame, bool bImage, bool bComputerInfo,
                                    bool bTimeStamp, bool bAppendRSWPowered)
        {
            string xBody = RSFormaTableHeader(true, bFrame, "");

            if (bImage)
            {
                string xImage = RSGbl_Variable.DataPath + @"\Image";
                RSLib_File.CheckDirectoryIfNotExistCreateIt(xImage);
                xImage = Path.Combine(xImage, "zRSFaMFSmall.png");
                if (File.Exists(xImage))
                {
                    string xNoSpacesImage = RSGbl_Variable.sEmailLogo;
                    xBody += "<TR><TD><a href=\"http://fortalezamf.mx\" target=\"_blank\"><img src=\"" + xNoSpacesImage + "\"></img></a></TD>";
                    if (xTitle.Length > 0)
                    {
                        //xBody += "<TD><P><FONT FACE=\"Comic Sans MS\"SIZE=5>" +  De acuerdo a COCO mejor usar un solo FONT
                        xBody += "<TD><P><FONT SIZE=5>" + xTitle + "</FONT></P></TD>\n";
                        //xBody += "<FONT FACE=\"Comic Sans MS\"SIZE=1>" +
                        //    RSLib_Browse.GetTimeStamp() + "</FONT></TD>\n";
                    }
                    xBody += "</TR>";
                }
            }
            string xTABLE = sCad;

            if (bComputerInfo)
            {
                xTABLE += "&nbsp;\t&nbsp;\n";
                xTABLE += "Usuario:\t" + System.Environment.UserName + "\n";
                xTABLE += "Computadora:\t" + System.Environment.MachineName + "\n";
                //xTABLE += "Dominio:\t" + System.Environment.UserDomainName + "\n";
                xTABLE += "IP:\t" + WhatIsMyIP + "\n";
                xTABLE += "RS Report Versión:\t" + RSGbl_Variable.APPVersion + "\n";
            }
            if (bTimeStamp)
            {
                xTABLE += "Timestamp:\t" + RSLib_Browse.GetTimeStamp() + "\n";
            }
            TextReader stringReader = new StringReader(xTABLE);

            while (true)
            {
                string sxLine = stringReader.ReadLine();
                if (sxLine == null || sxLine.Length == 0)
                {
                    break;
                }
                xBody += "<TR>";
                string[] xParts = sxLine.Split('\t');
                foreach (string xPart in xParts)
                {
                    xBody += "<TD>" + xPart + "</TD>";
                }
                xBody += "</TR>";
            }
            xBody += RSFormaTableHeader(false, bFrame, "");
            if (bAppendRSWPowered)
            {
                xBody += "<Font Size=1>Powered by RSW</Font><br />";
            }
            return(xBody);
        }
コード例 #2
0
        private void RegistryRead()
        {
            string LastVersion = RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "Version", "0");

            if (LastVersion != RSGbl_Variable.APPVersion)
            {
                RSLib_Registry.MySaveRegistry(RSGbl_Variable.APPName, "FirstTime", "0");
            }
            RSLib_Registry.MySaveRegistry(RSGbl_Variable.APPName, "Version", RSGbl_Variable.APPVersion);
            int FirstTime = RSLib_String.AToI(RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "FirstTime", "0"));
            int x         = RSLib_String.AToI(RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "X", this.Location.X.ToString()));
            int y         = RSLib_String.AToI(RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "Y", this.Location.Y.ToString()));
            int w         = RSLib_String.AToI(RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "W", this.Size.Width.ToString()));
            int h         = RSLib_String.AToI(RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "H", this.Size.Height.ToString()));

            RSGbl_Variable.DataPath = Environment.GetEnvironmentVariable("APPDATA") + "\\RuisenorSW\\" + RSGbl_Variable.APPGroup;
            RSLib_File.CheckDirectoryIfNotExistCreateIt(RSGbl_Variable.DataPath);
            if (FirstTime == 0)
            {
                RSLib_Registry.MySaveRegistry(RSGbl_Variable.APPName, "ApplicationPath", RSGbl_Variable.ApplicationPath);
                RSLib_Registry.MySaveRegistry(RSGbl_Variable.APPName, "FirstTime", "1");
                if (LastVersion == "0")  // This is really the first time
                {
                    // DO Something
                }
            }
            RSGbl_Variable.ApplicationPath = RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "ApplicationPath", RSGbl_Variable.ApplicationPath);

            RSLib_ODBC.StrConnect    = RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "ODBC Connect", RSLib_ODBC.StrConnect);
            RSLib_ODBC.StrConnect    = RSLib_Encrypt.DesEncryptString(RSLib_ODBC.StrConnect);
            RSLib_ODBC.LevelLogs     = Convert.ToInt32(RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "Level Logs", RSLib_ODBC.LevelLogs.ToString()));
            RSLib_SendMail.SMTP_Host = RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "SMTP Host", RSLib_SendMail.SMTP_Host);
            RSLib_SendMail.SMTP_Port = Convert.ToInt32(RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "SMTP Port", RSLib_SendMail.SMTP_Port.ToString()));
            RSLib_SendMail.SMTP_SSL  = (
                RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "SMTP SSL", RSLib_SendMail.SMTP_SSL.ToString()) == "True"
                ? true : false);
            RSLib_SendMail.SMTP_USER = RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "SMTP USER", RSLib_SendMail.SMTP_USER);
            RSLib_SendMail.SMTP_PWD  = RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "SMTP PWD", RSLib_SendMail.SMTP_PWD);
            RSLib_SendMail.SMTP_PWD  = RSLib_Encrypt.DesEncryptString(RSLib_SendMail.SMTP_PWD);
            RSLib_SendMail.SMTP_From = RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "SMTP From", RSLib_SendMail.SMTP_From);

            //WhatIsCustomerServiceMail = RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "NEW Customer Service eMail", WhatIsCustomerServiceMail);

            RSGbl_Variable.LastUser      = RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "LastUser", System.Environment.UserName);
            RSLib_ODBC.iSQLTimeOutGlobal = RSLib_String.AToI(RSLib_Registry.MyGetRegistry(RSGbl_Variable.APPName, "SQL Time Out", RSLib_ODBC.iSQLTimeOutGlobal.ToString()));
            if (RSLib_ODBC.iSQLTimeOutGlobal == -1)
            {
                RSLib_ODBC.iSQLTimeOutGlobal = 90;
            }

            // Copia LOGO Si no existe
            string SourcePath = RSGbl_Variable.ApplicationPath;
            string TargetPath = RSGbl_Variable.DataPath + @"\Image";

            RSLib_File.CheckDirectoryIfNotExistCreateIt(TargetPath);
            string xPNGFile = "zRSFaMFSmall";

            if (!File.Exists(Path.Combine(TargetPath, xPNGFile + ".png")))
            {
                if (File.Exists(Path.Combine(SourcePath, xPNGFile + ".png")))
                {
                    RSLib_File.MyBasicMoveOrCopyFile(
                        Path.Combine(SourcePath, xPNGFile + ".png"),
                        Path.Combine(TargetPath, xPNGFile + ".png"),
                        true
                        );
                }
            }

            CheckIfNoEmailSettingsThenOverride();

            RSGbl_Variable.GlobalUII = System.Environment.MachineName;
            this.Location            = new Point(x, y);
            this.Size = new System.Drawing.Size(w, h);
        }