예제 #1
0
        public int updateLicenseEmailDate(bool emailSentOk, license.License lic)
        {
            int noRowsAffected = 0;
            int iEmailOk       = 0;// false, 1 will be ok

            if (emailSentOk)
            {
                iEmailOk = 1;
            }

            string strSqlStatement = "update License " +
                                     "set emailsent = " + iEmailOk + "," +
                                     " emaildate = CURRENT_TIMESTAMP " +
                                     "WHERE productid = '" + lic.s_strProductID + "';";

            try
            {
                noRowsAffected = Database.writeToDataBase(strSqlStatement);
            }
            catch (System.Exception e)
            {
                data.Log.debug("Some problems in attachLicense" +
                               e.Message);
                noRowsAffected = 0;
            }

            if (noRowsAffected != 1)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        }
예제 #2
0
        public string getLicenseId(license.License lic)
        {
            string strLicenseId;

            string strSqlStatement = "select id from License " +
                                     "WHERE  productid = '" + lic.s_strProductID + "';";

            try
            {
                strLicenseId = Database.readFromDataBase(strSqlStatement);
            }
            catch (System.Exception e)
            {
                data.Log.debug("Some problems in attachLicense" + e.Message);
                return("InvalidNumber");
            }

            return(strLicenseId);
        }
예제 #3
0
        public int attachLicense(license.License lic)
        {
            int noRowsAffected = 0;

            string strSqlStatement = "insert into License " +
                                     "(name, productname, productversion, customerid, customername, " +
                                     "customeremail, productid, generatedkey, creationdate) " +
                                     "values (" +
                                     " 'license name','" +
                                     this.m_ipn.str_item_name + "','" +
                                     this.m_ipn.str_item_number + "','" +
                                     this.m_ipn.str_txn_id + "','" +
                                     this.m_ipn.str_first_name + " " + this.m_ipn.str_last_name + "','" +
                                     this.m_ipn.str_payer_email + "','" +
                                     lic.s_strProductID + "','" +
                                     lic.s_strSoftwareKey + "'," +
                                     " CURRENT_TIMESTAMP ); ";

            try
            {
                noRowsAffected = Database.writeToDataBase(strSqlStatement);
            }
            catch (System.Exception e)
            {
                data.Log.debug("Some problems in attachLicense, try default" +
                               e.Message);
                string strSqlStatement2 = "insert into License " +
                                          "(name, productname, productversion, customerid, " +
                                          "customeremail, productid, generatedkey, creationdate) " +
                                          "values (" +
                                          "'license ERROR','" +
                                          "str_item_name " + "','" +
                                          "str_item_number " + "','" +
                                          "str_txn_id" + "','" +
                                          "str_payer_email" + "','" +
                                          "s_strProductID" + "','" +
                                          "s_strSoftwareKey" + "'," +
                                          " CURRENT_TIMESTAMP " +
                                          ");";
                try
                {
                    Database.writeToDataBase(strSqlStatement2);
                    noRowsAffected = 0;
                }
                catch (System.Exception e2)
                {
                    data.Log.debug("Some problems in attachLicense" +
                                   e2.Message);
                    noRowsAffected = 0;
                }
            }

            if (noRowsAffected != 1)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        }