コード例 #1
0
        private void TableSelectionClosing(object sender, FormClosingEventArgs e)
        {
            var StaffLogin = new StaffLogin();

            this.Hide();
            StaffLogin.Show();
        }
コード例 #2
0
        public void getTopBar()
        {
            dbConnectionString = ConfigurationManager.ConnectionStrings["BarPointOfSaleSystem.Properties.Settings.BarPOSSystemDataConnectionString"].ConnectionString;
            using (StaffLogin login = new StaffLogin())
                using (SqlConnection myConnection = new SqlConnection(dbConnectionString))
                    using (SqlDataAdapter employeePin = new SqlDataAdapter($"SELECT * FROM Employees WHERE PIN = {login.pin}", myConnection))
                    {
                        DataTable userPin = new DataTable();

                        myConnection.Open();
                        employeePin.Fill(userPin);
                        myConnection.Close();
                        for (int row = 0; row < userPin.Rows.Count; row++)
                        {
                            string FirstName = (string)userPin.Rows[row]["FName"];
                            string LastName  = (string)userPin.Rows[row]["LName"];
                            this.topInfoBar1.StaffNameLabel.Text = "Name: " + FirstName + " " + LastName;
                        }
                    }
        }