示例#1
0
 private void Presskey_password(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         Sign_In.PerformClick();
     }
 }
示例#2
0
        //opns a new SignIn window
        public static void SignIn(StackPanel MessagesPanel, Dictionary <string, Entity> entities)
        {
            PushAnswer(MessagesPanel, "Okay");

            Sign_In n = new Sign_In();

            n.Show();
            Application.Current.MainWindow.Close();

            return;
        }
        public ActionResult Login(Sign_In signin)
        {
            //string mainconn = ConfigurationManager.ConnectionStrings["hotelEntities2"].ConnectionString;
            SqlConnection con = new SqlConnection(connectionstring);

            con.Open();

            string sqlquery = "select Email,Password from [dbo].[Sign_In] where Email=@Email and Password=@Password";

            SqlCommand sqlcomm = new SqlCommand(sqlquery, con);

            sqlcomm.Parameters.AddWithValue("@Email", signin.Email);
            sqlcomm.Parameters.AddWithValue("@Password", signin.Password);



            SqlDataReader sdr = sqlcomm.ExecuteReader();

            if (sdr.Read())
            {
                ViewData["Success"] = "Correct Email and Passowrd";
                return(RedirectToAction("Cities", "Home"));
            }
            else if (signin.Email == "*****@*****.**" && signin.Password == "123")
            {
                return(RedirectToAction("Index", "Admin"));
            }

            else
            {
                ViewData["Error"] = "Incorrect Email and Password";
            }

            //else
            //{
            //    ViewData["Error Message"] = "Invalid Email and Password";

            //}
            con.Close();
            return(View());
        }
        public ActionResult Sign_In(Sign_In SignInmodel)
        {
            using (SqlConnection con = new SqlConnection(connectionstring))
            {
                con.Open();
                string     query = "insert into Sign_In(UserName,Gender,DOB,Address,City,Email,Password,ConfirmPassword) values (@UserName,@Gender,@DOB,@Address,@City,@Email,@Password,@ConfirmPassword)";
                SqlCommand cmd   = new SqlCommand(query, con);

                cmd.Parameters.AddWithValue("@UserName", SignInmodel.UserName);
                cmd.Parameters.AddWithValue("@Gender", SignInmodel.Gender);
                cmd.Parameters.AddWithValue("@DOB", SignInmodel.DOB);
                cmd.Parameters.AddWithValue("@Address", SignInmodel.Address);
                cmd.Parameters.AddWithValue("@City", SignInmodel.City);
                cmd.Parameters.AddWithValue("@Email", SignInmodel.Email);
                cmd.Parameters.AddWithValue("@Password", SignInmodel.Password);
                cmd.Parameters.AddWithValue("@ConfirmPassword", SignInmodel.ConfirmPassword);
                cmd.ExecuteNonQuery();
                //}   // TODO: Add insert logic here
                con.Close();

                return(RedirectToAction("Index"));
            }
        }