Exemplo n.º 1
0
 public static string getAddUserCredentialQuery(User user, short userType)
 {
     StringBuilder query = new StringBuilder();
     query.Append("Insert into users values(").Append(user.ID);
     query.Append(", \'").Append(user.Username).Append("\', \'").Append(user.Password);
     query.Append("\', ").Append(userType).Append(")");
     return query.ToString();
 }
Exemplo n.º 2
0
 public static string getAddGenericUserProfileQuery(User user)
 {
     StringBuilder query = new StringBuilder();
     query.Append("Insert into generic_user_profiles values(").Append(user.ID).Append(", \'");
     query.Append(user.Name).Append("\', ").Append(user.DOB).Append(", \'").Append(user.Email).Append("\', \'");
     query.Append(user.HomeAddress).Append("\', \'").Append(user.ContactNumber).Append("\', ");
     query.Append((int)user.Gender).Append(")");
     return query.ToString();
 }
Exemplo n.º 3
0
        private static bool extractGenericUserDetails(Dictionary<string, string> userDetails, User user)
        {
            try
            {
                user.ID = UInt64.Parse(userDetails["uid"]);
                user.Username = userDetails["username"];
                user.Password = userDetails["password"];
                user.Name = userDetails["name"];
                user.Email = userDetails["email"];
                user.HomeAddress = userDetails["home_address"];
                user.ContactNumber = userDetails["contact_number"];
                user.DOB = UInt64.Parse(userDetails["dob"]);
                string gender = userDetails["gender"];

                if (gender == "m")
                    user.Gender = GENDER.MALE;
                else if (gender == "f")
                    user.Gender = GENDER.FEMALE;
                else if (gender == "s")
                    user.Gender = GENDER.SHEMALE;
                else
                    return false;

                return true;
            }
            catch (Exception ex)
            {
                return Utilities.logException(ex);
            }
        }