Beispiel #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            SqlConnection  conn  = new SqlConnection(@"Data Source=DESKTOP-HR2SEVF\SQLEXPRESS;Initial Catalog=my;User ID=sa;Password=pallavi");
            string         query = "select * from login_table where UserName='******'and Password1='" + password.Password.ToString().Trim() + "';";
            SqlDataAdapter sd    = new SqlDataAdapter(query, conn);
            DataTable      dt    = new DataTable();

            try
            {
                if (ConnectionState.Closed == conn.State)
                {
                    conn.Open();
                }
            }
            catch
            { }
            sd.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                Form1 obj = new Login.Form1();
                this.Hide();
                obj.Show();
            }
            else
            {
                MessageBox.Show("Invalid username or password");
            }
        }
        public async Task <JsonResult> loginFinger()
        {
            string result = "fail";
            string name   = "";

            log = new Login.Form1();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(log);

            name = log.ThisName();

            if (name != "")
            {
                Session["userName"]    = name;
                Session["permissions"] = "2";
                result = "user";
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Login.Form1 f = new Login.Form1();
     f.Show();
 }