コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(textBox2.Text) || String.IsNullOrEmpty(textBox2.Text))
            {
                MessageBox.Show("Please put all data needed.");
            }
            else
            {
                var register = new register
                {
                    id       = textBox3.Text,
                    username = textBox1.Text,
                    password = textBox2.Text
                };

                FirebaseResponse response = client.Set("Users/" + textBox3.Text, register);
                register         res      = response.ResultAs <register>();
                MessageBox.Show("Register account successfully");
                textBox1.Text = String.Empty;
                textBox2.Text = String.Empty;
                textBox3.Text = String.Empty;
                this.Dispose();
                Form1 frm = new Form1();
                frm.ShowDialog();
            }
        }
コード例 #2
0
 public static bool IsEqual(register user1, register user2)
 {
     if (user1 == null || user2 == null)
     {
         return(false);
     }
     if (user1.username != user2.username)
     {
         error = "Username doesnt exist!";
         return(false);
     }
     if (user1.password != user2.password)
     {
         error = "Username and password doesn't match";
         return(false);
     }
     return(true);
 }
コード例 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(textBox2.Text))
         {
             MessageBox.Show("Please put username and password.");
         }
         else
         {
             FirebaseResponse response = client.Get(@"Users/");
             register         ResUser  = response.ResultAs <register>();
             register         CurUser  = new register
             {
                 username = textBox1.Text,
                 password = textBox2.Text
             };
             if (register.IsEqual(ResUser, CurUser))
             {
                 frmHome frm = new frmHome();
                 frm.ShowDialog();
             }
             else
             {
                 MessageBox.Show("Error");
             }
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("Your ID is didn't match. Please signup again!");
     }
     catch (Exception)
     {
         MessageBox.Show("Something went wrong. Please restart the system.");
     }
 }