Beispiel #1
0
        private async void buttonSubmit_Click(object sender, EventArgs e)
        
        {
            FirebaseResponse resp = await client.GetTaskAsync("Counter/node");
            Counter get = resp.ResultAs<Counter>();
            String Id = (Convert.ToUInt32(get.cnt) + 1).ToString();
            //Get The Value From Input Field
            /*c.FirstName = metroTextBoxFirstname.Text;
            c.LastName = metroTextBoxLastname.Text;
            c.Address = metroTextBoxAddress.Text;
            c.Gender = metroComboBoxGender.Text;
            c.BirthDate = metroDateTimeBirthDate.Text;
            c.ContactNumber = metroTextBoxContactNo.Text;
            c.UserName = metroTextBoxUsername.Text;
            c.Password = metroTextBoxPassword.Text;*/
            //inserting Data into Database
            var data = new Data
            {
            
            FirstName = metroTextBoxFirstname.Text,
            LastName = metroTextBoxLastname.Text,
            Address = metroTextBoxAddress.Text,
            Gender = metroComboBoxGender.Text,
            BirthDate = metroDateTimeBirthDate.Text,
            ContactNumber = metroTextBoxContactNo.Text,
            UserName = metroTextBoxUsername.Text,
            Password = metroTextBoxPassword.Text,
        };
            if (metroTextBoxFirstname.Text == "")
            {
                MessageBox.Show("Failed to Register! Firstname is Empty!");
            }
            else if (metroTextBoxLastname.Text == "")
            {
                MessageBox.Show("Failed to Register! LastName is Empty!");
            }
            else if (metroTextBoxAddress.Text == "")
            {
                MessageBox.Show("Failed to Register! Address is Empty!");
            }
            else if (metroComboBoxGender.Text == "")
            {
                MessageBox.Show("Failed to Register! Gender is Empty!");
            }
            else if (metroDateTimeBirthDate.Text == "")
            {
                MessageBox.Show("Failed to Register! BirthDate is Empty!");
            }
            else if (metroTextBoxContactNo.Text == "")
            {
                MessageBox.Show("Failed to Register! ContactNo. is Empty!");
            }
            else if (metroTextBoxUsername.Text == "")
            {
                MessageBox.Show("Failed to Register! UserName is Empty!");
            }
            else if (metroTextBoxPassword.Text == "")
            {
                MessageBox.Show("Failed to Register! Password is Empty!");
            }
            else {
                SetResponse response = await client.SetTaskAsync("Admin/" + Id, data);
                Data result = response.ResultAs<Data>();
                var data2 = new Counter
                {
                    cnt = Id
                };
                SetResponse response1 = await client.SetTaskAsync("Counter/node", data2);


                if (metroTextBoxPassword.Text == metroTextBoxRePassword.Text)
                {

                    if (result == result)
                    {
                        MessageBox.Show("Account Successfully Created");
                        this.Hide();
                        Login login = new Login();
                        login.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Failed to Create Account. Try Again.");
                    }
                }
                else
                {
                    MessageBox.Show("Confirm Your Password!!!");
                }
            }
            
            
        }
Beispiel #2
0
 private void buttonBack_Click(object sender, EventArgs e)
 {
     this.Hide();
     Login login = new Login();
     login.ShowDialog();
 }