Exemplo n.º 1
0
        private void metroAddNewEmployee_Click(object sender, EventArgs e)
        {
            String Name      = EmployeeName.Text;
            String Surname   = EmployeeSurname.Text;
            String Password  = EmployeePassword.Text;
            String Address1  = EmployeesAddress1.Text;
            String Address2  = EmployeesAddress2.Text;
            String Position  = RestuarantPositions[EmployeePosition.SelectedIndex];
            String Number    = EmployeePhoneNumber.Text;
            int    IntNumber = 0;

            String AddressFull = Address1 + " " + Address2;

            int.TryParse(Number, out IntNumber);

            Con.Open();
            SqlDataAdapter ada = new SqlDataAdapter("SELECT* FROM Employees", Con);
            DataTable      dt  = new DataTable();

            ada.Fill(dt);
            int counts = dt.Rows.Count;
            int id     = counts + 1;

            cmd = new SqlCommand(@"INSERT INTO Employees
                         ([employeeID]
                          ,[FirstName]
                          ,[LastName]
                          ,[Password]
                          ,[Position]
                          ,[Address]
                          ,[PhoneNumber])
                          VALUES('" + id + "','" + Name + "','" + Surname + "','"
                                 + Password + "','" + Position + "','"
                                 + AddressFull + "','" + IntNumber + "')", Con);
            cmd.ExecuteNonQuery();
            Con.Close();
            EmployeesForm _emplyForm = new EmployeesForm();

            _emplyForm.Show();

            this.Dispose();
        }
Exemplo n.º 2
0
        private void metroTileEmployeesmangment_Click(object sender, EventArgs e)
        {
            EmployeesForm employeeform = new EmployeesForm();

            employeeform.Show();
        }