Ejemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            dgv.AutoGenerateColumns = true;

            _db = new RestoContext();
            switch (_contract) {
                case Contract.Customer:
                    Text += " Pelanggan";
                    _db.Customers.OrderByDescending(x => x.UpdatedAt).Load();
                    bindingSource.DataSource = _db.Customers.Local.ToBindingList();
                    break;

                case Contract.Product:
                    Text += " Produk";
                    _db.Products.OrderByDescending(x => x.UpdatedAt).Load();
                    bindingSource.DataSource = _db.Products.Local.ToBindingList();
                    break;

                case Contract.User:
                    Text += " Pengguna";
                    _db.Users.OrderByDescending(x => x.UpdatedAt).Load();
                    bindingSource.DataSource = _db.Users.Local.ToBindingList();
                    break;
            }
        }
Ejemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            dgvUnpaid.AutoGenerateColumns = true;
            dgvPaid.AutoGenerateColumns = true;

            _db = new RestoContext();
            _db.Bills.Load();
            _Reload();
        }
Ejemplo n.º 3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (!Utility.RequiredCheck(errorProvider, txtUsername, txtPassword, txtConfirm)) {
                return;
            }

            var username = txtUsername.Text.Trim();
            var password = txtPassword.Text.Trim();
            var confirm = txtConfirm.Text.Trim();

            if (password != confirm) {
                MessageBox.Show("masukkan password dan konfirmasi password tidak sama");
                return;
            }

            using (var db = new RestoContext()) {
                var user = db.Users.Where(x => x.Username == username).FirstOrDefault();
                if (user != null && user.Password == Utility.SHA1Digest(password)) {
                    this.DialogResult = DialogResult.OK;
                } else {
                    MessageBox.Show("username/password yang anda masukkan salah");
                }
            }
        }