Exemplo n.º 1
0
 private void InsertData(string firstName, string surName, string mobileOrEmail, string password, string gender, DateTime dob)
 {
     if (CheckIfExists(mobileOrEmail))
     {
         MessageBox.Show("Mobile/Email Already Registered.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     try {
         connection = new OleDbConnection(connectionString);
         password   = blockCipher.Encrypt(password, GenerateKey(firstName, surName, mobileOrEmail));
         string query = String.Format("INSERT INTO UserData (FirstName, SurName, Mobile, [Password], Gender, DateOfBirth) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5} 00:00:00');", firstName, surName, mobileOrEmail, password, gender, dob.ToString("yyyy-MM-dd"));
         connection.Open();
         using (command = new OleDbCommand(query, connection)) {
             int rows = command.ExecuteNonQuery();
             if (rows > 0)
             {
                 MessageBox.Show("Sign Up Sucessful.", "Facebook", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("Sign Up Failed.", "Facebook", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     } catch (Exception ex) {
         MessageBox.Show(ex.Message, "Facebook", MessageBoxButtons.OK, MessageBoxIcon.Error);
     } finally {
         connection.Close();
     }
 }
Exemplo n.º 2
0
 private static void PositiveAck(IPEndPoint endPoint, BlockCipher cipher, kIntraSlaveId id)
 {
     Send(cipher.Encrypt(new Packet(kIntraMasterId.PositiveAck, (byte)id).GetBytes()), endPoint);
 }
Exemplo n.º 3
0
 private static void NegativeAck(IPEndPoint endPoint, BlockCipher cipher, kIntraSlaveId id, string message = "An error occurred while parsing a packet.")
 {
     Send(cipher.Encrypt(new Packet(kIntraMasterId.NegativeAck, (byte)id, message).GetBytes()), endPoint);
 }
Exemplo n.º 4
0
 public static void SendEncrypted(Packet packet)
 {
     Send(Encryptor.Encrypt(packet.GetBytes()));
 }