public frmCheckIn(User currentUser) { InitializeComponent(); this.currentUser = currentUser; bsStockStatus = new BindingSource(); RefreshStockStatus(); }
public frmDashboard(User u) { InitializeComponent(); lblWelcome.Text = string.Format(lblWelcome.Text, u.Name); this.u = u; admin = u.IsAdmin; btnUserManager.Enabled = admin; btnUserManager.Visible = admin; btnEditor.Enabled = admin; btnEditor.Visible = admin; }
public frmAddUser(User u) { InitializeComponent(); this.u = u; newitem = u == null; if (u != null) { txtName.Text = u.Name; chkAdmin.Checked = u.IsAdmin; chkBiologicallyMale.Checked = u.IsBiologicallyMale; nudHeight.Value = u.Height; nudWeight.Value = u.Weight; } }
private void btnAccept_Click(object sender, EventArgs e) { // add the user to the system. try { using (var session = Program.factory.OpenSession()) { using (var transaction = session.BeginTransaction()) { if (u == null) { u = new User(); u.LastAccess = DateTime.MinValue; u.IsEnabled = true; } u.Name = txtName.Text; u.IsAdmin = chkAdmin.Checked; u.Weight = (int)nudWeight.Value; u.Height = (int)nudHeight.Value; u.IsBiologicallyMale = chkBiologicallyMale.Checked; if (!string.IsNullOrEmpty(txtAccessKey.Text)) { u.EncodeAccessKey(txtAccessKey.Text); } session.SaveOrUpdate(u); transaction.Commit(); } } //MessageBox.Show("Created user!"); Close(); } catch (Exception) { MessageBox.Show("That username or access key is in use by another user. Please check that this is not a duplicate and try again."); } }
private void PopulateInitialData() { using (var session = SessionFactory.OpenSession()) { using (var transaction = session.BeginTransaction()) { var adminUser = new User { Name = "admin", IsEnabled = true, IsAdmin = true, LastAccess = DateTime.Now }; adminUser.EncodeAccessKey("0000"); session.SaveOrUpdate(adminUser); var testBeverage = new Beverage { Name = "Example Beer", IsEnabled = true, PercentAlcohol = 4.5, Volume = 375 }; session.SaveOrUpdate(testBeverage); transaction.Commit(); } } }