public void TetsSubZone() { int sequence = 1; double households = 2; double studentsK8 = 3; double studentsHighSchool = 4; double studentsUniversity = 5; double employmentEducation = 6; double employmentFood = 7; double employmentGovernment = 8; double employmentIndustrial = 9; double employmentMedical = 10; double employmentOffice = 11; double employmentRetail = 12; double employmentService = 13; double employmentTotal = 14; double parkingOffStreetPaidDailySpaces = 15; double parkingOffStreetPaidHourlySpaces = 16; double mixedUseMeasure = 17; Subzone subzone = new Subzone(sequence) { EmploymentEducation = employmentEducation, EmploymentFood = employmentFood, EmploymentGovernment = employmentGovernment, EmploymentIndustrial = employmentIndustrial, EmploymentMedical = employmentMedical, EmploymentOffice = employmentOffice, EmploymentRetail = employmentRetail, EmploymentService = employmentService, EmploymentTotal = employmentTotal, Households = households, MixedUseMeasure = mixedUseMeasure, ParkingOffStreetPaidDailySpaces = parkingOffStreetPaidDailySpaces, ParkingOffStreetPaidHourlySpaces = parkingOffStreetPaidHourlySpaces, StudentsHighSchool = studentsHighSchool, StudentsK8 = studentsK8, StudentsUniversity = studentsUniversity, }; Assert.Equal(employmentEducation, subzone.EmploymentEducation); Assert.Equal(employmentFood, subzone.EmploymentFood); Assert.Equal(employmentGovernment, subzone.EmploymentGovernment); Assert.Equal(employmentIndustrial, subzone.EmploymentIndustrial); Assert.Equal(employmentMedical, subzone.EmploymentMedical); Assert.Equal(employmentOffice, subzone.EmploymentOffice); Assert.Equal(employmentRetail, subzone.EmploymentRetail); Assert.Equal(employmentService, subzone.EmploymentService); Assert.Equal(employmentTotal, subzone.EmploymentTotal); Assert.Equal(households, subzone.Households); Assert.Equal(mixedUseMeasure, subzone.MixedUseMeasure); Assert.Equal(parkingOffStreetPaidDailySpaces, subzone.ParkingOffStreetPaidDailySpaces); Assert.Equal(parkingOffStreetPaidHourlySpaces, subzone.ParkingOffStreetPaidHourlySpaces); Assert.Equal(studentsHighSchool, subzone.StudentsHighSchool); Assert.Equal(studentsK8, subzone.StudentsK8); Assert.Equal(studentsUniversity, subzone.StudentsUniversity); }
public async Task <bool> postVolunteer(string name, string email, string password, string contact, string postalcode, Subzone zone, string assignedzone) { var ap = new FirebaseAuthProvider(new Firebase.Auth.FirebaseConfig("AIzaSyBjdJIn1k3ksbbZAgY-kQIwUXbD0Zo_q8w")); FirebaseAuthLink res; try { res = await ap.CreateUserWithEmailAndPasswordAsync(email, password); //Attemps to create user with given email & password } catch { return(false); } Volunteer volunteer = new Volunteer(); volunteer.Name = name; volunteer.Email = email; volunteer.Password = password; volunteer.Contact = Convert.ToInt32(contact); volunteer.PostalCode = postalcode; volunteer.ZoneID = zone.Name; volunteer.RegionCode = zone.REGION_C; volunteer.AssignedZones = assignedzone; await firebaseClient .Child("volunteer") .Child(res.User.LocalId) .PutAsync(volunteer); await firebaseClient .Child("authroles") // Places UserID in the authroles section .PatchAsync("{\"" + res.User.LocalId + "\":\"volunteer\"}"); //Patching in JSON format - "USERID:elderly" await PostLog("Created Volunteer"); return(true); }
public async Task <bool> postElderly(string name, char gender, string email, string contact, string password, string address, string postalcode, string specialneeds, Subzone zone) //This method POSTS data to the firebase { var ap = new FirebaseAuthProvider(new Firebase.Auth.FirebaseConfig("AIzaSyBjdJIn1k3ksbbZAgY-kQIwUXbD0Zo_q8w")); FirebaseAuthLink res; try { res = await ap.CreateUserWithEmailAndPasswordAsync(email, password); //Attemps to create user with given email & password } catch { return(false); } Elderly elderly = new Elderly(name, gender, email, contact, address, postalcode, specialneeds, zone.Name, zone.REGION_C); //Puts elderly in firebase await firebaseClient //Posts the elderly object to under (DATABASE)/Requests/UserID .Child("elderly") .Child(res.User.LocalId) //Sets the location of the data to be posted to the ID of the user .PutAsync(elderly); //PUTs location at /Eldelry/UserID/... (Not POST beacuase POST generates random ID - it would become /Eldelry/UID/ID/...) await firebaseClient .Child("authroles") // Places UserID in the authroles section .PatchAsync("{\"" + res.User.LocalId + "\":\"elderly\"}"); //Patching in JSON format - "USERID:elderly" await PostLog("Created Elderly"); return(true); }