public static string GetConnectionBD() { byte[] key = { 5, 9, 2, 8, 1, 3, 6, 1, 9, 23, 31, 56, 13, 4, 21, 76, 7, 1, 0, 20, 26, 12, 8, 4 }; byte[] iv = { 3, 22, 5, 9, 6, 15, 2, 8 }; string srv = EncryptDecryptPhrase.Decrypt(ConfigurationManager.AppSettings.Get("srv").ToString(), key, iv); string bd = EncryptDecryptPhrase.Decrypt(ConfigurationManager.AppSettings.Get("bd"), key, iv); string srvn = EncryptDecryptPhrase.Decrypt(ConfigurationManager.AppSettings.Get("srvn").ToString(), key, iv); string bdn = EncryptDecryptPhrase.Decrypt(ConfigurationManager.AppSettings.Get("bdn"), key, iv); string id = EncryptDecryptPhrase.Decrypt(ConfigurationManager.AppSettings.Get("id"), key, iv); string psw = EncryptDecryptPhrase.Decrypt(ConfigurationManager.AppSettings.Get("psw"), key, iv); return("Data Source=(DESCRIPTION= (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" + srv + ")(PORT=1521))) (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" + bd + "))); User Id=" + id + ";Password="******";Enlist=true;Pooling=true"); //return "Data Source=(DESCRIPTION= (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" + srvn + ")(PORT=1521))) (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" + bdn + "))); User Id=" + id + ";Password="******";Enlist=true;Pooling=true"; }
public static string EncPrueba() { return("ServerPROD=" + EncryptDecryptPhrase.Encrypt("", key, iv) + "\nBDPROD=" + EncryptDecryptPhrase.Encrypt("", key, iv) + "\nServerTRN=" + EncryptDecryptPhrase.Encrypt("", key, iv) + "\nBDTRN=" + EncryptDecryptPhrase.Encrypt("", key, iv) + "\n\nID=" + EncryptDecryptPhrase.Encrypt("", key, iv) + "\nPASS="******"", key, iv)); }
public static List <cADM_USUARIOS> ADM_UsuarioLogin(string usuario, string pasword, string pcreg) { List <cADM_USUARIOS> obj = new List <cADM_USUARIOS>(); string Token = EncryptDecryptPhrase.Encrypt(usuario + ',' + pasword + ',' + DateTime.Now.ToShortDateString(), key, iv); OracleCommand comando = new OracleCommand() { CommandText = "SP_ADM_USUARIOSLOGIN", CommandType = CommandType.StoredProcedure, Connection = new OracleConnection(ConexionBD.GetConnectionBD()) }; comando.Parameters.Add(new OracleParameter("PUSUARIO", OracleDbType.NVarchar2)).Value = usuario; comando.Parameters.Add(new OracleParameter("PCONTRASENA", OracleDbType.NVarchar2)).Value = pasword; comando.Parameters.Add(new OracleParameter("PTOKEN", OracleDbType.NVarchar2)).Value = Token; comando.Parameters.Add(new OracleParameter("PPCREG", OracleDbType.NVarchar2)).Value = pcreg; comando.Parameters.Add(new OracleParameter("OIDUSUARIO", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("ONOMBRE", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("ONIDENTIFICACION", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OCODAREA", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OCODOFICINA", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OCORREO", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OPASSCORREO", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OUSUARIO", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OESTADO", OracleDbType.Int32)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OUSERREG", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OFECHAREG", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OPCREG", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OUSERMODIFY", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OFECHAMODIFY", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OPCMODIFY", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OOBSERVACION", OracleDbType.NVarchar2, 200)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OAREA", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Parameters.Add(new OracleParameter("OOFICINA", OracleDbType.NVarchar2, 100)).Direction = ParameterDirection.Output; comando.Connection.Open(); comando.ExecuteNonQuery(); comando.Connection.Close(); if (comando.Parameters["OIDUSUARIO"].Value.ToString() != "null") { DateTime?FECHAREG = null; if (comando.Parameters["OFECHAREG"].Value.ToString() != "null") { FECHAREG = Convert.ToDateTime(comando.Parameters["OFECHAREG"].Value.ToString()); } DateTime?FECHAMODIFY = null; if (comando.Parameters["OFECHAMODIFY"].Value.ToString() != "null") { FECHAMODIFY = Convert.ToDateTime(comando.Parameters["OFECHAMODIFY"].Value.ToString()); } obj.Add(new cADM_USUARIOS( Convert.ToString(comando.Parameters["OIDUSUARIO"].Value), Convert.ToString(comando.Parameters["ONOMBRE"].Value), Convert.ToString(comando.Parameters["ONIDENTIFICACION"].Value), Convert.ToString(comando.Parameters["OCODAREA"].Value), Convert.ToString(comando.Parameters["OCODOFICINA"].Value), Convert.ToString(comando.Parameters["OCORREO"].Value), Convert.ToString(comando.Parameters["OPASSCORREO"].Value), Convert.ToString(comando.Parameters["OUSUARIO"].Value), Convert.ToInt32(comando.Parameters["OESTADO"].Value.ToString()), Convert.ToString(comando.Parameters["OUSERREG"].Value), FECHAREG, Convert.ToString(comando.Parameters["OPCREG"].Value), Convert.ToString(comando.Parameters["OUSERMODIFY"].Value), FECHAMODIFY, Convert.ToString(comando.Parameters["OPCMODIFY"].Value), Convert.ToString(comando.Parameters["OOBSERVACION"].Value), Convert.ToString(comando.Parameters["OAREA"].Value), Convert.ToString(comando.Parameters["OOFICINA"].Value) )); } return(obj); }