예제 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            f = new Function();
            String username = this.usernameadminTXT.Text;
            String password = this.userpassadminTXT.Text;

            if (f.login(listAdminNamePass, username, password))
            {
                admin fm = new admin(this);
                fm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Wrong Username or Password");
            }
        }
예제 #2
0
        private void firebaselogin_Click(object sender, EventArgs e)
        {
            String username = this.usernameadminTXT.Text;
            String Password = this.userpassadminTXT.Text;
            String city     = "";
            String type     = "";
            String name     = "";
            int    k        = 0;

            for (int i = 0; i < username.Length; i++)
            {
                if (username[i].Equals('/'))
                {
                    k++;
                }
                else if (k == 0)
                {
                    city = city + username[i];
                }
                else if (k == 1)
                {
                    type = type + username[i];
                }
                else if (k == 2)
                {
                    name = name + username[i];
                }
            }
            if (name.Equals("") || city.Equals("") || type.Equals("") || Password.Equals("Password"))
            {
                MessageBox.Show("Please Enter Correct Data");
            }
            else
            {
            }
            help gett = new help()
            {
                name     = "a",
                password = "******"
            };

            try
            {
                var get = client.Get(@"portal/" + city + "/" + type);
                gett = get.ResultAs <help>();
                String newname = Convert.ToString(gett.name);
                String newpass = Convert.ToString(gett.password);
                if (name.Equals(newname))
                {
                    if (Password.Equals(newpass))
                    {
                        MessageBox.Show("Login SuccessFully");
                        admin fm = new admin(this);
                        fm.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Wrong Password");
                    }
                }
                else
                {
                    MessageBox.Show("User Not Exist");
                }
            }
            catch
            {
                MessageBox.Show("Please Enter Correct Data");
            }
        }