Exemple #1
0
        /// <summary>
        /// RefreshData method implmentation
        /// </summary>
        public void RefreshData(bool refreshgrid = false, bool clearselection = false)
        {
            this.UseWaitCursor = true;
            this.Cursor        = Cursors.WaitCursor;
            ComponentResourceManager resources = new ComponentResourceManager(typeof(UsersListView));

            this.uPNDataGridViewTextBoxColumn.HeaderText             = resources.GetString("uPNDataGridViewTextBoxColumn.HeaderText");
            this.mailAddressDataGridViewTextBoxColumn.HeaderText     = resources.GetString("mailAddressDataGridViewTextBoxColumn.HeaderText");
            this.phoneNumberDataGridViewTextBoxColumn.HeaderText     = resources.GetString("phoneNumberDataGridViewTextBoxColumn.HeaderText");
            this.preferredMethodDataGridViewTextBoxColumn.HeaderText = resources.GetString("preferredMethodDataGridViewTextBoxColumn.HeaderText");
            this.enabledDataGridViewCheckBoxColumn.HeaderText        = resources.GetString("enabledDataGridViewCheckBoxColumn.HeaderText");
            try
            {
                _lst = MMCService.GetUsers();
                if (clearselection)
                {
                    this.GridView.RowCount = 0;
                }
                this.GridView.RowCount = MMCService.GetUsersCount();
                if (refreshgrid)
                {
                    this.GridView.Refresh();
                }
                if (clearselection)
                {
                    // this.GridView.ClearSelection();
                }
            }
            finally
            {
                this.UseWaitCursor = false;
                this.Cursor        = Cursors.Default;
            }
        }
        /// <summary>
        /// RefreshData method implmentation
        /// </summary>
        public void RefreshData(bool refreshgrid = false, bool clearselection = false)
        {
            this.UseWaitCursor = true;
            this.Cursor        = Cursors.WaitCursor;
            ComponentResourceManager resources = new ComponentResourceManager(typeof(UsersListView));

            this.uPNDataGridViewTextBoxColumn.HeaderText             = resources.GetString("uPNDataGridViewTextBoxColumn.HeaderText");
            this.mailAddressDataGridViewTextBoxColumn.HeaderText     = resources.GetString("mailAddressDataGridViewTextBoxColumn.HeaderText");
            this.phoneNumberDataGridViewTextBoxColumn.HeaderText     = resources.GetString("phoneNumberDataGridViewTextBoxColumn.HeaderText");
            this.preferredMethodDataGridViewTextBoxColumn.HeaderText = resources.GetString("preferredMethodDataGridViewTextBoxColumn.HeaderText");
            this.enabledDataGridViewCheckBoxColumn.HeaderText        = resources.GetString("enabledDataGridViewCheckBoxColumn.HeaderText");
            try
            {
                _lst = MMCService.GetUsers();
                if (clearselection)
                {
                    GridView.RowCount = 0;
                }
                // GridView.RowCount = _lst.Count;
                GridView.RowCount = MMCService.GetUsersCount();
                if (refreshgrid)
                {
                    GridView.Refresh();
                }
                if (clearselection)
                {
                    GridView.ClearSelection();
                }
            }
            catch (Exception ex)
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters
                {
                    Text    = ex.Message,
                    Buttons = MessageBoxButtons.OK,
                    Icon    = MessageBoxIcon.Error
                };
                SnapIn.Console.ShowDialog(messageBoxParameters);
            }
            finally
            {
                UseWaitCursor = false;
                Cursor        = Cursors.Default;
            }
        }