Ejemplo n.º 1
0
        private static bool registerContractor(string firstname, string lastname, string email, string phone, string password, string company, string companyAddress, string companyPhone, string companyEmail)
        {
            connection.Open();
            string     pswd = PasswordEncryption.CreateHash(password);
            SqlCommand cmd  = new SqlCommand("insert into UserAccounts ([Email], [Password], [UserType], [Confirmed]) VALUES (@email, @password, @usertype, @confirmed)", connection);

            cmd.Parameters.AddWithValue("@email", email.ToLower());
            cmd.Parameters.AddWithValue("@password", pswd);
            cmd.Parameters.AddWithValue("@usertype", "Contractor");
            cmd.Parameters.AddWithValue("@confirmed", 0);
            int i = cmd.ExecuteNonQuery();

            int j = companyCheck(company, firstname, lastname, email, phone, companyAddress, companyPhone, companyEmail).ExecuteNonQuery();

            connection.Close();
            confirmationEmail(email, firstname + " " + lastname);

            if (i > 0 && j > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        private static bool registerOccupant(string firstname, string lastname, string email, string phone, string password)
        {
            connection.Open();
            string     pswd = PasswordEncryption.CreateHash(password);
            SqlCommand cmd  = new SqlCommand("insert into UserAccounts ([Email], [Password], [UserType], [Confirmed]) VALUES (@email, @password, @usertype, @confirmed)", connection);

            cmd.Parameters.AddWithValue("@email", email.ToLower());
            cmd.Parameters.AddWithValue("@password", pswd);
            cmd.Parameters.AddWithValue("@usertype", "Occupant");
            cmd.Parameters.AddWithValue("@confirmed", 0);
            int i = cmd.ExecuteNonQuery();

            SqlCommand occmd = new SqlCommand("Insert into Customer (First, Last, Email, Phone#) VALUES (@firstname, @lastname, @emailaddress, @phonenumber)", connection);

            occmd.Parameters.AddWithValue("@firstname", firstname);
            occmd.Parameters.AddWithValue("@lastname", lastname);
            occmd.Parameters.AddWithValue("@emailaddress", email.ToLower());
            occmd.Parameters.AddWithValue("@phonenumber", phone);
            int j = occmd.ExecuteNonQuery();

            connection.Close();
            confirmationEmail(email, firstname + " " + lastname);

            if (i > 0 && j > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }