private async void btnReg_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(Rgp.Text) || string.IsNullOrWhiteSpace(Rgn.Text)) { MessageBox.Show("Worng!,Please input data in Text box."); cleartext(); return; } FirebaseResponse res = await client.GetTaskAsync("auto/id"); auto get = res.ResultAs <auto>(); var memberreg = new Memberreg { id = (Convert.ToInt32(get.cnt) + 1).ToString(), phoneno = Rgp.Text, Name = Rgn.Text }; SetResponse response = await client.SetTaskAsync("memberreg/" + memberreg.id, memberreg); var obj = new auto { cnt = memberreg.id }; SetResponse response1 = await client.SetTaskAsync("auto/id", obj); MessageBox.Show("SUCCESS."); cleartext(); }
private async void btnLog_Click(object sender, EventArgs e) { string pn; int i = 0; if (string.IsNullOrWhiteSpace(Lgph.Text)) { MessageBox.Show("Worng!,Please input Phone No."); cleartext(); return; } pn = Lgph.Text; FirebaseResponse res = await client.GetTaskAsync("auto/id"); auto at = res.ResultAs <auto>(); int cnt = Convert.ToInt32(at.cnt); while (true) { if (i == cnt) { break; } i++; FirebaseResponse response = await client.GetTaskAsync("memberreg/" + i); Memberreg mem = response.ResultAs <Memberreg>(); if (mem.phoneno == pn) { Lgn.Text = mem.Name; Program.logs = 1; Lgph.Text = ""; MessageBox.Show("Login complete."); break; } else { Lgph.Text = ""; MessageBox.Show("Phone No. does exist!"); break; } } }