public usrCtrl_CartInfo(string name, List<Items> itemList, List<ProductClass> productList, DatabaseConnection conn, cartBox cB)
 {
     InitializeComponent();
     usernameTmp = name;
     this.itemList = itemList;
     this.productList = productList;
     this.conn = conn;
     this.cB = cB;
     checkProductList();
 }
        public usrCtrl_ItemInCart(cartBox cB, usrCtrl_CartInfo cartUsr)
        {
            this.cB = cB;
            this.cartUsr = cartUsr;
            InitializeComponent();

            if (this.Tag != null)
            {
                price = cB.productList[cB.itemList[int.Parse(this.Tag.ToString())].getIndex()].getPrice() * Convert.ToInt32(countBox.Text);
                priceBox.Text = price.ToString();
            }
        }
        public wndw_Product_Buy(DatabaseConnection conn, string username, List<Items> itemList, string sum, cartBox cB)
        {
            InitializeComponent();
            this.conn = conn;
            this.username = username;
            this.itemList = itemList;
            this.sum = sum;
            this.cB = cB;

            ctrlShipping.Init(conn);

            ctrlAddress.Visibility = Visibility.Hidden;
            ctrlPayment.Visibility = Visibility.Hidden;
            button1.Visibility = Visibility.Hidden;

            payment = null;
            address = null;
            shipment = null;

            clickCounter = 0;
        }
        private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            string login = loginIn.Text;
            string password = passwordIn.Password;

            // Logout
            if (checkCredentials(login, password))
            {
                cB = new cartBox(mw, dbConn);
                mw.cartInfoBox.Children.Clear();
                cB.cartInfoNumber.Content = "0";
                cB.setName(login);
                mw.cartInfoBox.Children.Add(cB);

                logoutBox lB = new logoutBox(mw, dbConn, login);
                lB.userNameTextBox.Content = loginIn.Text;
                mw.login_logout_StackPanel.Children.Clear();
                mw.login_logout_StackPanel.Children.Add(lB);

                mw.loginTmp = 1;
                mw.hideUnhideAddButton(0);

                if (GetRole(login).Equals("Seller"))
                    mw.addNewProductButton.Visibility = Visibility.Visible;

                if (GetRole(login).Equals("Admin"))
                {
                    mw.addNewsButton.Visibility = Visibility.Visible;
                    mw.testButton2.Visibility = Visibility.Visible;
                    mw.testButton3.Visibility = Visibility.Visible;

                    mw.hideUnhideAdminButton(0);
                }
                mw.cartBoxNew.LoadOrders(login);
            }
            else
                MessageBox.Show("Login or password is invalid", "Invalid credentials", MessageBoxButton.OK, MessageBoxImage.Error);

        }