Ejemplo n.º 1
0
        public void EditUserForm(UserInfo userInfo)
        {
            UserError error;
            error = AdministrationClient.Instance.LockUser(userInfo);

            if ((error & UserError.NoError) == error)
            {
                try
                {
                    using (UserForm frm = new UserForm(userInfo))
                        frm.ShowDialog();
                }
                finally
                {
                    error = AdministrationClient.Instance.UnlockUser(userInfo);
                    if ((error & UserError.NoError) != error) // Если возникла ошибка при разблокировке
                    {
                        MessageBoxAdv.Show(GetErrorMessage(error, userInfo), "Ошибка");
                    }
                }
            }
            else // Если возникла ошибка при блокировке
            {
                MessageBoxAdv.Show(GetErrorMessage(error, userInfo), "Ошибка");
            }
        }
Ejemplo n.º 2
0
        private void Add()
        {
            switch (SelectedTable)
            {
                case Grid.UserGrid:
                    using (UserForm frm = new UserForm())
                        frm.ShowDialog();
                    UserGridVisibility();
                    gridUserParametrs.Refresh();
                    //Установка курсора таблицы на добавленное значение

                    foreach (DataGridViewRow row in gridUserParametrs.Rows)
                    {
                        if ((string) row.Cells[1].Value == UserListController.Instance.AddedUserCode)
                        {
                            selectedUserRowIndex = row.Index;
                            UserRowSelect();
                        }
                    }

                    break;
                case Grid.LabelGrid:
                    using (LabelForm frm = new LabelForm())
                        frm.ShowDialog();
                    LabelGridVisibility();
                    gridLabelParameters.Refresh();
                    foreach (DataGridViewRow row in gridLabelParameters.Rows)
                    {
                        if ((string)row.Cells[1].Value == LabelListController.Instance.AddedLabelCode)
                        {
                            selectedLabelRowIndex = row.Index;
                            LabelRowSelect();
                        }
                    }
                    break;
            }
        }