Esempio n. 1
0
        private void btnSearchAnotherUser_Click(object sender, EventArgs e)
        {
            IdForm idform = new IdForm();

            this.Hide();
            idform.Show();
        }
Esempio n. 2
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            LoginButton.BackColor = Color.DarkCyan;
            //Connection with Azure Server to check login identity Aliagha
            SqlConnection sqlConnection = new SqlConnection(
                @"Server=tcp:ehospitalserver.database.windows.net,1433;
                Initial Catalog=E-HospitalDb;
                Persist Security Info=False;
                User ID=ehospitaladmin;
                Password=MaxAliSashaMikita4;
                MultipleActiveResultSets=False;
                Encrypt=True;
                TrustServerCertificate=False;
                Connection Timeout=30;");
            string query = "Select * from Login Where Username = '******' and Password ='******'";

            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(query, sqlConnection);
            DataTable      dataTable      = new DataTable();

            sqlDataAdapter.Fill(dataTable);

            if (dataTable.Rows.Count == 1)
            {
                IdForm idform = new IdForm();
                this.Hide();
                idform.Show();
            }
            else if (txtUsername.TextLength == 0 || txtPassword.TextLength == 0)
            {
                MessageBox.Show("Please enter username and password!", "Error");
            }
            else
            {
                MessageBox.Show("Wrong username or password!", "Error");
            }
        }