Example #1
0
        private void NewUser_Click(object sender, EventArgs e)
        {
            frmUser fUser = new frmUser();

            fUser.Action = "NEW";
            fUser.User   = new SynapseUser();
            if (fUser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                SynapseUser _user = fUser.User;
                olvUsers.AddObject(_user);
                olvUsers2.AddObject(_user);

                switch (tabControl1.SelectedIndex)
                {
                case 0:
                    olvUsers.SelectedObject = _user;
                    break;

                case 1:
                    olvUsers2.SelectedObject = _user;
                    break;
                }
                AllUserCollection = SynapseUser.Load();
            }
        }
Example #2
0
        private void EditUser_Click(object sender, EventArgs e)
        {
            SynapseUser _user = new SynapseUser();

            switch (tabControl1.SelectedIndex)
            {
            case 0:
                _user = (SynapseUser)olvUsers.SelectedObject;
                break;

            case 1:
                _user = (SynapseUser)olvUsers2.SelectedObject;
                break;
            }

            frmUser fUser = new frmUser();

            fUser.Action = "EDIT";
            fUser.User   = _user;
            if (fUser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                _user = fUser.User;
                olvUsers.RefreshObject(_user);
                olvUsers2.RefreshObject(_user);

                switch (tabControl1.SelectedIndex)
                {
                case 0:
                    olvUsers.SelectedObject  = _user;
                    olvUsers2.SelectedObject = null;
                    break;

                case 1:
                    olvUsers.SelectedObject  = null;
                    olvUsers2.SelectedObject = _user;
                    break;
                }
                AllUserCollection = SynapseUser.Load();
            }
        }