Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool flgApplyEdit;

            flgApplyEdit = UserManager.Save(objUser, currentUser);

            if (flgApplyEdit)
            {
                UserUpdateEventArgs args = new UserUpdateEventArgs(objUser.DBID, objUser.LoginName, objUser.Role);

                if (Entry_DataChanged != null)
                {
                    if (this.IsNew)
                    {
                        Entry_DataChanged(this, args, DataEventType.INSERT_EVENT);
                    }
                    else
                    {
                        Entry_DataChanged(this, args, DataEventType.UPDATE_EVENT);
                    }
                }
                this.Close();
            }
            else
            {
                MessageBox.Show("Record Not Saved.");
            }
        }
Ejemplo n.º 2
0
        private void Entry_DataChanged(object sender, UserUpdateEventArgs e, DataEventType Action)
        {
            ListViewItem lvItem = null;

            switch (Action)
            {
            case DataEventType.INSERT_EVENT:
                lvItem      = new ListViewItem();
                lvItem.Name = Convert.ToString(e.DBID);
                lvItem.Text = e.LoginName;
                lvItem.SubItems.Add(e.Role);

                lvwUsers.Items.Add(lvItem);
                lvwUsers.EnsureVisible(lvItem.Index);
                break;

            case DataEventType.UPDATE_EVENT:
                lvItem                  = lvwUsers.Items[lvwUsers.SelectedItems[0].Index];
                lvItem.Text             = e.LoginName;
                lvItem.SubItems[1].Text = e.Role;

                lvwUsers.EnsureVisible(lvItem.Index);
                break;
            }
        }