Exemplo n.º 1
0
        private void BtnCustomer_Click(object sender, RoutedEventArgs e)
        {
            CustomerWindow customerPage = new CustomerWindow();

            customerPage.Show();
            this.Close();
        }
        public QuantityPopUpWindow(CustomerWindow toCallBack, Button btn, int productCode)
        {
            InitializeComponent();
            quantity         = 1;
            txtQuantity.Text = quantity.ToString();
            cb       = toCallBack;
            this.btn = btn;

            this.topQuantity = ServiceProducts.getAvailableProductQuantity(productCode);
            Console.WriteLine(" top quantity " + topQuantity);
        }
        private void BtnRegisterUser_Click(object sender, RoutedEventArgs e)
        {
            CustomerWindow customerWindow;
            Boolean        isRegistrartionSuccessful = ServiceCustomer.registerNewUser(txtLogInEmail.Text, txtLogInPswrd.Text, txtRegisterFirstName.Text, txtRegisterLastName.Text, txtRegisterAddress.Text, txtRegisterCity.Text, "country", int.Parse(txtRegisterPhoneNumber.Text));

            if (isRegistrartionSuccessful)
            {
                customerWindow = new CustomerWindow(true, txtRegisterFirstName.Text);
            }
            else
            {
                customerWindow = new CustomerWindow(false, "");
            }

            this.Close();
            customerWindow.Show();
        }
        private void BtnLogInCostumer_Click(object sender, RoutedEventArgs e)
        {
            CustomerWindow costumerWindow; // här vill vi kolla med db att man faktiskt har blivit inloggad.

            String userEmail = txtLogInEmail.Text;
            String password  = txtLogInPswrd.Text;

            System.Diagnostics.Debug.WriteLine(" skickar med till db: " + userEmail);

            if (ServiceCustomer.isUserCredentialsCorrect(userEmail, password))
            {
                costumerWindow = new CustomerWindow(true, userEmail);
                System.Diagnostics.Debug.WriteLine(" user can sign in ");
            }
            else
            {
                costumerWindow = new CustomerWindow(false, "");
                System.Diagnostics.Debug.WriteLine(" user can not sign in ");
            }

            this.Close();
            costumerWindow.Show();
        }