private void button1_Click(object sender, EventArgs e) { string room = comboBoxRoom.SelectedValue.ToString(); int bedNo = int.Parse(comboBoxBedNo.SelectedValue.ToString()); if (RoomDAO.getRoomPrice(room) > s.MoneyAccount) { MessageBox.Show("MoneyAccount is not enough to book room"); } else { HistoryBook h = new HistoryBook(s.StuID, DateTime.Now, room, bedNo, 1, 1, a.To.AddDays(30)); HistoryBookDAO.Insert(h); this.Dispose(); StudentMainGUI stu = new StudentMainGUI(s.Username); stu.ShowDialog(); } }
private void btnLogin_Click(object sender, EventArgs e) { string user = txtUsername.Text; string pass = txtPassword.Text; Account a = AccountDAO.GetAccountByUsername(user); if (a == null) { lblNotify.Text = "**username not exist**"; } else { if (a.Password == pass) { if (a.Type == 0) { StudentMainGUI s = new StudentMainGUI(user); s.ShowDialog(); this.Dispose(); } if (a.Type == 1) { ManagerMainGUI m = new ManagerMainGUI(user); m.ShowDialog(); this.Dispose(); } if (a.Type == 2) { updateStudent(); AdminMainGUI ad = new AdminMainGUI(user); ad.ShowDialog(); this.Dispose(); } } else { lblNotify.Text = "**wrong password**"; } } }