Example #1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            SignInFormForTenant sifft = new SignInFormForTenant();

            sifft.Show();
            Dispose();
        }
        private void SignInButton_Click(object sender, EventArgs e)
        {
            if (UserNameBox.Text != "" && PasswordBox.Text != "" && UserNameBox.Text.Length == 11 && PasswordBox.Text.Length >= 8 && UserNameBox.Text.All(char.IsDigit) && (UserNameBox.Text.StartsWith("017") || UserNameBox.Text.StartsWith("016") ||
                                                                                                                                                                            UserNameBox.Text.StartsWith("015") || UserNameBox.Text.StartsWith("019") || UserNameBox.Text.StartsWith("018")))
            {
                String uname = UserNameBox.Text;
                String pass  = PasswordBox.Text;
                try
                {
                    Owner s = DB.Owners.SingleOrDefault(x => x.Mobile_No == uname && x.Password == pass);
                    if (s != null)
                    {
                        SignInFormForHouseOwner o = new SignInFormForHouseOwner();
                        o.Show();

                        Dispose();
                    }

                    /*else
                     *  MessageBox.Show("Wrong Mobile No or Password!");*/
                }
                catch (Exception)
                {
                }
                try
                {
                    Tenant t = DB.Tenants.SingleOrDefault(x => x.Mobile_No == uname && x.Password == pass);
                    if (t != null)
                    {
                        SignInFormForTenant te = new SignInFormForTenant();
                        te.Show();

                        Dispose();
                    }

                    /* else
                     *   MessageBox.Show("Wrong Mobile No or Password!");*/
                }
                catch (Exception)
                {
                }
                try
                {
                    Admin a = DB.Admins.SingleOrDefault(x => x.Mobile_No == uname && x.Password == pass);
                    if (a != null)
                    {
                        SignInFormForAmin ai = new SignInFormForAmin();
                        ai.Show();

                        Dispose();
                    }
                }
                catch (Exception)
                {
                }
            }
            else
            {
                MessageBox.Show("Invalid input");
            }
            u = UserNameBox.Text;
        }