Example #1
0
        ///<summary>Generates an order id that is not in use by any other xwebresponses.</summary>
        public static string CreateOrderId()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod()));
            }
            int attempts = 0;

            while (++attempts < 1000)
            {
                string orderId = MiscUtils.CreateRandomNumericString(10);
                string command = $"SELECT COUNT(*) FROM xwebresponse WHERE OrderId='{POut.String(orderId)}'";
                if (Db.GetCount(command) == "0")
                {
                    return(orderId);
                }
            }
            throw new ODException("Reached 1000 attempts of trying to generate OrderId.");
        }