public Int32 GerarCodigoNumerico(Int32 numeroNF) { Int32 codigoRetorno = 0; while (codigoRetorno == 0) { Random rnd = new Random(numeroNF); codigoRetorno = Convert.ToInt32(rnd.Next(1, 99999999).ToString("00000000")); } return codigoRetorno; }