/// <summary> /// Called to delete the alert /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void deleteAlertToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you certain that you want to delete the selected alert(s)?", "Confirm Delete", MessageBoxButtons.YesNo) == DialogResult.No) { return; } // OK get the selected alert(s) and delete them foreach (UltraGridRow selectedRow in alertsGridView.Selected.Rows) { UltraGridCell objectCell = selectedRow.Cells["AlertObject"]; Alert alert = objectCell.Value as Alert; // Delete the alert from the database alert.Delete(); } if (alertsGridView.Selected.Rows.Count == 1) { MessageBox.Show("Alert Deleted", "Alert Deleted"); } else { MessageBox.Show(alertsGridView.Selected.Rows.Count.ToString() + " Alert Deleted", "Alert Deleted"); } this.RefreshView(); }
private void ultraGridPolicyMetrics_MouseClick(object sender, MouseEventArgs e) { if (m_allowEdit && e.Button == MouseButtons.Left) { Infragistics.Win.UIElement selectedElement = ultraGridPolicyMetrics.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y)); if (selectedElement is Infragistics.Win.CheckIndicatorUIElement) { Infragistics.Win.UltraWinGrid.UltraGridRow row = selectedElement.SelectableItem as Infragistics.Win.UltraWinGrid.UltraGridRow; if (row != null && row.Cells != null) { // SQLsecure 3.1 (Anshul Aggarwal) - Type of control decides editable columns in the grid. if (m_ControlType == ConfigurePolicyControlType.ImportExportSecurityCheck) { UltraGridCell cell = selectedElement.GetContext(typeof(UltraGridCell)) as UltraGridCell; if (cell != null && (cell.Column.Key == Utility.Constants.POLICY_METRIC_VALUE_IS_SELECTED)) { cell.Value = !((bool)cell.Value); UpdateEnabledCount(); } } else { Infragistics.Win.UltraWinGrid.UltraGridCell cell = row.Cells[Utility.Constants.POLICY_METRIC_COLUMN_IS_ENABLED]; if (cell != null && cell.Value is bool) { cell.Value = !(bool)cell.Value; UpdateEnabledCount(); } } } } } }
private void gridViewWaste_BeforeEnterEditMode(object sender, CancelEventArgs e) { // Use the BeforeEnterEditMode event to position the edit controls UltraGridCell objCell = this.gridViewWaste.ActiveCell; // This should be impossible, but its good practice to check // to make sure there is an active cell before continuing if (objCell == null) { return; } // Get the UIElement associated with the active cell, which we will // need so we can get the size and location of the cell if (objCell.IsDataCell) { CellUIElement objCellUIElement = (CellUIElement)objCell.GetUIElement(this.gridViewWaste.ActiveRowScrollRegion, this.gridViewWaste.ActiveColScrollRegion); if (objCellUIElement == null) { return; } // Get the size and location of the cell int left = objCellUIElement.RectInsideBorders.Location.X + this.gridViewWaste.Location.X; int top = objCellUIElement.RectInsideBorders.Location.Y + this.gridViewWaste.Location.Y; int width = objCellUIElement.RectInsideBorders.Width; int height = objCellUIElement.RectInsideBorders.Height; // The edit control we will use depends on which column we are editing // The values of the identity fields are not very useful to the end user. // Let's display the name in these columns instead, // using the intrisic ComboBox control if (objCell.Column.Key == "FoodTypeID") { /* * // Set the combobox's size and location equal to the active cell's size and location * this.cboFoodName.SetBounds(left, top, width, height); * // Using the cell's value, select the appropriate item in the combobox * this.cboFoodName.SelectedValue = objCell.Value; * // Show the combobox control over the cell, and give it focus * cboFoodName.Visible = true; * cboFoodName.Focus(); * cboFoodName.BringToFront(); * * // Set the Cancel parameter to true so we don't actually go into edit mode * //e.Cancel = true; */ } else if (objCell.Column.Key == "Timestamp") { // Set the date picker's size and location equal to the active cell's size and location this.dtpStamp.SetBounds(left, top, dtpStamp.Width, dtpStamp.Height); // Set the value DateTime temp = DateTime.Parse(objCell.Value.ToString()); this.dtpStamp.Value = temp; this.dtpStamp.Visible = true; this.dtpStamp.Focus(); this.dtpStamp.BringToFront(); // Set the Cancel parameter to true so we don't actually go into edit mode //e.Cancel = true; } } }
protected override void processRightClick(UltraGridCell cellClicked_) { if (Grid.Selected.Rows.Count > 1) { //foreach(var item in contextMenuStrip1.Items) // if (item is IDisposable) // ((IDisposable) item).Dispose(); contextMenuStrip1.Items.Clear(); var bonds = Grid.Selected.Rows.All.Where(x => x is UltraGridRow) .Select(x => ((UltraGridRow) x).ListObject as BondAnalysisLine); if (bonds.Count() > 1) contextMenuStrip1.Items.Add( new GenericContextMenuItem<IEnumerable<BondAnalysisLine>>("Create structure in QuickLook", bonds, (x) => { OnQuickLookPlease(new ApplyQuickLookArgs(x.OrderBy(v => v.Maturity).ToArray())); })); if (contextMenuStrip1.Items.Count > 0) contextMenuStrip1.Show(Cursor.Position); } else { fireFromCell(cellClicked_, System.Windows.Forms.MouseButtons.Right); } }
/// <summary> /// Called as each row in the grid is initialized - we use this to set the appearance of the row /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void applicationsGridView_InitializeRow(object sender, InitializeRowEventArgs e) { // Get the application object being displayed UltraGridRow thisRow = e.Row; UltraGridCell objectCell = thisRow.Cells[0]; InstalledApplication thisApplication = objectCell.Value as InstalledApplication; // Set the appearance and icon based on the compliancy status if (thisApplication.IsIgnored) { thisRow.Appearance = _ignoredAppearance; } else if (thisApplication.Licenses.Count == 0) { thisRow.Appearance = _notSpecifiedAppearance; } else if (thisApplication.IsCompliant()) { thisRow.Appearance = _compliantAppearance; } else { thisRow.Appearance = _noncompliantAppearance; } // Set the 'application' image to either be a NotIgnore or non-NotIgnore application //UltraGridCell applicationCell = thisRow.Cells["Application Name"]; //if (thisApplication.IsIgnored) // applicationCell.Appearance.Image = Properties.Resources.application_hidden_16; //else // applicationCell.Appearance.Image = Properties.Resources.application_16; }
private void InitializeChunksGridGrouping() { int i = 0; groupCount = 0; while (i < dgChunks.Rows.Count) { string containerGroup = dgChunks.Rows[i].Cells.FromKey("Path").Value.ToString(); if (i == 0 || currentGroup != containerGroup) { currentGroup = containerGroup; dgChunks.Rows.Insert(i, new UltraGridRow()); UltraGridRow groupRow = dgChunks.Rows[i]; UltraGridCell groupCellMax = groupRow.Cells[dgChunks.Columns.Count - 1]; // initialize all cells for this row foreach (UltraGridCell cell in groupRow.Cells) { cell.Style.CssClass = string.Empty; } dgChunks.Rows[i].Style.CssClass = "ptbgroup"; UltraGridCell groupCell = groupRow.Cells.FromKey("Mandatory"); groupCell.Text = containerGroup; groupCell.ColSpan = 5; i++; } i++; } }
private void _grid_MouseDown(object sender, MouseEventArgs e) { // Note: this event handler is used for the MouseDown event on all grids//if (items.Count == 1) UltraGrid grid = (UltraGrid)sender; UIElement elementMain = grid.DisplayLayout.UIElement; var elementUnderMouse = elementMain.ElementFromPoint(new Point(e.X, e.Y)); if (elementUnderMouse != null) { UltraGridCell cell = elementUnderMouse.GetContext(typeof(UltraGridCell)) as UltraGridCell; if (cell == null) { m_gridCellClicked = false; HeaderUIElement he = elementUnderMouse.GetAncestor(typeof(HeaderUIElement)) as HeaderUIElement; ColScrollbarUIElement ce = elementUnderMouse.GetAncestor(typeof(ColScrollbarUIElement)) as ColScrollbarUIElement; RowScrollbarUIElement re = elementUnderMouse.GetAncestor(typeof(RowScrollbarUIElement)) as RowScrollbarUIElement; if (he == null && ce == null && re == null) { grid.Selected.Rows.Clear(); grid.ActiveRow = null; } } } }
/// <summary> /// mouse Right-click menu /// </summary> /// <param name="e"></param> protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); // 현재 클릭한 GridItem 가져오기 UIElement element = this.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y)); object gridItem = element.GetContext(); if (e.Button == MouseButtons.Right) { // 만약 현재 클릭한 GridItem이 UltraGridCell인 경우 if (gridItem is UltraGridColumn) { UltraGridCell activeCell = (UltraGridCell)element.GetContext(typeof(UltraGridCell)); this.ActiveRow = null; this.ActiveCell = null; activeCell.Activate(); } // 1. 컨텍스트 메뉴 구성(생성) ContextMenuStrip strip = this.CreateContextMenu(element); // 2. 컨텍스트 메뉴 사용 가능/불가능 처리 this.AdjustContextMenuItems(strip, element); strip.Show(this, new Point(e.X, e.Y)); } }
public ComboBoxPopupForm(UltraGridCell cell) { InitializeComponent(); this.Text = cell.Column.Header.Caption; this.selectedCell = cell; this.immasGrid1.DoubleClickCell += ImmasGrid1_CellDoubleClick; }
private UltraGridCell mFindCellByRowAndColumnInfo(UltraGridRow objRow, Mars_RowColumnInfo oColInfo) { Logger.logBegin("mFindCellByRowAndColumnInfo"); try { if (objRow == null) { Logger.Error("mFindCellByRowAndColumnInfo", "Row is null"); return(null); } switch (oColInfo.CurrentDataType) { case E_RowColumnType.eType_Number: int iCurrentColId = 0; for (int i = 0; i < objRow.Cells.Count; i++) { UltraGridCell objCurrentCell = objRow.Cells[i]; if (objCurrentCell.Column.Hidden) { continue; } if (iCurrentColId == oColInfo.convertData2Int()) { Logger.Info("mFindCellByRowAndColumnInfo", "find cell"); return(objCurrentCell); } iCurrentColId++; } break; case E_RowColumnType.eType_String: string strColumnName = "", strColumnInnderName = ""; for (int i = 0; i < objRow.Cells.Count; i++) { UltraGridCell objCurrentCell = objRow.Cells[i]; if (objCurrentCell.Column.Hidden) { continue; } strColumnName = objCurrentCell.Column.Header.Caption; strColumnInnderName = objCurrentCell.Column.Key; if ((string.Compare(strColumnName, oColInfo.currentData.ToString(), true) == 0) || ((string.Compare(strColumnInnderName, oColInfo.currentData.ToString(), true) == 0))) { Logger.Info("mFindCellByRowAndColumnInfo", "find cell"); return(objCurrentCell); } } break; } return(null); } finally { Logger.logEnd("mFindCellByRowAndColumnInfo"); } }
protected void UltraWebGrid1_InitializeRow(object sender, RowEventArgs e) { UltraGridCell objCell = e.Row.Cells.FromKey("EST_POINT"); if (objCell.Value == null) { objCell.Value = "-"; } }
protected void uwgCodigBarras_InitializeRow(object sender, RowEventArgs e) { int codDesde = Convert.ToInt32(e.Row.Cells[10].Text); int codHasta = Convert.ToInt32(e.Row.Cells[11].Text); UltraGridCell ugc = new UltraGridCell(); ugc.Text = (codHasta - codDesde + 1).ToString(); e.Row.Cells.Add(ugc); }
/// <summary> /// Báo lỗi /// </summary> /// <param name="cell"></param> /// <param name="tooltip"></param> private static void HighlightGridCellSet(UltraGridCell cell, string tooltip) { if (!string.IsNullOrEmpty(tooltip)) { cell.Appearance.BackColor = Color.FromArgb(255, 160, 154); cell.Appearance.ForeColor = Color.White; cell.ToolTipText = tooltip; } }
protected void uwgrid_TGT_EMP_LIST_InitializeRow(object sender, RowEventArgs e) { //평가상태 아이콘 UltraGridCell status_Cell = e.Row.Cells.FromKey("EST_STATUS"); string EST_STATUS = status_Cell.Value.ToString(); string redIcon = "../images/icon/color/red.gif"; string greenIcon = "../images/icon/color/green.gif"; string blueIcon = "../images/icon/color/blue.gif"; string imgURL = "<img src=\"{0}\" />"; if (EST_STATUS.Equals("N")) { status_Cell.Value = string.Format(imgURL, redIcon); } else if (EST_STATUS.Equals("P")) { status_Cell.Value = string.Format(imgURL, greenIcon); } else { status_Cell.Value = string.Format(imgURL, blueIcon); } if (!EST_STATUS.Equals("E")) { UltraGridCell btn_Cell = e.Row.Cells.FromKey("EST_BTN"); string btnText; btnText = "평가하기"; /* * if (EST_STATUS.Equals("N")) * { * btnText = "평가하기"; * } * else if (EST_STATUS.Equals("P")) * { * btnText = "확정하기"; * } * else * { * btnText = "확정취소"; * } */ string TGT_DEPT_ID = e.Row.Cells.FromKey("TGT_DEPT_ID").Value.ToString(); string TGT_EMP_ID = e.Row.Cells.FromKey("TGT_EMP_ID").Value.ToString(); string jsLink = string.Format("javascript:TGT_EMP_EST_POPUP('{0}', '{1}');", TGT_DEPT_ID, TGT_EMP_ID); btn_Cell.Value = string.Format("<a href=\"{0}\" >{1}</a>", jsLink, btnText); } }
protected override void Grid_ClickCell(UltraGridCell cell) { base.Grid_ClickCell(cell); if (this.gridHelper.IsClickEditColumn(cell)) { Session["ss_action"] = PageActionType.Update; Session["ss_alertlevel"] = this.drpAlertLevel.SelectedValue; Response.Redirect(this.MakeRedirectUrl("FManualAlertEP.aspx", new string[] { "action", "alertid" }, new string[] { "edit", cell.Row.Cells[1].Value.ToString() })); } }
private void AddChunkCell(UltraGridRow ur, string containerTypeCode, string chunkValue, int colspan) { UltraGridCell cellChunk = new UltraGridCell(); cellChunk.Text = chunkValue; cellChunk.Style.Wrap = true; if (containerTypeCode == "P" && cellChunk.Text != string.Empty) { // Photo XmlDocument xmlInfo = new XmlDocument(); string imgPath = HCPage.WSDam.ResourceGetByPath(cellChunk.Text); if (imgPath != string.Empty) { try { xmlInfo.LoadXml(imgPath); System.Xml.XmlNode node = xmlInfo.DocumentElement; System.Xml.XmlNode fileNode = node.FirstChild; string fullPath = node.Attributes["uri"].InnerText; cellChunk.Text = "<img src='" + fullPath + "?thumbnail=1&size=40' title='" + cellChunk.Text + "' border=0/>"; } catch (Exception ex) { cellChunk.Text = "<img src='/hc_v4/img/ed_notfound.gif' title='An exception occurred: " + ex.Message + "' border=0/>"; Trace.Warn("DAM", "Exception processing DAM: " + ex.Message); } } else { cellChunk.Text = "<img src='/hc_v4/img/ed_notfound.gif' title='not found' border=0/>"; } } else { if (cellChunk.Text == Chunk.BlankValue) { cellChunk.Text = Chunk.BlankText; } else { cellChunk.Text = UITools.HtmlEncode(cellChunk.Text); } } cellChunk.Style.HorizontalAlign = HorizontalAlign.Center; cellChunk.Style.BorderWidth = Unit.Pixel(1); cellChunk.Style.BorderStyle = BorderStyle.Inset; cellChunk.Style.BorderDetails.WidthTop = Unit.Pixel(0); cellChunk.Style.BorderDetails.WidthBottom = Unit.Pixel(0); if (colspan > 1) { cellChunk.ColSpan = colspan; } ur.Cells.Add(cellChunk); }
private void OnGridMouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { //Event handler for mouse down event try { //Check drag\drop OnDragDropMouseDown(sender, e); //Set menu and toolbar services UltraGrid oGrid = (UltraGrid)sender; UIElement oUIElement = oGrid.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y)); object oContext = null; if (e.Button == MouseButtons.Right) { oContext = oUIElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridCell)); if (oContext != null) { //On row UltraGridCell oCell = (UltraGridCell)oContext; oGrid.ActiveRow = oCell.Row; oGrid.ActiveRow.Selected = true; } else { //Off row oContext = oUIElement.GetContext(typeof(RowScrollRegion)); if (oContext != null) { oGrid.ActiveRow = null; if (oGrid.Selected.Rows.Count > 0) { oGrid.Selected.Rows[0].Selected = false; } } } oGrid.Focus(); } else if (e.Button == MouseButtons.Left) { //Remove selected item if scrolling oContext = oUIElement.GetContext(typeof(RowScrollRegion)); if (oContext != null) { oGrid.ActiveRow = null; if (oGrid.Selected.Rows.Count > 0) { oGrid.Selected.Rows[0].Selected = false; } } } } catch (Exception) { } finally { setUserServices(); } }
private int GetCellInt(UltraGridCell cell) { if (cell.Text == null || cell.Text.Trim().Length <= 0) { return(0); } int returnValue = 0; int.TryParse(cell.Text, out returnValue); return(returnValue); }
private void dgvArticulos_KeyPress(object sender, KeyPressEventArgs e) { try { UltraGrid grid = sender as UltraGrid; UltraGridCell activeCell = grid == null ? null : grid.ActiveCell; // if there is an active cell, its not in edit mode and can enter edit mode if (null != activeCell && false == activeCell.IsInEditMode && activeCell.CanEnterEditMode) { // if the character is not a control character if (char.IsControl(e.KeyChar) == false) { // try to put cell into edit mode grid.PerformAction(UltraGridAction.EnterEditMode); // if this cell is still active and it is in edit mode... if (grid.ActiveCell == activeCell && activeCell.IsInEditMode) { // get its editor EmbeddableEditorBase editor = activeCell.EditorResolved; // if the editor supports selectable text if (editor.SupportsSelectableText) { // select all the text so it can be replaced editor.SelectionStart = 0; editor.SelectionLength = editor.TextLength; if (editor is EditorWithMask) { // just clear the selected text and let the grid // forward the keypress to the editor editor.SelectedText = string.Empty; } else { // then replace the selected text with the character editor.SelectedText = new string(e.KeyChar, 1); // mark the event as handled so the grid doesn't process it e.Handled = true; } } } } } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void ultraGrid1_BeforeExitEditMode(object sender, BeforeExitEditModeEventArgs e) { /// Validation for PeriodStartDate (Date picker) UltraGridCell objCell = this.ultraGrid1.ActiveCell; if (objCell == null) { return; } // Get the UIElement associated with the active cell, which we will // need so we can get the size and location of the cell if (objCell.IsDataCell && objCell.Column.Key == "PeriodStartDate" && objCell.Text.ToString()[0] != '_') { // Make sure date is not in the future //if (Regex.IsMatch(objCell.Text.ToString(), @"\d+\/\d+\/\d+")) //{ DateTime newDate = DateTime.Parse(objCell.Text); if (objCell.Value.ToString() != "") { DateTime oldDate = DateTime.Parse(objCell.Value.ToString()); if (oldDate.Month == newDate.Month && oldDate.Year == oldDate.Year) { return; } } if (newDate > DateTime.Now) { MessageBox.Show("Future data is not allowed!", "Data Entry Error"); objCell.Selected = true; e.Cancel = true; return; } // Not in the future - now // Correct entered date to be first day of the month newDate = DateTime.Parse(newDate.ToString("yyyy/MM/" + "01 00:00:00")); DateTime firstdayofnextmonth = newDate.AddMonths(1); // Make sure that the month being entered does not already exist string sql = "SELECT * FROM Financials WHERE (PeriodStartDate >= #" + newDate.ToString("yyyy/MM/") + "01 00:00:00#) AND (PeriodStartDate < #" + firstdayofnextmonth.ToString("yyyy/MM/") + "01 00:00:00#) AND SiteID = " + VWA4Common.GlobalSettings.CurrentSiteID; DataTable dt_result = VWA4Common.DB.Retrieve(sql); if (dt_result.Rows.Count > 0) { // duplicate MessageBox.Show("Financial data already exists for specified month!", "Data Entry Error"); e.Cancel = true; return; } // We have passed the tests - update cell with new value ultraGrid1.ActiveCell.Value = newDate; //} } }
private void frmContent_Shown(object sender, EventArgs e) { // Autosize grid columns. this.ultraGrid1.DisplayLayout.PerformAutoResizeColumns(false, PerformAutoSizeType.VisibleRows, AutoResizeColumnWidthOptions.All); if (this.ultraGrid1.Rows.Count > 0) { // Activate the first row. this.ultraGrid1.Rows[0].Activate(); if (this.ultraGrid1.ActiveRow != null) { if (!this.ultraGrid1.ActiveRow.IsGroupByRow) { // If not a group by row then activate the first cell. UltraGridCell cell = this.ultraGrid1.ActiveRow.Cells[this.ultraGrid1.DisplayLayout.Bands[0].GetFirstVisibleCol(this.ultraGrid1.DisplayLayout.ColScrollRegions[0], false)]; if (cell != null) { cell.Activate(); if (this.contentType == Enums.ContentType.Customers) { // If this is the Customers ContentType then we actually want the next cell active. this.ultraGrid1.PerformAction(UltraGridAction.NextCell); } } } else { // If this is a group by row then expand all the rows. this.ultraGrid1.Rows.ExpandAll(false); if (this.contentType == Enums.ContentType.OrderDetails) { // Activate the first row under the first expanded group by row. this.ultraGrid1.Rows[0].ChildBands[0].Rows[0].Activate(); UltraGridCell cell = this.ultraGrid1.ActiveRow.Cells[this.ultraGrid1.DisplayLayout.Bands[0].GetFirstVisibleCol(this.ultraGrid1.DisplayLayout.ColScrollRegions[0], false)]; if (cell != null) { // Activate the first cell. cell.Activate(); } } } } } // Give the charts sample data this.AssignChartData(); // The pie chart has the ability to break apart specific slices to draw attention to that slice. // this.ultraChart2.PieChart.BreakSlice(1, true); // this.piecha.PieChart.BreakSlice(1, true); }
/// <summary> /// Called to display the full details of this action /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void viewDetailsToolStripMenuItem_Click(object sender, EventArgs e) { // Have we right-clicked on an item if (alertsGridView.Selected.Rows.Count != 1) { return; } UltraGridRow selectedRow = alertsGridView.Selected.Rows[0]; UltraGridCell objectCell = selectedRow.Cells["AlertObject"]; Alert alert = objectCell.Value as Alert; ViewDetails(alert); }
private void ultraGrid1_BeforeExitEditMode(object sender, Infragistics.Win.UltraWinGrid.BeforeExitEditModeEventArgs e) { UltraGridCell activeCell = ((UltraGrid)sender).ActiveCell; if (activeCell == null) { return; } if (activeCell.IsDataCell && activeCell.Column.Key == "FoodCostDiscount") { decimal value = cellValue(activeCell.Text); activeCell.Value = value / 100m; } }
protected override void Grid_ClickCell(UltraGridCell cell) { base.Grid_ClickCell(cell); if (cell.Column.Key == "HandleLog") { SaveQuery(); Response.Redirect(this.MakeRedirectUrl("FHandleLogQP.aspx", new string[] { "alertid" }, new string[] { cell.Row.Cells[1].Value.ToString() })); } if (this.gridHelper.IsClickEditColumn(cell)) { SaveQuery(); Response.Redirect(this.MakeRedirectUrl("FAlertEP.aspx", new string[] { "alertid" }, new string[] { cell.Row.Cells[1].Value.ToString() })); } }
private void ultraGrid1_BeforeEnterEditMode(object sender, CancelEventArgs e) { // Use the BeforeEnterEditMode event to position the edit controls UltraGridCell objCell = this.ultraGrid1.ActiveCell; // This should be impossible, but its good practice to check // to make sure there is an active cell before continuing if (objCell == null) { return; } // Get the UIElement associated with the active cell, which we will // need so we can get the size and location of the cell if (objCell.IsDataCell) { CellUIElement objCellUIElement = (CellUIElement)objCell.GetUIElement(this.ultraGrid1.ActiveRowScrollRegion, this.ultraGrid1.ActiveColScrollRegion); if (objCellUIElement == null) { return; } // Get the size and location of the cell int left = objCellUIElement.RectInsideBorders.Location.X + this.ultraGrid1.Location.X; int top = objCellUIElement.RectInsideBorders.Location.Y + this.ultraGrid1.Location.Y; int width = objCellUIElement.RectInsideBorders.Width; int height = objCellUIElement.RectInsideBorders.Height; // The edit control we will use depends on which column we are editing // The values of the identity fields are not very useful to the end user. // Let's display the name in these columns instead, // using the intrisic ComboBox control if (Regex.IsMatch(objCell.Column.Key, "TypeID")) { // Set the date picker's size and location equal to the active cell's size and location this.ucTreeView1.SetBounds(left, top, ucTreeView1.Width, ucTreeView1.Height); // Set the value this.ucTreeView1.InitTreeView(VWA4Common.GlobalSettings.CurrentTypeCatalogID.ToString(), Regex.Replace(objCell.Column.Key, "TypeID", ""), objCell.Value.ToString()); } else if (objCell.Column.Key == "FoodCostDiscount") { decimal value = cellValue(objCell.Value.ToString()); if (value != 0) { objCell.Value = value * 100m; } } } }
/// <summary> /// SQLsecure 3.1 (Anshul Aggarwal) - Checks if current configuration is valid or not. /// </summary> public bool OKToSave() { UltraGridRow row = ultraGridPolicyMetrics.ActiveRow; if (row != null && row.IsDataRow) { UltraGridCell cell = row.Cells[Utility.Constants.POLICY_METRIC_COLUMN_IS_ENABLED]; var policyMetric = row.ListObject as PolicyMetric; if (policyMetric != null && cell != null && cell.Value is bool && (bool)cell.Value == true) { if (row.IsDataRow && policyMetric != null) { bool okOnPremise = false; bool okADB = false; if (policyMetric.ApplicableOnPremise) { okOnPremise = sqlServerCriteriaControl.OKToSave(); } // SQLsecure 3.1 (Anshul Aggarwal) - Even if a single tab is valid, we will accept it. if (!policyMetric.ApplicableOnPremise || (policyMetric.ApplicableOnAzureDB && !okOnPremise)) { okADB = azureSQLDatabaseCriteriaControl.OKToSave(); } bool ok = (policyMetric.ApplicableOnPremise && okOnPremise) || (policyMetric.ApplicableOnAzureDB && okADB); if (!ok) { // SQLsecure 3.1 (Anshul Aggarwal) - Switch to the tab that is invalid. if (policyMetric.ApplicableOnPremise && !okOnPremise) { ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0]; } else if (policyMetric.ApplicableOnAzureDB && !okADB) { ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[1]; } MsgBox.ShowError("Security Checks", "This security check requires at least one criteria be specified.\n\nEither specify a criteria or disable this security check."); } return(ok); } } } return(true); }
private void InitializeGridGrouping() { int begCol = dg.Columns.FromKey("Select").Index; if (dg.Columns.FromKey("Select").ServerOnly) { begCol = dg.Columns.FromKey("Mandatory").Index; } int i = 0; int x = dg.Rows.Count; TemplatedColumn col = (TemplatedColumn)dg.Columns.FromKey("Select"); if (dg.Rows.Count > 0) { groupCount = 0; int colIndex = dg.Rows[i].Cells.FromKey("Path").Column.Index; while (i < dg.Rows.Count) { string containerGroup = dg.Rows[i].Cells[colIndex].Value.ToString(); if (i == 0 || currentGroup != containerGroup) { currentGroup = containerGroup; dg.Rows.Insert(i, new UltraGridRow()); CheckBox c = (CheckBox)((CellItem)col.CellItems[x]).FindControl("g_sd"); c.Visible = false; Label l = (Label)((CellItem)col.CellItems[x]).FindControl("grp_lbl"); l.Visible = true; l.Text = currentGroup; l.CssClass = "ptbgroup"; l.BorderStyle = BorderStyle.None; UltraGridRow groupRow = dg.Rows[i]; UltraGridCell groupCellMax = groupRow.Cells[dg.Columns.Count - 1]; // initialize all cells for this row foreach (UltraGridCell cell in groupRow.Cells) { cell.Style.CssClass = string.Empty; } dg.Rows[i].Style.CssClass = "ptbgroup"; UltraGridCell groupCell = groupRow.Cells[begCol]; groupCell.ColSpan = dg.Columns.Count - 1 - begCol; groupCell.Text = containerGroup; i++; x++; } i++; } } }
private void dtpStamp_Leave(object sender, EventArgs e) { // Use the BeforeEnterEditMode event to position the edit controls UltraGridCell objCell = this.gridViewWaste.ActiveCell; // This should be impossible, but its good practice to check // to make sure there is an active cell before continuing if (objCell == null) { return; } if (objCell.Column.Key == "Timestamp") { objCell.Value = dtpStamp.Value; } }
int IComparer.Compare(object x, object y) { // Passed in objects are cells. So you have to typecast them to UltraGridCell objects first. UltraGridCell xCell = (UltraGridCell)x; UltraGridCell yCell = (UltraGridCell)y; // Do your own comparision between the values of xCell and yCell and return a negative // number if xCell is less than yCell, positive number if xCell is greater than yCell, // and 0 if xCell and yCell are equal. // Following code does an case-insensitive compare of the values converted to string. string text1 = xCell.Text; string text2 = yCell.Text; return(String.Compare(text1, text2, true)); }
public void MarsTigerSetDropListModeValue(object strData) { Logger.logBegin("MarsTigerSetDropListModeValue"); UltraGrid objGrid = (UltraGrid)base.SourceControl; UltraGridCell objCell = objGrid.ActiveCell; string strError = ""; if (objCell == null) { strError = string.Format("No Active cell before change value for droplist:[{0}]", strData); QtpShowException(strError); return; } objCell.SetValue(strData, false); Logger.logEnd("MarsTigerSetDropListModeValue"); }
/// <summary> /// Called as each row in the grid is initialized - we use this to set the appearance of the row /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void alertsGridView_InitializeRow(object sender, InitializeRowEventArgs e) { // Get the object being displayed UltraGridRow thisRow = e.Row; UltraGridCell objectCell = thisRow.Cells[0]; Alert alert = objectCell.Value as Alert; // Set the 'alert' image to either be dismissed or active if (alert.Status == Alert.AlertStatus.active) { thisRow.Cells[1].Appearance.Image = Properties.Resources.Alert_active_16; } else { thisRow.Cells[1].Appearance.Image = Properties.Resources.Alert_dismissed_16; } }
public void UltraWebGrid(UltraWebGrid tmpUltraWebGrid, string condition, string[] captionNames, string[] tableColumns) { //tmpUltraWebGrid.Clear(); //清空 tmpUltraWebGrid.Bands[0].Columns.Clear(); //清空數據列 UltraGridBand band = new UltraGridBand(); band = tmpUltraWebGrid.Bands[0]; //Head行 UltraGridColumn tmpHeadColumn = new UltraGridColumn(); UltraGridCell tmpCell = new UltraGridCell(); band.Columns.Add(tmpHeadColumn); //數據行 UltraGridColumn tmpColumn = new UltraGridColumn(); // tmpColumn.Band. band.Columns.Add(tmpColumn); //動態增加列 }
// Format numeric grid cells public static void FormatNumericDp( UltraGridCell cell, int decimalPlaces) { //Set mask editor for muti cell precision on numbers string strMask = ("nnnnnn" + (decimalPlaces > 0 ? "." : "")); strMask = strMask.PadRight ( (decimalPlaces + strMask.Length), Convert.ToChar("n")); var osSettings = new DefaultEditorOwnerSettings { MaskInput = strMask }; var deOwner = new DefaultEditorOwner(osSettings); var meEditor = new EditorWithMask(deOwner); cell.Editor = meEditor; }
void gridClickCell(object sender, ClickCellEventArgs e) { _currentCell = e.Cell; }
private static void HighlightGridCellClear(UltraGridCell cell) { cell.Appearance.ResetBackColor(); cell.Appearance.ResetForeColor(); cell.ToolTipText = string.Empty; }
public void ugServicios_CellKeyEnter(UltraGridCell Cell) { try { if (Cell == null || ItemOrdenProduccion == null) { return; } ItemOrdenProduccionServicio Item = (ItemOrdenProduccionServicio)Cell.Row.Tag; switch (Cell.Column.Key) { case colServicio: if (Cell.Text.Equals("")) { break; } AgregarServicios("%", Cell.Text, Cell.Row); break; default: break; } } catch (Exception) { //MessageBox.Show(ex.Message); } }
private ContoDTO getConto(UltraGridCell cell) { try { var idConto = 0; if (cell != null && cell.ValueListResolved != null) { if (cell.ValueListResolved.SelectedItemIndex >= 0) idConto = int.Parse(cell.ValueListResolved.GetValue(cell.ValueListResolved.SelectedItemIndex).ToString()); else { if (cell.Value != null) idConto = (int)cell.Value; } } return idConto > 0 && _esercizio != null ? getPianoContiService().GetById(idConto, _esercizio.ID) : null; } catch (Exception ex) { var idMovimento = "<NULL>"; if (_movimentoAvere != null) idMovimento = _movimentoAvere.ID.ToString(); _log.ErrorFormat("Errore nel tentativo di recuperare il conto da una row - {0} - movimento:{1}", ex, Utility.GetMethodDescription(), idMovimento); throw; } }
public CellEditEventArgs(UltraGridCell cell_) { m_cell = cell_; }
protected override void OnPreRender(EventArgs e) { foreach (Row row in _rows) { UltraGridRow ultraRow = new UltraGridRow(); foreach (Cell cell in row.Cells) { UltraGridCell ultraCell = new UltraGridCell(); ultraCell.Value = cell.Value; ultraRow.Cells.Add(ultraCell); } _grid.Rows.Add(ultraRow); } base.OnPreRender(e); }
private PersonaDTO getPersona(UltraGridCell cell) { var idPersona = 0; if (cell.ValueListResolved.SelectedItemIndex >= 0) idPersona = int.Parse(cell.ValueListResolved.GetValue(cell.ValueListResolved.SelectedItemIndex).ToString()); else { if (cell.Value != null) idPersona = (int)cell.Value; } return idPersona > 0 ? getPersonaService().GetById(idPersona) : null; }
private object parseCellValue(UltraGridCell cell) { var valore = cell.Value; if (valore == DBNull.Value) valore = null; return valore; }
private ContoDTO getConto(UltraGridCell cell, bool verbose) { int? idConto = null; if (cell.ValueListResolved.SelectedItemIndex > -1) idConto = int.Parse(cell.ValueListResolved.GetValue(cell.ValueListResolved.SelectedItemIndex).ToString()); else if(cell.Value != null && cell.Value != DBNull.Value) idConto = (int)cell.Value; if (idConto != null) return _pianoContiService.GetById(idConto.Value, _esercizio.ID); if (verbose) CommonMessages.DisplayWarning("Prima di definire il riparto occorre scegliere il conto"); return null; }
public void ugCotizaciones_CellKeyEnter(UltraGridCell Cell) { /* try { ItemPresupuesto Item = (ItemPresupuesto)Cell.Row.Tag; switch (Cell.Column.Key) { case colTotalFinal: Item.TotalFinal = Convert.ToDecimal(Cell.Value); break; case colRecargo: Item.TotalFinal = Convert.ToDecimal(Cell.Value) + Item.Total; break; default: break; } MostrarItems(false); } catch (Exception ex) { SoftException.Control(ex); }*/ }
private void handleGridMouseMove(object sender, EventArgs e) { try { var adjustedPoint = Grid.PointToClient(Cursor.Position); var dataCell = getCurrentCell(adjustedPoint); if (dataCell == null || dataCell.Column.DataType != typeof(double) ) { toolTip1.SetToolTip(Grid, null); return; } if (dataCell != null && object.ReferenceEquals(m_lastCell, dataCell)) return; var firstCell = dataCell.Row.Cells[0].Value.ToString(); var colName = dataCell.Column.Key; if (string.IsNullOrEmpty(firstCell) || string.IsNullOrEmpty(colName)) { toolTip1.SetToolTip(Grid, null); return; } var val = (double)dataCell.Value; var ccy1Obj = Singleton<FXIDs>.Instance[firstCell]; var ccy2Obj = Singleton<FXIDs>.Instance[colName]; if (ccy1Obj != null && ccy2Obj != null) { toolTip1.SetToolTip(Grid, string.Format("{0}/{1} {2}", firstCell, colName, val > 0d ? "Long" : (val < 0d) ? "Short" : "Flat")); } else if(ccy1Obj!=null) { toolTip1.SetToolTip(Grid, string.Format("{0} {1} : {2}", ccy1Obj.Code, colName, colName.Equals("Weight") ? val.ToString("##0.0#%") : val.ToString())); } else if (ccy2Obj != null) { toolTip1.SetToolTip(Grid, string.Format("{0} {1} : {2}", ccy2Obj.Code, firstCell, val.ToString())); } else { toolTip1.SetToolTip(Grid, null); } m_lastCell = dataCell; } catch { toolTip1.SetToolTip(Grid, null); } }
public OTRCellClickedEventArgs(UltraGridCell cell_) { Cell = cell_; }
private void handleGridMouseMove(object sender, EventArgs e) { try { var adjustedPoint = Grid.PointToClient(Cursor.Position); var dataCell = getCurrentCell(adjustedPoint); if (dataCell == null) { toolTip1.SetToolTip(Grid, null); return; } if (dataCell != null && object.ReferenceEquals(m_lastCell, dataCell)) return; var firstCell = dataCell.Row.Cells[0].Text; var colName = dataCell.Column.Header.Caption; var groupName = dataCell.Column.Group.Header.Caption; var cellText = dataCell.Text; if (string.Compare(cellText, firstCell) == 0) { toolTip1.SetToolTip(Grid, null); return; } toolTip1.SetToolTip(Grid, string.Format("{0} : {1} {2} : {3}", firstCell, groupName, colName, cellText)); m_lastCell = dataCell; } catch { } }
protected override void processRightClick(UltraGridCell cellClicked_) { fireFromCell(cellClicked_, System.Windows.Forms.MouseButtons.Right); }
private bool isLastChar(UltraGridCell cell) { try { return cell.SelStart == cell.Text.Length; } catch (NotSupportedException) { return true; } catch (Exception ex) { _log.Error("Errore durante la navigazione con le frecce nella grid: " + Utility.GetMethodDescription() + " - cell:" + cell.Column.Key, ex); return false; } }
private void calcolaImportiRiga(UltraGridCell cell) { try { if (cell.Row.Cells["AliquotaIva"].Value != null) { decimal aliquotaIva = Convert.ToDecimal(Decodifica.Instance.GetElement("CodiceIva", cell.Row.Cells["AliquotaIva"].Value.ToString()).ValoreNumerico); if ((cell.Row.Cells["ImportoLordo"].Value != null && cell.Row.Cells["Imponibile"].Value == null) || (cell.Row.Cells["ImportoLordo"].Value != null && cell.Row.Cells["Imponibile"].Value != null && cell.Column.Key == "ImportoLordo")) { // Scorporo dell'iva var importoTotale = (decimal)cell.Row.Cells["ImportoLordo"].Value; if (cell.Row.Index == 0) importoTotale -= altreSpeseDettaglio.Value; cell.Row.Cells["ImportoIva"].Value = importoTotale - Math.Round(importoTotale / (1 + aliquotaIva), 3, MidpointRounding.ToEven); cell.Row.Cells["Imponibile"].Value = importoTotale - (decimal)cell.Row.Cells["ImportoIva"].Value; } else if ((cell.Row.Cells["ImportoLordo"].Value == null && cell.Row.Cells["Imponibile"].Value != null) || (cell.Row.Cells["ImportoLordo"].Value != null && cell.Row.Cells["Imponibile"].Value != null && cell.Column.Key == "Imponibile")) { // Calcolo dell'iva var imponibile = (decimal)cell.Row.Cells["Imponibile"].Value; cell.Row.Cells["ImportoIva"].Value = Math.Round(imponibile * aliquotaIva, 3, MidpointRounding.ToEven); cell.Row.Cells["ImportoLordo"].Value = imponibile + (decimal)cell.Row.Cells["ImportoIva"].Value; if (cell.Row.Index == 0) cell.Row.Cells["ImportoLordo"].Value = (decimal)cell.Row.Cells["ImportoLordo"].Value + altreSpeseDettaglio.Value; } else if (cell.Row.Cells["ImportoIva"].Value == null && cell.Row.Cells["Imponibile"].Value != null) { // Calcolo dell'iva var imponibile = (decimal)cell.Row.Cells["Imponibile"].Value; cell.Row.Cells["ImportoIva"].Value = Math.Round(imponibile * aliquotaIva, 3, MidpointRounding.ToEven); cell.Row.Cells["ImportoLordo"].Value = imponibile + (decimal)cell.Row.Cells["ImportoIva"].Value; if (cell.Row.Index == 0) cell.Row.Cells["ImportoLordo"].Value = (decimal)cell.Row.Cells["ImportoLordo"].Value + altreSpeseDettaglio.Value; } if (sceltaFornitore.SelectedFornitore != null && sceltaFornitore.SelectedFornitore.AliquotaCassaProfessionisti > 0 && cell.Row.Cells["Imponibile"].Value != null) cassaProfessionistiDettaglio.Value = (decimal)cell.Row.Cells["Imponibile"].Value - Math.Round((decimal)cell.Row.Cells["Imponibile"].Value / (1 + sceltaFornitore.SelectedFornitore.AliquotaCassaProfessionisti), 3, MidpointRounding.ToEven); } } catch (Exception ex) { _log.ErrorFormat("Errore nel calcolo degli importi per riga - {0} - azienda:{1}", ex, Utility.GetMethodDescription(), Security.Login.Instance.CurrentLogin().Azienda); throw; } }
private bool isFirstChar(UltraGridCell cell) { try { if (cell.SelStart == 0 && cell.SelLength == 0) return true; if (cell.Text.Substring(0, cell.SelStart) == "_".PadLeft(cell.SelStart, '_')) return true; if (cell.Text.Substring(0, cell.SelStart) == "€ _".PadRight(cell.SelStart, '_')) return true; return false; } catch (NotSupportedException) { return true; } catch (Exception ex) { _log.Error("Errore durante la navigazione con le frecce nella grid: " + Utility.GetMethodDescription() + " - cell:" + cell.Column.Key, ex); return false; } }
public void ugServicios_CellKeyEnter(UltraGridCell Cell) { //try //{ // if (Cell == null || ItemCotizacion == null) { return; } // ItemCotizacionServicio Item = (ItemCotizacionServicio)Cell.Row.Tag; // switch (Cell.Column.Key) // { // case colServicio: // if (Cell.Text.Equals("")) { break; } // AgregarServicios("%", Cell.Text, Cell.Row); // break; // default: // break; // } //} //catch (Exception) //{ } }