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(); } }
private static void PositiveAck(IPEndPoint endPoint, BlockCipher cipher, kIntraSlaveId id) { Send(cipher.Encrypt(new Packet(kIntraMasterId.PositiveAck, (byte)id).GetBytes()), endPoint); }
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); }
public static void SendEncrypted(Packet packet) { Send(Encryptor.Encrypt(packet.GetBytes())); }