Exemplo n.º 1
0
        public string GetHisNumber(string ltype)
        {
            string str1 = "";

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = "SELECT TOP 1000 [Number]\r\n                                FROM [Sys_LotteryData] where '" + ltype + "'=substring(Convert(varchar(10),type),1,1) order by STime asc";
                DataTable dataTable = dbOperHandler.GetDataTable();
                if (dataTable.Rows.Count > 1)
                {
                    Random   random   = new Random();
                    string   str2     = dataTable.Rows[random.Next(0, dataTable.Rows.Count - 1)]["Number"].ToString();
                    int      num      = random.Next(0, 4);
                    string[] strArray = str2.Split(',');
                    for (int index = 0; index < strArray.Length; ++index)
                    {
                        str1 = index != num ? str1 + strArray[index] + "," : str1 + (object)random.Next(0, 9) + ",";
                    }
                    str1 = str1.Substring(0, str1.Length - 1);
                }
                else
                {
                    str1 = NumberCode.CreateCode(5);
                }
            }
            return(str1);
        }
Exemplo n.º 2
0
        public string GetHisNumber(string ltype)
        {
            string text = "";

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = "SELECT TOP 1000 [Number]\r\n                                FROM [Sys_LotteryData] where '" + ltype + "'=substring(Convert(varchar(10),type),1,1) order by STime asc";
                DataTable dataTable = dbOperHandler.GetDataTable();
                if (dataTable.Rows.Count > 1)
                {
                    Random   random = new Random();
                    string   text2  = dataTable.Rows[random.Next(0, dataTable.Rows.Count - 1)]["Number"].ToString();
                    int      num    = random.Next(0, 4);
                    string[] array  = text2.Split(new char[]
                    {
                        ','
                    });
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (i == num)
                        {
                            text = text + random.Next(0, 9) + ",";
                        }
                        else
                        {
                            text = text + array[i] + ",";
                        }
                    }
                    text = text.Substring(0, text.Length - 1);
                }
                else
                {
                    text = NumberCode.CreateCode(5);
                }
            }
            return(text);
        }