示例#1
0
        private void loadEmployee()
        {
            lvEmployee.Items.Clear();
            lvEmployee.SuspendLayout();
            List <clsAccountUser> list = new List <clsAccountUser>();

            clsAccountUser clsAccount = new clsAccountUser();

            list = clsAccount.getList();

            foreach (clsAccountUser account in list)
            {
                ListViewItem oItem = new ListViewItem();

                oItem.Text = account.Username;
                oItem.SubItems.Add(account.FullName);
                oItem.SubItems.Add(account.Status.ToString());

                oItem.Tag = account;

                lvEmployee.Items.Add(oItem);
            }

            tsslEmployee.Text = "Row Count: " + lvEmployee.Items.Count;
            lvEmployee.ResumeLayout();
        }
        private bool saveAccount(string username, string password, string firstname, string middlename, string lastname)
        {
            clsAccountUser account = new clsAccountUser();

            account.Username   = username;
            account.Password   = password;
            account.Firstname  = firstname;
            account.Middlename = middlename;
            account.Lastname   = lastname;

            if (account.save())
            {
                return(true);
            }

            return(false);
        }
示例#3
0
        private void initApplicatioon()
        {
            setApplicationState(ApplicationState.SigningIn);

            this.scMain.Visible           = false;
            this.tsddbAccountUser.Visible = false;
            this.tssDivider.Visible       = false;

            this.pnlMenu.Controls.Clear();

            if (!this.connected)
            {
                clsAccountUser auth = new clsAccountUser();
                frmSignin      frm  = new frmSignin();
                frm.StartPosition = FormStartPosition.CenterParent;

                DialogResult result = frm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    this.scMain.Visible           = true;
                    this.tssDivider.Visible       = true;
                    this.tsddbAccountUser.Visible = true;

                    this.tsslApplicationState.Text = "Ready.";

                    // fills menu list
                    addMenu();

                    this.tsddbAccountUser.Text = "@" + General.currentUser.Username;
                }
                else
                {
                    this.DialogResult = DialogResult.Abort;
                    this.Close();
                }
            }

            setApplicationState(ApplicationState.Ready);
        }
示例#4
0
        private void LvEmployee_KeyDown(object sender, KeyEventArgs e)
        {
            if (lvEmployee.SelectedItems.Count != 1)
            {
                return;
            }

            clsAccountUser account = new clsAccountUser();

            if (e.KeyCode == Keys.Delete)
            {
                if (General.askQuestion("Delete Record", "Are you sure do you want to delete this record?", "Permanent Deletion") == DialogResult.Yes)
                {
                    if (account.delete((clsAccountUser)lvEmployee.SelectedItems[0].Tag))
                    {
                        General.showMessageBox("Success", "Succesfully deleted the record", MsgTypes.success);
                        lvEmployee.SelectedItems[0].Remove();
                        tsslEmployee.Text = "Row Count: " + lvEmployee.Items.Count;
                    }
                }
            }
        }