Example #1
0
        private void passcode_FormClosing(object sender, FormClosingEventArgs e)
        {
            PassSecurity _PassSecObj = new PassSecurity();
            string       filename    = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\encryptedCode.txt";

            if (File.Exists(filename) == true)
            {
                string decryptedPasscode = _PassSecObj.decryptPasscode(_PassSecObj.fetchPasscodeFromDirectory(filename));
                if (decryptedPasscode != this.checkPasscodeTxtBox)
                {
                    MessageBox.Show("Invalid Passcode", "Program will END");
                    Environment.Exit(1);
                }
                else
                {
                    IspasscodeRight = true;
                }
            }
            else
            {
                MessageBox.Show("Invalid Passcode", "Program will END");
                Environment.Exit(1);
            }
            this.passcodeTxtBox.Clear();
        }
Example #2
0
        /// <summary>
        /// Registra en la base de datos la nueva contraseña del miembro
        /// </summary>
        /// <returns>Si se pudo registrar el usuario</returns>
        /// <param name="email">Correo electrónico</param>
        /// <param name="password">Contraseña nueva</param>
        public bool Registrarenbd(string email, string password)
        {
            string newPassword = new PassSecurity().EncodePassword(password);

            transaction = conn.BeginTransaction();
            try
            {
                command             = CreateCommand();
                command.Connection  = conn;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "sp_Miembros_Update_Password";

                command.Parameters.AddWithValue("@Miembro_contrasena", newPassword);
                command.Parameters.AddWithValue("@Miembro_Correo_Electronico", email);

                command.Transaction = transaction;
                command.ExecuteNonQuery();
                transaction.Commit();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                transaction.Rollback();
                SlackLogs.SendMessage(e.Message, GetType().Name, "Registrarenbd");
                return(false);
            }
            finally
            {
                conn.Close();
            }
            return(true);
        }
Example #3
0
        /// <summary>
        /// Registro de invitado
        /// </summary>
        /// <returns><c>true</c>, Si invitado fue registrado, <c>false</c> Existió algún error</returns>
        /// <param name="nombre">Nombre.</param>
        /// <param name="apellidos">Apellidos.</param>
        /// <param name="email">Email.</param>
        /// <param name="asunto">Asunto.</param>
        /// <param name="fecha_entrada">Fecha entrada.</param>
        /// <param name="sucursal_id">Sucursal identifier.</param>
        /// <param name="usuario_id">Usuario identifier.</param>
        /// <param name="usuario_tipo">Usuario tipo.</param>
        public int RegistraInvitado(string nombre, string apellidos, string email, string asunto, DateTime fecha_entrada, string sucursal_id, string usuario_id, string usuario_tipo)
        {
            string clave = new PassSecurity().GeneraIdentifier(20);

            try
            {
                conn.Open();

                transaction         = conn.BeginTransaction();
                command             = CreateCommand();
                command.Connection  = conn;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "sp_pro_Visitas";

                command.Parameters.AddWithValue("@Trasaccion", "ALTA");
                command.Parameters.AddWithValue("@Visita_Nombre", nombre);
                command.Parameters.AddWithValue("@Visita_Apellidos", apellidos);

                command.Parameters.AddWithValue("@Visita_Fecha_Entrada", fecha_entrada);
                command.Parameters.AddWithValue("@Visita_Email", email);
                command.Parameters.AddWithValue("@Visita_Asunto", asunto);
                command.Parameters.AddWithValue("@Visita_Codigo_Acceso", clave);

                command.Parameters.AddWithValue("@Sucursal_Id", sucursal_id);
                if (usuario_tipo == ((int)TiposUsuarios.Miembro).ToString())
                {
                    command.Parameters.AddWithValue("@Miembro_Id", usuario_id);
                    command.Parameters.AddWithValue("@Colaborador_Id", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@Miembro_Id", DBNull.Value);
                    command.Parameters.AddWithValue("@Colaborador_Id", usuario_id);
                }

                command.Parameters.Add("@Visita_Id", SqlDbType.Int).Direction = ParameterDirection.Output;

                command.Transaction = transaction;
                command.ExecuteNonQuery();
                transaction.Commit();
                return(Convert.ToInt32(command.Parameters["@Visita_Id"].Value));
            }

            catch (Exception e)
            {
                SlackLogs.SendMessage(e.Message, GetType().Name, "RegistraInvitado");
                transaction.Rollback();
                Console.WriteLine(e.Message);
                return(-1);
            }
            finally
            {
                conn.Close();
            }
            //new Emails().SendMailInvitado(email, nombre, clave);
        }
        private void hideYApasswords_MainMenu_Load(object sender, EventArgs e)
        {
            PassSecurity _PassSecObj = new PassSecurity();
            string       filename    = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\encryptedCode.txt";

            if (!(File.Exists(filename)))
            {
                MessageBox.Show(string.Format("FIRST SAVE 3 DIGIT PASSCODE \n1 passcode to rule them all !"));
            }
            passcode _passcodeObj = new passcode();

            _passcodeObj.ShowDialog();
        }
        private void UseEmailBTN_Click(object sender, EventArgs e)
        {
            PassSecurity _passSecObj = new PassSecurity();
            decrypt      _decryptObj = new decrypt();
            string       filename    = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\encryptedCode.txt";

            if ((File.Exists(filename)) && PswrdfrmEmailTxtBox.Text != "")
            {
                string fetchedPasswordFrmDir = _passSecObj.fetchPasswordFromDirectory(filename, PswrdfrmEmailTxtBox.Text);
                string originalPassword      = _decryptObj.funcDecrypt(fetchedPasswordFrmDir);
                MessageBox.Show(originalPassword, "Your orignal password is :");
            }
        }
Example #6
0
        private void enterPasscodeButton_Click(object sender, EventArgs e)
        {
            PassSecurity _PassSecObj = new PassSecurity();
            string       filename    = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\encryptedCode.txt";

            checkPasscodeTxtBox = passcodeTxtBox.Text;


            if (!(File.Exists(filename)) && checkPasscodeTxtBox != "" && checkPasscodeTxtBox.Length == 3)
            {
                MessageBox.Show("3 digit Passcode Saved");
                MessageBox.Show(string.Format("WARNING:Dont forget you 3 digit passcode \"{0}\"", checkPasscodeTxtBox));
                MessageBox.Show("if you forget yourpassword view read me");


                _PassSecObj.savePasscode(checkPasscodeTxtBox, filename);
            }
            else if (File.Exists(filename) == true && this.passcodeTxtBox.Text.Length == 3)
            {
                string decryptedPasscode = _PassSecObj.decryptPasscode(_PassSecObj.fetchPasscodeFromDirectory(filename));
                if (decryptedPasscode != this.checkPasscodeTxtBox)
                {
                    MessageBox.Show("Invalid Passcode", "Program will END");
                    Environment.Exit(1);
                }
                else
                {
                    IspasscodeRight = true;
                }
            }
            else
            {
                MessageBox.Show("Invalid Passcode", "Program will END");
                Environment.Exit(1);
            }
            this.passcodeTxtBox.Clear();
            this.Close();
        }
Example #7
0
        public string GetUrlPayment(string monto)
        {
            string response = "";

            try
            {
                string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
                             "<P>" +
                             "<business>" +
                             "<id_company>0001</id_company>" +
                             "<id_branch>0001</id_branch>" +
                             "<user>0001USER</user>" +
                             "<pwd>SECRETO</pwd>" +
                             "</business>" +
                             "<url>" +
                             "<reference>FACTURA001</reference>" +
                             "<amount>" + monto + "</amount>" +
                             "<moneda>MXN</moneda>" +
                             "<canal>W</canal>" +
                             "<omitir_notif_default>1</omitir_notif_default>" +
                             "<st_correo>1</st_correo>" +
                             "<mail_cliente>[email protected]</mail_cliente>" +
                             "<datos_adicionales>" +
                             "<data id=\"1\" display=\"true\">" +
                             "<label>Nombre</label>" +
                             "<value>EL CLIENTE</value>" +
                             "</data>" +
                             "</datos_adicionales>" +
                             "</url>" +
                             "</P>";

                /*P p = new P
                 * {
                 *  bussiness = new bussiness
                 *  {
                 *      id_company = "0001",
                 *      id_branch = "0001",
                 *      user = "******",
                 *      pwd = "SECRETO"
                 *  },
                 *  url = new url
                 *  {
                 *      reference = "FACTURA001",
                 *      amount = monto,
                 *      moneda = "MXN",
                 *      mail_cliente = "*****@*****.**",
                 *      datos_adicionales = new datos_adicionales
                 *      {
                 *          data = new data
                 *          {
                 *              label = "Nombre",
                 *              value = "EL CLIENTE"
                 *          }
                 *      }
                 *  }
                 * };*/

                string PostToSend = "<pgs><data0>1234ABCD</data0><data>" + PassSecurity.EncryptAES128(xml, "SECRETO") + "</data></pgs>";
                response = new HttpRequest().POST("https://qa5.mitec.com.mx/p/gen", PostToSend);
            }
            catch (Exception e) { SlackLogs.SendMessage(e.Message, GetType().Name, "GetUrlPayment"); }
            return(response);
        }