Esempio n. 1
0
        private void login_Click(object sender, EventArgs e)
        {
            string         uname = username.Text;
            string         pass  = password.Text;
            CarDataContext c     = new CarDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\adi\Documents\New folder\csms.mdf;Integrated Security=True;Connect Timeout=30");


            if (uname == "" || pass == "")
            {
                MessageBox.Show("Provide Your Username and Password");
            }

            else
            {
                var i = (from a in c.RegistationTables
                         where a.Username == uname && a.Password == pass
                         select a);


                if (i.Any())
                {
                    if (uname == "admin" && pass == "admin")
                    {
                        Home h = new Home();
                        h.Show();
                        Visible = false;
                    }
                    else
                    {
                        ClientView cv = new ClientView();
                        OrderInfo  co = new OrderInfo();
                        cv.textBox3.Text = uname;
                        cv.Show();
                        Visible = false;
                    }
                }

                else
                {
                    MessageBox.Show("Invalid Username or Password ");
                }
            }
        }