Esempio n. 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            connection.Open();
            OracleCommand cmd = new OracleCommand("select username, parola, departament from angajat where username = :username and parola = :parola", connection);

            cmd.Parameters.Add(":username", userName.Text);
            cmd.Parameters.Add(":parola", Password.Text);
            OracleDataReader lector = cmd.ExecuteReader();

            if (lector.Read())
            {   //login pe roluri/departamente - aceeasi interfata pentru toti angajatii de pe un departament
                if (lector["departament"].ToString() == "HR")
                {
                    this.Hide();
                    CSapp C = new CSapp();
                    C.Show();
                }
                if (lector["departament"].ToString() == "IT_Support")
                {
                    this.Hide();
                    IT_Support it = new IT_Support();
                    it.Show();
                }
                if (lector["departament"].ToString() == "Others")
                {
                    this.Hide();
                    Other_Department other = new Other_Department();
                    other.Show();
                }

                // userName.Clear();
                // Password.Clear();
            }

            else
            {
                MessageBox.Show("Error: Username/password incorrect!!! Please try again.");
                userName.Clear();
                Password.Clear();
            }
            connection.Close();
            lector.Close();
        } //close button login
Esempio n. 2
0
        private void btnTickets_Click(object sender, EventArgs e)
        {
            connection.Open();
            //afisare tichete it create de departamentul hr in functie de stare, folosind proceduri
            OracleCommand cmd = new OracleCommand("HR_afisare_tickete", connection);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.Add("reg", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            OracleDataAdapter adapter = new OracleDataAdapter();

            adapter.SelectCommand = cmd;
            DataTable dataTable = new DataTable();

            adapter.Fill(dataTable);
            dataGridViewTickets.DataSource = dataTable;

            connection.Close();

            CSapp hr = new CSapp();

            hr.Show();
        }