예제 #1
0
        public frmCheckIn(User currentUser)
        {
            InitializeComponent();
            this.currentUser = currentUser;

            bsStockStatus = new BindingSource();
            RefreshStockStatus();
        }
예제 #2
0
        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;
        }
예제 #3
0
        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;

            }
        }
예제 #4
0
        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.");
            }
        }
예제 #5
0
파일: Factory.cs 프로젝트: micolous/lloyd
        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();
                }
            }
        }