示例#1
0
        public Auction(MyDbContext db, Acccount acccount, User user)
        {
            this.db        = db;
            lotRepository  = new LotRepository(db);
            userRepository = new UserRepository(db);
            InitializeComponent();

            this.user     = user;
            this.acccount = acccount;
            Update_LotsFromData();
            Update_AvailableLots();
            Update_PlannedLots();
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //testing here
            this.Hide();
            //new BidForm(new Lot { Name = "New lot", Date = "21-6-2020", MinBid = 100 }, new User() { Balance = 20000 }).Show();
            //end testing

            if (textBox1.Text.Length > 0)
            {
                user = userRepository.Get(textBox1.Text);
                if (user.Password != null && user.Password.Length > 0)
                {
                    if (user.Password.Equals(textBox2.Text))
                    {
                        acccount = new Acccount(user);
                        this.Hide();
                        acccount.Show(); // відкривається форма account.cs
                    }
                    else
                    {
                        MessageBox.Show("Error wrong password");
                    }
                }
                else
                {
                    if (textBox2.Text.Length > 0)
                    {
                        user.Password = textBox2.Text;
                        userRepository.Update(user);
                        acccount = new Acccount(user);
                        this.Hide();
                        acccount.Show();
                    }
                }
            }
        }