示例#1
0
文件: F9600.cs 项目: CSSAdmin/TScan
        /// <summary>
        /// Handles the Click event of the SearchButton 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 SearchButton_Click(object sender, EventArgs e)
        {
            try
            {
                ////if (SearchMenu.Pressed)
                ////{
                ////    this.SearchTextBox.Focus();
                ////    this.SearchTextBox.SelectAll();
                ////}

                this.hitCount = 0;
                this.SearchResultGrid.DataSource = null;
                this.RecordsCountLabel.Text      = this.SearchResultGrid.Rows.Count.ToString(this.textFormat) + " Rows";

                if (!string.IsNullOrEmpty(this.SearchTextBox.Text.Trim()))
                {
                    ////this.searchData = this.F9600Controll.WorkItem.F9600_ListSearchResult(this.SearchTextBox.Text.Trim(), 1);
                    this.FillData(false, false);
                    if (this.searchData.Rows.Count > 0)
                    {
                        this.groupSearchIndicator  = SortIndicator.Ascending;
                        this.searchSearchIndicator = SortIndicator.Ascending;
                        ////this.SearchResultGrid.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True;
                        this.SearchResultGrid.Focus();
                        this.SearchResultGrid.DisplayLayout.Override.TipStyleCell = TipStyle.Show;
                        this.SearchResultGrid.Rows[0].Cells[this.searchData.GroupColumn.ColumnName].Selected = true;
                        this.SearchResultGrid.Rows[0].Cells[this.searchData.GroupColumn.ColumnName].Activate();
                    }
                    else
                    {
                        this.SearchResultGrid.DataSource = null;
                        this.RecordsCountLabel.Text      = "0 Rows";

                        this.SearchDataSource.Rows.Clear();
                        this.PreviewButton.Enabled     = false;
                        this.ExportExcelButton.Enabled = false;
                        this.SearchResultGrid.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
                    }
                }
                else if (this.SearchResultGrid.Rows.Count.Equals(0))
                {
                    this.SearchResultGrid.DataSource = null;
                    this.RecordsCountLabel.Text      = "0 Rows";

                    this.PreviewButton.Enabled     = false;
                    this.ExportExcelButton.Enabled = false;
                    this.SearchResultGrid.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
                    MessageBox.Show(SharedFunctions.GetResourceString("F9600SearchTextValidation"), ConfigurationWrapper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.SearchTextBox.Focus();
                }
            }
            catch (SoapException ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm);
            }
            catch (Exception ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm);
            }
        }
 /// <summary>
 /// 设置是否可以排序
 /// </summary>
 /// <param name="startCol"></param>
 /// <param name="endCol"></param>
 public static void SetColumnSort(UltraWebGrid grid,SortIndicator sort)
 {
     for (int i = 0; i < grid.Bands[0].Columns.Count; i++)
     {
         grid.Bands[0].Columns[i].SortIndicator = sort;//禁用排序
     }
 }
示例#3
0
 /// <summary>
 /// Sets the column sort indicator
 /// </summary>
 /// <param name="col"></param>
 /// <param name="sort"></param>
 public void SetColUserSortIndicator(int col, SortIndicator sort)
 {
     this.ActiveSheet.Columns[col].SortIndicator = sort;
 }
示例#4
0
 public void SetColumnSort(int Position, SortIndicator SortDirection, bool IsGroupByColumn)
 {
     sortPosition    = Position;
     sortDirection   = SortDirection;
     isGroupByColumn = IsGroupByColumn;
 }
示例#5
0
文件: F9600.cs 项目: CSSAdmin/TScan
        /// <summary>
        /// Handles the Click event of the SearchResultGrid 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 SearchResultGrid_Click(object sender, EventArgs e)
        {
            try
            {
                MouseEventArgs e1 = (MouseEventArgs)e;

                Infragistics.Win.UIElement elementUi;

                Point mousePoint = new Point(e1.X, e1.Y);

                // Cast the sender into an UltraGrid
                // Get the Mouse Point
                UIElement element = ((UltraGrid)sender).DisplayLayout.UIElement.ElementFromPoint(mousePoint);

                elementUi = this.SearchResultGrid.DisplayLayout.UIElement.ElementFromPoint(new Point(e1.X, e1.Y));

                if (element == null)
                {
                    return;
                }

                // Try to get a Column from the element
                UltraGridColumn col = elementUi.GetContext(typeof(UltraGridColumn)) as UltraGridColumn;

                // Gets the Header Element
                HeaderUIElement headerElement = element.GetAncestor(typeof(HeaderUIElement)) as HeaderUIElement;

                if (headerElement != null)
                {
                    this.hitCount++;

                    this.columnIndex = col.Index;

                    if (this.hitCount > 1)
                    {
                        if (this.columnIndex.Equals(2))
                        {
                            if (this.groupSearchIndicator.Equals(SortIndicator.Ascending))
                            {
                                if (this.searchSearchIndicator.Equals(SortIndicator.Ascending))
                                {
                                    this.groupSearchIndicator  = SortIndicator.Descending;
                                    this.searchSearchIndicator = SortIndicator.Ascending;
                                }
                                else
                                {
                                    this.groupSearchIndicator  = SortIndicator.Descending;
                                    this.searchSearchIndicator = SortIndicator.Descending;
                                }
                            }
                            else
                            {
                                if (this.searchSearchIndicator.Equals(SortIndicator.Ascending))
                                {
                                    this.groupSearchIndicator  = SortIndicator.Ascending;
                                    this.searchSearchIndicator = SortIndicator.Ascending;
                                }
                                else
                                {
                                    this.groupSearchIndicator  = SortIndicator.Ascending;
                                    this.searchSearchIndicator = SortIndicator.Descending;
                                }
                            }
                        }
                        else if (this.columnIndex.Equals(4) || this.columnIndex.Equals(5))
                        {
                            if (this.groupSearchIndicator.Equals(SortIndicator.Ascending))
                            {
                                if (this.searchSearchIndicator.Equals(SortIndicator.Ascending))
                                {
                                    this.groupSearchIndicator  = SortIndicator.Ascending;
                                    this.searchSearchIndicator = SortIndicator.Descending;
                                }
                                else
                                {
                                    this.groupSearchIndicator  = SortIndicator.Ascending;
                                    this.searchSearchIndicator = SortIndicator.Ascending;
                                }
                            }
                            else
                            {
                                if (this.searchSearchIndicator.Equals(SortIndicator.Ascending))
                                {
                                    this.groupSearchIndicator  = SortIndicator.Descending;
                                    this.searchSearchIndicator = SortIndicator.Descending;
                                }
                                else
                                {
                                    this.groupSearchIndicator  = SortIndicator.Descending;
                                    this.searchSearchIndicator = SortIndicator.Ascending;
                                }
                            }
                        }
                    }

                    if (this.SearchResultGrid.ActiveCell != null)
                    {
                        this.SearchResultGrid.ActiveCell.Selected = false;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm);
            }
        }
示例#6
0
        private void setLayout()
        {
            //Set grid column layout
            try {
                #region A Hack
                this.Controls.Clear();
                Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
                Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
                Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
                Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance();
                this.grdSchedule = new Infragistics.Win.UltraWinGrid.UltraGrid();
                ((System.ComponentModel.ISupportInitialize)(this.grdSchedule)).BeginInit();
                this.SuspendLayout();
                this.grdSchedule.ContextMenu                              = this.ctxSchedule;
                appearance1.BackColor                                     = System.Drawing.SystemColors.Window;
                appearance1.FontData.Name                                 = "Verdana";
                appearance1.FontData.SizeInPoints                         = 8F;
                appearance1.ForeColor                                     = System.Drawing.SystemColors.WindowText;
                appearance1.TextHAlign                                    = Infragistics.Win.HAlign.Left;
                this.grdSchedule.DisplayLayout.Appearance                 = appearance1;
                appearance2.BackColor                                     = System.Drawing.SystemColors.InactiveCaption;
                appearance2.FontData.BoldAsString                         = "True";
                appearance2.FontData.Name                                 = "Verdana";
                appearance2.FontData.SizeInPoints                         = 8F;
                appearance2.ForeColor                                     = System.Drawing.SystemColors.InactiveCaptionText;
                appearance2.TextHAlign                                    = Infragistics.Win.HAlign.Left;
                this.grdSchedule.DisplayLayout.CaptionAppearance          = appearance2;
                this.grdSchedule.DisplayLayout.Override.AllowAddNew       = Infragistics.Win.UltraWinGrid.AllowAddNew.No;
                this.grdSchedule.DisplayLayout.Override.AllowDelete       = Infragistics.Win.DefaultableBoolean.False;
                this.grdSchedule.DisplayLayout.Override.AllowUpdate       = Infragistics.Win.DefaultableBoolean.False;
                this.grdSchedule.DisplayLayout.Override.CellClickAction   = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect;
                appearance3.BackColor                                     = System.Drawing.SystemColors.Control;
                appearance3.FontData.BoldAsString                         = "True";
                appearance3.FontData.Name                                 = "Verdana";
                appearance3.FontData.SizeInPoints                         = 8F;
                appearance3.TextHAlign                                    = Infragistics.Win.HAlign.Left;
                this.grdSchedule.DisplayLayout.Override.HeaderAppearance  = appearance3;
                this.grdSchedule.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortSingle;
                this.grdSchedule.DisplayLayout.Override.MaxSelectedRows   = 1;
                appearance4.BorderColor                                   = System.Drawing.SystemColors.ControlLight;
                this.grdSchedule.DisplayLayout.Override.RowAppearance     = appearance4;
                this.grdSchedule.DisplayLayout.Override.RowSelectors      = Infragistics.Win.DefaultableBoolean.False;
                this.grdSchedule.DisplayLayout.Override.SelectTypeRow     = Infragistics.Win.UltraWinGrid.SelectType.Single;
                this.grdSchedule.DisplayLayout.ScrollBounds               = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
                this.grdSchedule.DisplayLayout.ScrollStyle                = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
                this.grdSchedule.DisplayLayout.TabNavigation              = Infragistics.Win.UltraWinGrid.TabNavigation.NextControl;
                this.grdSchedule.DisplayLayout.ViewStyle                  = Infragistics.Win.UltraWinGrid.ViewStyle.SingleBand;
                this.grdSchedule.Dock                                     = System.Windows.Forms.DockStyle.Fill;
                this.grdSchedule.Location                                 = new System.Drawing.Point(0, 0);
                this.grdSchedule.Name                                     = "grdSchedule";
                this.grdSchedule.Size                                     = new System.Drawing.Size(448, 269);
                this.grdSchedule.SupportThemes                            = false;
                this.grdSchedule.TabIndex                                 = 1;
                this.grdSchedule.Text                                     = "Schedule";
                this.grdSchedule.DragDrop                                += new System.Windows.Forms.DragEventHandler(this.OnDragDrop);
                this.grdSchedule.QueryContinueDrag                       += new System.Windows.Forms.QueryContinueDragEventHandler(this.OnQueryContinueDrag);
                this.grdSchedule.DragOver                                += new System.Windows.Forms.DragEventHandler(this.OnDragOver);
                this.grdSchedule.MouseMove                               += new System.Windows.Forms.MouseEventHandler(this.OnDragDropMouseMove);
                this.grdSchedule.DoubleClick                             += new System.EventHandler(this.OnGridDoubleClicked);
                this.grdSchedule.DragLeave                               += new System.EventHandler(this.OnDragLeave);
                this.grdSchedule.DragEnter                               += new System.Windows.Forms.DragEventHandler(this.OnDragEnter);
                this.grdSchedule.AfterSelectChange                       += new Infragistics.Win.UltraWinGrid.AfterSelectChangeEventHandler(this.OnGridSelectionChanged);
                this.grdSchedule.MouseDown                               += new System.Windows.Forms.MouseEventHandler(this.OnGridMouseDown);
                this.grdSchedule.SelectionDrag                           += new System.ComponentModel.CancelEventHandler(this.OnSelectionDrag);
                this.grdSchedule.MouseUp                                 += new System.Windows.Forms.MouseEventHandler(this.OnDragDropMouseUp);
                this.Controls.Add(this.grdSchedule);
                ((System.ComponentModel.ISupportInitialize)(this.grdSchedule)).EndInit();
                this.ResumeLayout(false);
                #endregion
                ((System.ComponentModel.ISupportInitialize)(this.grdSchedule)).BeginInit();
                this.grdSchedule.DataMember = this.mSchedule.ScheduleTableName;
                this.grdSchedule.DataSource = this.mSchedule.Schedule;
                UltraGridBand band = new UltraGridBand(this.mSchedule.ScheduleTableName, -1);
                object[]      o    = new object[this.mViews.ActiveView.Count];
                int           i    = 0;
                foreach (LayoutEntry entry in this.mViews.ActiveView)
                {
                    //Layout grid columns
                    UltraGridColumn col   = null;
                    HAlign          align = HAlign.Default;
                    switch (entry.Alignment)
                    {
                    case "L": align = HAlign.Left; break;

                    case "C": align = HAlign.Center; break;

                    case "R": align = HAlign.Right; break;
                    }
                    SortIndicator sortDir = SortIndicator.None;
                    if (entry.Sort != "")
                    {
                        sortDir = (entry.Sort == "A") ? SortIndicator.Ascending : SortIndicator.Descending;
                    }

                    col = (entry.GroupBy || sortDir != SortIndicator.None) ? new UltraGridColumn(entry.Key, -1, null, entry.SortOrder, sortDir, entry.GroupBy) : new UltraGridColumn(entry.Key);
                    col.Header.VisiblePosition = entry.VisiblePosition;
                    col.Hidden            = !entry.Visible;
                    col.HiddenWhenGroupBy = entry.Visible ? DefaultableBoolean.False : DefaultableBoolean.True;
                    col.Header.Caption    = entry.Caption;
                    col.Width             = entry.Width;
                    if (entry.Format != "")
                    {
                        col.Format = entry.Format;
                    }
                    Infragistics.Win.Appearance a = new Infragistics.Win.Appearance();
                    a.TextHAlign          = align;
                    col.Header.Appearance = col.CellAppearance = a;
                    col.NullText          = entry.NullText;
                    o[i++] = col;
                }
                band.Columns.AddRange(o);
                this.grdSchedule.AllowDrop = true;
                this.grdSchedule.DisplayLayout.Override.SelectTypeRow   = SelectType.ExtendedAutoDrag;
                this.grdSchedule.DisplayLayout.Override.MaxSelectedRows = -1;
                this.grdSchedule.DisplayLayout.BandsSerializer.Add(band);
                this.grdSchedule.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.SortMulti;
                this.grdSchedule.DisplayLayout.ViewStyle     = ViewStyle.SingleBand;
                this.grdSchedule.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
                this.grdSchedule.Text = this.mSchedule.ScheduleName;
                ((System.ComponentModel.ISupportInitialize)(this.grdSchedule)).EndInit();

                this.grdSchedule.Size = this.ClientSize;
                //this.grdSchedule.Dock = DockStyle.Fill;
                this.grdSchedule.Refresh();
                this.Refresh();
            }
            catch (Exception ex) { reportError(ex); }
        }