public EditMovie(String Title, String connection, AdminForm parent)
 {
     this.parent = parent;
     this.Title = Title;
     this.connection = connection;
     InitializeComponent();
 }
        public AddSession(String connection, AdminForm parent, String id)
        {

            this.connection = connection;
            this.parent = parent;
            cinema_id = id;
            InitializeComponent();
        }
 public AddEmployee(AdminForm parent, String loginid, String connection)
 {
     this.parent = parent;
     this.connection = connection;
     InitializeComponent();
 }
Exemple #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.comboBox1.Text.ToString() == "Pavlo")
                this.connection = "SERVER=PAULIG\\SQLEXPRESS;Database=Cinema;Trusted_Connection=true";
            else if (this.comboBox1.Text.ToString() == "Doorota")
                this.connection = "SERVER=ZWIERZYNIEC;Database=Cinema;Trusted_Connection=true";
            else if (this.comboBox1.Text.ToString() == "Klaudia")
                this.connection = "SERVER=KLAUDIA\\SQLEXPRESS;Database=Cinema;Trusted_Connection=true";
            if (this.comboBox1.Text.ToString() != "")
            {
                SqlConnection selectConnection = new SqlConnection(this.connection);
                selectConnection.Open();
                SqlDataAdapter sqlDataAdapter = new SqlDataAdapter("SELECT IS_ADMIN FROM LOG_IN WHERE USERNAME='******' AND PASSWORD='******'", selectConnection);
                DataTable dataTable = new DataTable();
                sqlDataAdapter.Fill(dataTable);

                if (dataTable.Rows.Count == 1)
                {
                    if (dataTable.Rows[0][0].ToString() == "True")
                    {
                        sqlDataAdapter = new SqlDataAdapter("SELECT ID_LOGIN FROM LOG_IN WHERE USERNAME='******'", selectConnection);
                        dataTable = new DataTable();
                        sqlDataAdapter.Fill(dataTable);

                        sqlDataAdapter = new SqlDataAdapter("SELECT ID_CINEMA FROM EMPLOYEES e JOIN LOG_IN l ON l.ID_EMPLOYEE=e.ID_EMPLOYEE WHERE ID_LOGIN="******"False"))
                            return;

                        sqlDataAdapter = new SqlDataAdapter("SELECT ID_LOGIN FROM LOG_IN WHERE USERNAME='******'", selectConnection);
                        dataTable = new DataTable();
                        sqlDataAdapter.Fill(dataTable);

                        sqlDataAdapter = new SqlDataAdapter("SELECT e.ID_EMPLOYEE FROM EMPLOYEES e JOIN LOG_IN l ON l.ID_EMPLOYEE=e.ID_EMPLOYEE WHERE ID_LOGIN="******"Username or password is incorrect", "authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }

            }
            else
            {
                int num1 = (int)MessageBox.Show("Choose server first", "Server failed", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }


        }