public static Dictionary <string, string> AreCredentialsValid(string email, string password, SqlConnection conn, SqlCommand query, SqlDataReader data)
        {
            Dictionary <string, string> userdata = new Dictionary <string, string>();

            userdata.Add("credentialsValid", "false");
            ConfigureConnection(conn, query);
            try
            {
                conn.Open();
                query.CommandText = SQL_SELECT_PERSON;
                query.Parameters.Add("email", System.Data.SqlDbType.VarChar).Value    = email;
                query.Parameters.Add("password", System.Data.SqlDbType.VarChar).Value = password;
                data = query.ExecuteReader();
                if (data.HasRows)
                {
                    userdata["credentialsValid"] = "true";
                    while (data.Read())
                    {
                        userdata.Add("firstname", data["firstname"].ToString());
                        userdata.Add("lastname", data["lastname"].ToString());
                        userdata.Add("id", data["id"].ToString());
                        userdata.Add("encreptedPassword", Encription.Encrypt(password));
                    }
                }
                conn.Close();
                data.Close();
            }
            catch (Exception ex)
            {
                // to do: log exception
                conn.Close();
            }
            return(userdata);
        }
        public static Dictionary <string, string> DecreptPassword(string password)
        {
            Dictionary <string, string> decreptionResult = new Dictionary <string, string>();

            decreptionResult.Add("decrepted", "false");

            if (!String.IsNullOrEmpty(password))
            {
                decreptionResult["decrepted"]  = "true";
                decreptionResult["decreption"] = Encription.Decrypt(password);
            }
            return(decreptionResult);
        }
 public static string EncreptPassword(string password)
 {
     return(Encription.Encrypt(password));
 }