private void btnTest_Click(object sender, EventArgs e) { _db = new DataContext(); int uId = _db.GetLogger(txtUsername.Text, txtPassword.Text); if (uId == 0) { MessageBox.Show("Wrong Username or Password", "Invalid Login"); } else { String type = _db.CheckUserType(uId); bool log = true; _db.InsertLogActivity(uId); if (log == true && type == "bloodbank") { AdminDashBoard adminDashboard = new AdminDashBoard(uId); adminDashboard.Show(); this.Hide(); } if (log == true && type == "DONOR") { DonorDashBoard adminDashboard = new DonorDashBoard(uId); adminDashboard.Show(); this.Hide(); } if (log == true && type == "EMPLOYEE") { BranchDashBoard branchDashboard = new BranchDashBoard(uId); branchDashboard.Show(); this.Hide(); } } }
public DonorDetails(DonorDashBoard donorForm, string _action, int donorId, int _branchId) { this.donorForm = donorForm; this._action = _action; this.donorId = donorId; this._branchId = _branchId; InitializeComponent(); comboBloodGroup.SelectedIndex = 0; comboGender.SelectedIndex = 0; txtBirthdate.Value = DateTime.Now.AddYears(-15); txtLastDonateDate.Value = DateTime.Now.AddYears(-10); CheckAction(_action); }