Esempio n. 1
0
 public checkout(User newUser, ShoppingCart cart, StorePage store)
 {
     user        = newUser;
     currentCart = cart;
     prev        = store;
     InitializeComponent();
     CopyDataGridView(StorePage.passingGridTable);
     cost.Text = getTotal().ToString();
 }
Esempio n. 2
0
        //Grabs info, checks for existance, and returns file or sends error
        private void loginStore(object sender, MouseEventArgs e)
        {
            bool   exists      = false;
            User   currentUser = new User();
            string user        = Path.Combine(storeClasses.generalFilePath, "Users", UsernameBox.Text + ".txt");
            string pass        = PasswordBox.Text;

            string projectPath = storeClasses.generalFilePath;

            projectPath = Path.Combine(projectPath, "Users");

            foreach (string itemFile in Directory.EnumerateFiles(projectPath))
            {
                if (itemFile == user)
                {
                    exists = true;
                    string[] info = System.IO.File.ReadAllLines(itemFile);
                    if (info[0] == pass)
                    {
                        currentUser.name     = UsernameBox.Text;
                        currentUser.password = info[0];
                        currentUser.ID       = long.Parse(info[1]);
                        currentUser.wallet   = double.Parse(info[2]);
                        currentUser.address  = info[3];
                    }
                    else
                    {
                        MessageBox.Show("Please retry login.");
                        tries++;
                        if (tries > 3)
                        {
                            MessageBox.Show("Too many tries attempted, now exiting...");
                            Environment.Exit(0);
                        }
                        return;
                    }
                }
            }
            if (exists == false)
            {
                MessageBox.Show("Please retry login.");
                return;
            }
            this.Hide();
            StorePage store = new StorePage(currentUser);

            store.Closed += (s, args) => this.Close();
            store.Show();
        }
Esempio n. 3
0
        public Register(StorePage prevPage, User vUser)
        {
            storefront  = prevPage;
            viewingUser = vUser;
            InitializeComponent();
            editButton.Show();
            RegisterButton.Hide();

            UsernameBox.Text = viewingUser.name;
            PasswordBox.Text = viewingUser.password;
            FundsBox.Text    = viewingUser.wallet.ToString();
            AddressBox.Text  = viewingUser.address;

            UsernameBox.ReadOnly = true;
            PasswordBox.ReadOnly = true;
            FundsBox.ReadOnly    = true;
            AddressBox.ReadOnly  = true;
        }