public string getProductFeatureCode(DatabaseConnection dbConn)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(FEATURE_CODE_MAX_EMPLOYEE + "=" + m_CompanyDBMaxEmployee.ToString() + ";");
            int defaultMaxQuotaMB = 0;

            if (!int.TryParse(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DEFAULT_MAX_INBOX_SIZE_MB), out defaultMaxQuotaMB))
            {
                defaultMaxQuotaMB = 0;
            }
            builder.Append(FEATURE_CODE_MAX_INBOX_SIZE_MB + "=" + (defaultMaxQuotaMB > m_CompanyDBInboxMaxQuotaMB ? defaultMaxQuotaMB.ToString() : m_CompanyDBInboxMaxQuotaMB.ToString()) + ";");
            builder.Append(FEATURE_CODE_AUTOPAYMPF_HAS_HSBCHASE + "=" + (m_CompanyDBAutopayMPFFileHasHSBCHASE ? "Y" : "N") + ";");
            builder.Append(FEATURE_CODE_AUTOPAYMPF_HAS_OTHERS + "=" + (m_CompanyDBAutopayMPFFileHasOthers ? "Y" : "N") + ";");
            HROne.CommonLib.Crypto crypto = new HROne.CommonLib.Crypto(HROne.CommonLib.Crypto.SymmProvEnum.RC2);
            return(crypto.Encrypting(builder.ToString(), HROne.ProductLicense.ProductLicenseType.HROneSaaS.ToString()));
        }
Beispiel #2
0
        private void SetDatabaseConfig(XmlElement databaseConfigRootNode, DatabaseConfig dbConfig)
        {
            XmlDocument config = databaseConfigRootNode.OwnerDocument;

            databaseConfigRootNode.AppendChild(config.CreateElement("name"));
            databaseConfigRootNode["name"].InnerText = dbConfig.name;
            databaseConfigRootNode.AppendChild(config.CreateElement("dbtype"));
            if (dbConfig.DBType.Equals(DBTypeEmun.MSSQL))
            {
                HROne.CommonLib.Crypto crypto = new HROne.CommonLib.Crypto(HROne.CommonLib.Crypto.SymmProvEnum.Rijndael);

                databaseConfigRootNode["dbtype"].InnerText = "MSSQL";
                databaseConfigRootNode.AppendChild(config.CreateElement("ConnectionString"));

                System.Data.SqlClient.SqlConnectionStringBuilder connStringBuilder = new System.Data.SqlClient.SqlConnectionStringBuilder(dbConfig.ConnectionString);
                connStringBuilder.Password = crypto.Encrypting(connStringBuilder.Password, keyString);
                databaseConfigRootNode["ConnectionString"].InnerText = connStringBuilder.ConnectionString;
            }
        }
Beispiel #3
0
        public string GetProductKey()
        {
            string sSerialNo    = ConvertNumberToBase64String(m_SerialNo);
            string sProductCode = ProductType.ToString();
            string sCompanyUser = ConvertNumberToBase64String((ushort)(m_NumOfCompanies * 100 + m_NumOfUsers));
            //string sTrialPeriod = ConvertNumberToBase64String
            //    ((ushort)((m_IsTrialKey ? FLAG_TRIAL_KEY : (ushort)0) + m_TrialDays));
            string sFeature = ConvertNumberToBase64String
                                  ((byte)((m_IsPayroll ? FLAG_PAYROLL : (byte)0)
                                          | (m_IsTaxation ? FLAG_TAXATION : (byte)0)
                                          | (m_IsLeaveManagement ? FLAG_LEAVE : (byte)0)
                                          | (m_IsESS ? FLAG_ESS : (byte)0)
                                          | (m_IsAttendance ? FLAG_Attendance : (byte)0)
                                          | (m_IsCostCenter ? FLAG_CostCenter : (byte)0)
                                          | (m_IsTraining ? FLAG_Training : (byte)0)
                                          ));

            string preProductKey = sSerialNo + "-" + sCompanyUser + "-" + sFeature;

            HROne.CommonLib.Crypto crypto = new HROne.CommonLib.Crypto(symProvEnum);
            string productKey             = crypto.Encrypting(preProductKey, sProductCode);
            string decryptProductKey      = crypto.Decrypting(productKey, sProductCode);

            string base32Key = base32.ConvertBase64ToBase32(productKey);

            return(base32Key);

            //string sSerialNo = base32.encodeb32(m_SerialNo, 4);
            //string sProductCode = base32.ReverseEncodeString(m_ProductCode);
            //string sCompanyUser = base32.encodeb32(m_NumOfCompanies * 100 + m_NumOfUsers, 3);
            //string sTrialPeriod = base32.encodeb32
            //    (m_IsTrialKey ? FLAG_TRIAL_KEY : 0 + m_TrialDays, 2);
            //string sFeature = base32.encodeb32
            //    ((m_IsPayroll ? FLAG_PAYROLL : 0)
            //    | (m_IsTaxation ? FLAG_TAXATION : 0)
            //    | (m_IsLeaveManagement ? FLAG_LEAVE : 0)
            //    | (m_IsESS ? FLAG_ESS : 0)
            //    | (m_IsAttendance ? FLAG_Attendance : 0), 2);

            //string preProductKey = sSerialNo + sProductCode + sCompanyUser + sTrialPeriod + sFeature;
            //return base32.CheckSum(preProductKey) + preProductKey;
        }
Beispiel #4
0
        public static string URLwithEncryptQueryString(HttpSessionState session, string URL)
        {
            if (session["EncryptQueryString"] != null)
            {
                if (session["EncryptQueryString"].Equals(true))
                {
                    int QueryStartQuestionMarkPos = URL.IndexOf('?');
                    if (QueryStartQuestionMarkPos >= 0)
                    {
                        string originalQueryString = URL.Substring(QueryStartQuestionMarkPos + 1);

                        if (!string.IsNullOrEmpty(originalQueryString))
                        {
                            HROne.CommonLib.Crypto crypto = new HROne.CommonLib.Crypto(HROne.CommonLib.Crypto.SymmProvEnum.Rijndael);
                            string newQueryString         = crypto.Encrypting(originalQueryString, "0123456789abcdef");
                            URL = URL.Replace(originalQueryString, System.Web.HttpUtility.UrlEncode(newQueryString));
                        }
                    }
                }
            }
            return(URL);
        }