示例#1
0
文件: F9016.cs 项目: CSSAdmin/TScan
        /// <summary>
        /// Populates the grid.
        /// </summary>
        private void PopulateGrid()
        {
            DataGridViewColumnCollection columns = this.DescriptionGrid.Columns;

            this.listDescription = this.form9016Control.WorkItem.GetSqlDescription(this.category);
            columns["SQLID"].DataPropertyName    = this.listDescription.SQLIDColumn.ColumnName;
            columns["Descript"].DataPropertyName = this.listDescription.DescriptionColumn.ColumnName;

            columns["Descript"].DisplayIndex = 0;

            this.DescriptionGrid.DataSource = this.listDescription;
            if (this.listDescription.Rows.Count > 0)
            {
                this.DeleteSQLButton.Enabled          = this.currentFormPermissionField.deletePermission;
                this.DescriptionGrid.Rows[0].Selected = false;
            }

            if (this.listDescription.Rows.Count > this.DescriptionGrid.NumRowsVisible)
            {
                this.DescriptionVScroll.Visible = false;
            }
            else
            {
                this.DescriptionVScroll.Visible = true;
            }
        }
示例#2
0
文件: F9016.cs 项目: CSSAdmin/TScan
        /// <summary>
        /// Handles the SelectionChangeCommitted event of the SqlCategoryCombo control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void SqlCategoryCombo_SelectionChangeCommitted(object sender, EventArgs e)
        {
            try
            {
                Int32 selectedValue = 0;
                if (this.SqlCategoryCombo.SelectedIndex > 0)
                {
                    if (Int32.TryParse(this.SqlCategoryCombo.SelectedValue.ToString(), out selectedValue))
                    {
                        this.listDescription            = this.form9016Control.WorkItem.GetSqlDescription(selectedValue);
                        this.DescriptionGrid.DataSource = this.listDescription;
                    }

                    if (this.listDescription.Rows.Count > this.DescriptionGrid.NumRowsVisible)
                    {
                        this.DescriptionVScroll.Visible = false;
                    }
                    else
                    {
                        this.DescriptionVScroll.Visible = true;
                    }

                    if (this.listDescription.Rows.Count > 0)
                    {
                        this.DeleteSQLButton.Enabled          = this.currentFormPermissionField.deletePermission;
                        this.DescriptionGrid.Rows[0].Selected = false;
                    }
                    else
                    {
                        this.DeleteSQLButton.Enabled = false;
                    }
                }
                else
                {
                    this.listDescription.Clear();
                    this.DescriptionGrid.DataSource = this.listDescription;
                    this.DeleteSQLButton.Enabled    = false;
                }
            }
            catch (SoapException ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm);
            }
            catch (Exception ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm);
            }
        }