Ejemplo n.º 1
0
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            string ConnectionString = ConfigurationManager.ConnectionStrings["dataConnection"].ConnectionString;

            connection = new SqlConnection(ConnectionString);

            users               = new ObservableCollection <User>();
            command             = new SqlCommand();
            command.Connection  = connection;
            command.CommandText = "SELECT * FROM USERS";
            connection.Open();
            reader = command.ExecuteReader();
            while (reader.Read())
            {
                user          = new User();
                user.UserID   = (string)reader["userid"];
                user.Password = (string)reader["password"];
                users.Add(user);
            }
            String username = textBoxUsername.Text;
            String pass     = passwordBox.Password;

            foreach (var kullanici in users)
            {
                if (kullanici.UserID.Equals(username) && kullanici.Password.Equals(pass))
                {
                    this.Hide();
                    Windows.Window1 window1 = new Windows.Window1(this);
                    window1.Show();
                }
            }
        }
Ejemplo n.º 2
0
        public MainWindow(Windows.Window1 window1)
        {
            InitializeComponent();
            string ConnectionString = ConfigurationManager.ConnectionStrings["dataConnection"].ConnectionString;

            connection   = new SqlConnection(ConnectionString);
            this.window1 = window1;
        }