private void pivotGrid_CellDblClick(object sender, PivotCellEventArgs e) { if (!showDrillDown.IsChecked.Value) { return; } GridControl grid = new GridControl(); ThemeManager.SetThemeName(grid, ThemeManager.ApplicationThemeName); grid.HorizontalAlignment = HorizontalAlignment.Stretch; grid.VerticalAlignment = VerticalAlignment.Stretch; PivotDrillDownDataSource ds = e.CreateDrillDownDataSource(); grid.View = new TableView() { AllowPerPixelScrolling = true }; grid.ItemsSource = ds; grid.PopulateColumns(); grid.ShowBorder = false; popupContainer = FloatingContainer.ShowDialog(grid, this, new Size(520, 300), new FloatingContainerParameters() { AllowSizing = true, CloseOnEscape = true, Title = "Drill Down Form", ClosedDelegate = null }); AddLogicalChild(popupContainer); }
private void chartControl1_ObjectHotTracked(object sender, DevExpress.XtraCharts.HotTrackEventArgs e) { SeriesPoint point = e.AdditionalObject as SeriesPoint; if (point != null) { PivotChartDataSourceRowItem coord = point.Tag as PivotChartDataSourceRowItem; ChartControl chart = (ChartControl)sender; PivotGridControl pivot = (PivotGridControl)chart.DataSource; PivotCellEventArgs info = pivot.Cells.GetCellInfo(coord.CellX, coord.CellY); PivotSummaryDataSource source = info.CreateSummaryDataSource(); string s = string.Empty; for (int i = 0; i < source.RowCount; i++) { s += "Country = " + source.GetValue(i, 0).ToString() + "\r\tYear = " + source.GetValue(i, 1).ToString() + "\r\tExtended Price = " + source.GetValue(i, 2).ToString() + "\r\n"; } toolTipController1.ShowHint(s); } else { toolTipController1.HideHint(); } }
private void pivotGridControl1_FocusedCellChanged(object sender, EventArgs e) { PivotCellEventArgs c = this.pivotGridControl1.Cells.GetFocusedCellInfo(); string shopID = string.Empty; string stepID = string.Empty; string ownerTpye = string.Empty; string prodID = string.Empty; foreach (PivotGridField r in c.GetRowFields()) { string strFieldName = r.FieldName; string strFieldValue = r.GetValueText(c.GetFieldValue(r)); if (strFieldName == TargetPlanCompareData.SHOP_ID) { shopID = strFieldValue; } else if (strFieldName == TargetPlanCompareData.STEP_ID) { stepID = strFieldValue; } else if (strFieldName == TargetPlanCompareData.PRODUCT_ID) { prodID = strFieldValue; } else if (strFieldName == TargetPlanCompareData.OWNER_TYPE) { ownerTpye = strFieldName; } } DrawChart(shopID, stepID, prodID); }
private string GetColumnFieldValueText(PivotGridControl pivotGrid, PivotCellEventArgs cellInfo) { StringBuilder sb = new StringBuilder(); if (cellInfo.ColumnValueType == PivotGridValueType.GrandTotal) { sb.Append("Grand Total"); sb.Append(separatorString); } else { foreach (PivotGridField field in cellInfo.GetColumnFields()) { sb.Append(cellInfo.GetFieldValue(field)); sb.Append(separatorString); } } if (pivotGrid.GetFieldsByArea(PivotArea.DataArea).Count > 1) { sb.Append(cellInfo.DataField); } else { sb.Remove(sb.Length - separatorString.Length, separatorString.Length); } return(sb.ToString()); }
private void pivotGridUserLoginDetails_CellClick(object sender, PivotCellEventArgs e) { int presents = 0; int absents = 0; CalculateSummary(); string val = e.GetFieldValue(pivotGridUserLoginDetails.Fields["Date"], e.ColumnIndex).ToString(); if (presentDictionary.ContainsKey(val)) { presents = presentDictionary[val]; } else { presents = 0; } if (absentDictionary.ContainsKey(val)) { absents = absentDictionary[val]; } else { absents = 0; } lblDate.Text = val; lblPresentCount.Text = presents.ToString(); lblAbsentCount.Text = absents.ToString(); }
PivotData FillPivotData() { int columnCount = pivotGridControl1.Cells.ColumnCount, rowCount = pivotGridControl1.Cells.RowCount; List <PivotGridField> columnFields = pivotGridControl1.GetFieldsByArea(PivotArea.ColumnArea), rowFields = pivotGridControl1.GetFieldsByArea(PivotArea.RowArea); PivotData data = new PivotData(columnCount, rowCount, columnFields.Count, rowFields.Count); FillFieldValues(true, columnCount, columnFields, data); FillFieldValues(false, rowCount, rowFields, data); for (int i = 0; i < columnCount; i++) { for (int j = 0; j < rowCount; j++) { PivotCellEventArgs info = pivotGridControl1.Cells.GetCellInfo(i, j); if (info != null) { data.SetCellValue(i, j, info.Value); } } } return(data); }
private void pivotGridControl1_CellDoubleClick(object sender, PivotCellEventArgs e) { string targetAreaID = this.TargetAreaID; string targetTime = pivotGridControl1.GetFieldValue(e.ColumnField, e.ColumnIndex) as string; ShowStepWipSnapshot(targetAreaID, targetTime); }
private void PivotGrid_CellDoubleClick(object sender, PivotCellEventArgs e) { XtraForm form = new XtraForm(); form.Icon = Marbid.Module.Win.Properties.Resources.mareinico; form.Height = 800; form.Width = 600; form.StartPosition = FormStartPosition.CenterScreen; form.Owner = pivotForm; form.Text = "Drill Down: " + ReportName; drillGrid = new GridControl(); drillView = new DevExpress.XtraGrid.Views.Grid.GridView(); drillGrid.DataSource = e.CreateDrillDownDataSource(); drillGrid.ViewCollection.Add(drillView); drillGrid.ForceInitialize(); drillGrid.Parent = form; drillGrid.Dock = DockStyle.Fill; DevExpress.XtraGrid.Views.Grid.GridView view = (DevExpress.XtraGrid.Views.Grid.GridView)drillGrid.MainView; view.PopulateColumns(); foreach (GridColumn col in view.Columns) { if (col.GetType() == typeof(System.Decimal) || col.GetType() == typeof(System.Double)) { col.DisplayFormat.FormatType = FormatType.Numeric; col.DisplayFormat.FormatString = "n2"; } } view.PopupMenuShowing += DrillGrid_PopupMenuShowing; view.OptionsView.ColumnAutoWidth = false; view.BestFitColumns(true); form.ShowDialog(); form.Dispose(); }
private void pivotGridControlSummary_CellClick(object sender, PivotCellEventArgs e) { try { int user = Convert.ToInt32(e.CreateDrillDownDataSource().Cast <PivotDrillDownDataRow>().Select(row => row["User_Id"]).Single()); string pdate = e.CreateDrillDownDataSource().Cast <PivotDrillDownDataRow>().Select(row => row["Date"]).Single().ToString(); if (e.DataField.FieldName == pivotGridFieldPHours.FieldName) { Employee.Employee_View_Break_Details emb = new Employee.Employee_View_Break_Details(pdate, user, "Production"); emb.Show(); } if (e.DataField.FieldName == pivotGridFieldBHours.FieldName) { Employee.Employee_View_Break_Details emb = new Employee.Employee_View_Break_Details(pdate, user, "Break"); emb.Show(); } if (e.DataField.FieldName == pivotGridFieldIHours.FieldName) { Employee.Employee_View_Break_Details emb = new Employee.Employee_View_Break_Details(pdate, user, "Ideal"); emb.Show(); } } catch { return; } }
private static void FillDatasetColumns(PivotGridControl pivot, DataTable dataTable1) { dataTable1.Columns.Add("RowFields", typeof(string)); StringBuilder sb = new StringBuilder(); List <PivotGridField> fieldsInColumnArea = GetFieldsInArea(pivot, PivotArea.ColumnArea); bool multipleDataField = pivot.GetFieldsByArea(PivotArea.DataArea).Count > 1; for (int i = 0; i < pivot.Cells.ColumnCount; i++) { PivotCellEventArgs pcea = pivot.Cells.GetCellInfo(i, 0); foreach (PivotGridField field in pcea.GetColumnFields()) { sb.AppendFormat("{0} | ", field.GetDisplayText(pcea.GetFieldValue(field))); //add formatting if it's necessary } if (multipleDataField) { sb.AppendFormat("{0} | ", pcea.DataField); } if (pcea.ColumnValueType == PivotGridValueType.Value) { sb.Remove(sb.Length - 3, 3); } else { sb.Append(pcea.ColumnValueType.ToString()); } dataTable1.Columns.Add(sb.ToString(), typeof(object)); sb.Clear(); } }
private bool SkipCellValue(PivotCellEventArgs cell) { return((!fPivot.OptionsChartDataSource.ProvideColumnCustomTotals && cell.ColumnValueType == PivotGridValueType.CustomTotal) || (!fPivot.OptionsChartDataSource.ProvideColumnGrandTotals && cell.ColumnValueType == PivotGridValueType.GrandTotal) || (!fPivot.OptionsChartDataSource.ProvideColumnTotals && cell.ColumnValueType == PivotGridValueType.Total) || (!fPivot.OptionsChartDataSource.ProvideRowCustomTotals && cell.RowValueType == PivotGridValueType.CustomTotal) || (!fPivot.OptionsChartDataSource.ProvideRowGrandTotals && cell.RowValueType == PivotGridValueType.GrandTotal) || (!fPivot.OptionsChartDataSource.ProvideRowTotals && cell.RowValueType == PivotGridValueType.Total)); }
void _pivotGridControl_ShowingEditor(object sender, CancelPivotCellEditEventArgs e) { PivotCellEventArgs cellInfo = GetFocusedCellInfo(sender as PivotGridControl); if (cellInfo.RowValueType == PivotGridValueType.GrandTotal || cellInfo.ColumnValueType == PivotGridValueType.GrandTotal) { e.Cancel = true; } }
private void pivotGridControl1_CellDoubleClick(object sender, PivotCellEventArgs e) { if (e.RowField == null) { return; //Grand Total cell } PivotGridField[] columnFields = e.GetColumnFields(); object[] columnValues = new object[columnFields.Length]; for (int i = 0; i < columnFields.Length; i++) { columnValues[i] = e.GetFieldValue(columnFields[i]); } PivotGridField[] rowFields = e.GetRowFields(); object[] rowValues = new object[rowFields.Length]; for (int i = 0; i < rowFields.Length - 1; i++) { rowValues[i] = e.GetFieldValue(rowFields[i]); } DataTable dt = new DataTable(); foreach (PivotGridField field in columnFields) { dt.Columns.Add(field.ToString(), field.DataType); } foreach (PivotGridField field in rowFields) { dt.Columns.Add(field.ToString(), field.DataType); } dt.Columns.Add(e.DataField.ToString(), e.DataField.DataType); foreach (object lastLevelValue in e.RowField.GetVisibleValues()) { rowValues[rowFields.Length - 1] = lastLevelValue; object cellValue = e.GetCellValue(columnValues, rowValues, e.DataField); if (cellValue == null) { continue; } DataRow row = dt.NewRow(); for (int i = 0; i < columnFields.Length; i++) { row[columnFields[i].ToString()] = columnValues[i]; } for (int i = 0; i < rowFields.Length; i++) { row[rowFields[i].ToString()] = rowValues[i]; } row[e.DataField.ToString()] = cellValue; dt.Rows.Add(row); } gridControl1.DataSource = dt; gridView1.BestFitColumns(); }
private void pivotGridControl1_CellDoubleClick(object sender, PivotCellEventArgs e) { var frm = new Form(); var grid = new DataGrid(); frm.Controls.Add(grid); grid.Dock = DockStyle.Fill; grid.DataSource = e.CreateDrillDownDataSource(); frm.ShowDialog(this); frm.Dispose(); }
private static object outputDisplayFormatter(PivotCellEventArgs args) { double outValue; if (double.TryParse(args.DisplayText, out outValue)) { return(args.DisplayText); } return(double.NaN); }
public static bool IsTotalField(PivotGridField pgf, PivotCellEventArgs cellInfo) { try { cellInfo.GetFieldValue(pgf).ToString(); return(false); } catch { return(true); } }
private void pvt_datos2_CellDoubleClick(object sender, PivotCellEventArgs e) { try { string item = pvt_datos2.GetFieldValue(COL_ITEM, e.RowIndex).ToString(); Frm_DetalleGF ObjdetGF = new Frm_DetalleGF(_idpresupuesto, item); ObjdetGF.ShowDialog(); } catch (Exception ex) { } }
object[] GetDataFromCell(PivotCellEventArgs cell) { if (SkipCellValue(cell)) { return(null); } object[] result = new object[3]; result[0] = string.Concat(fPivot.OptionsChartDataSource.ProvideDataByColumns ? GetFieldValue(cell, false) : GetFieldValue(cell, true), fPivot.GetFieldsByArea(PivotArea.DataArea).Count > 1 ? string.Concat(" | ", cell.DataField.Caption) : string.Empty); result[1] = fPivot.OptionsChartDataSource.ProvideDataByColumns ? GetFieldValue(cell, true) : GetFieldValue(cell, false); result[2] = Convert.ToDecimal(cell.Value); return(result); }
public static bool IsTotalField(PivotGridField[] fields, PivotCellEventArgs cellInfo) { int nCount = 0; foreach (PivotGridField pgf in fields) { if (IsTotalField(pgf, cellInfo)) { nCount++; } } return(fields.Length == nCount); }
private void salesPersonPivot_CellClick(object sender, PivotCellEventArgs e) { PivotGridControl pivot = (PivotGridControl)sender; List <sd.Point> selection = new List <sd.Point>(); for (int i = 0; i < pivot.ColumnCount; i++) { if (i != e.ColumnIndex) { selection.Add(new sd.Point(i, e.RowIndex)); } } pivot.MultiSelection.SetSelection(selection.ToArray()); }
private void pivotGridControl1_CellDoubleClick(object sender, PivotCellEventArgs e) { //Form v_f = new Form(); //DataGrid v_dg = new DataGrid(); F305_bao_cao_chung_chi_het_han_de v_f1 = new F305_bao_cao_chung_chi_het_han_de(); v_f1.display(e.CreateDrillDownDataSource()); //v_f1.v_grc.DataSource = e.CreateDrillDownDataSource(); //v_f.Controls.Add(v_dg); //v_dg.Dock = DockStyle.Fill; //v_dg.DataSource = e.CreateDrillDownDataSource(); //v_f.Dispose(); //v_f1.ShowDialog(); //v_f1.Dispose(); }
private void pivotGrid_CellClick(object sender, PivotCellEventArgs e) { try { if (e.ColumnField == null) { return; } fnDetail(); //pivotGrid } catch (Exception ex) { Basic.ShowMessage(3, ex.Message); } }
private void pvt_datos2_CellDoubleClick(object sender, PivotCellEventArgs e) { try { //string fundo = pvt_datos2.GetFieldValue(COL_FUNDO2, e.RowIndex).ToString(); //string cultivo= pvt_datos2.GetFieldValue(COL_IDCULTIVO2, e.RowIndex).ToString(); //string variedad= pvt_datos2.GetFieldValue(COL_IDVARIEDAD2, e.RowIndex).ToString(); string item = pvt_datos2.GetFieldValue(COL_ITEM2, e.RowIndex).ToString(); string retString = null; retString = item.Substring(0, 2); Frm_detallePXQ ObjdetPXQ = new Frm_detallePXQ(_idpresupuesto, retString, _moneda); ObjdetPXQ.ShowDialog(); } catch (Exception ex) { } }
/// <summary> /// From sample code /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void BuildAndRunSimpleDrillDownQuery(object sender, PivotCellEventArgs e) { // Create a new form. Form form = new Form(); form.Text = "Records"; // Place a DataGrid control on the form. DataGrid grid = new DataGrid(); grid.Parent = form; grid.Dock = DockStyle.Fill; // Get the recrd set associated with the current cell and bind it to the grid. grid.DataSource = e.CreateDrillDownDataSource(); form.Bounds = new Rectangle(100, 100, 500, 400); // Display the form. form.ShowDialog(); form.Dispose(); }
async void pivotGridControl1_CellClick(object sender, PivotCellEventArgs e) { PivotGridControl pivot = sender as PivotGridControl; if (dForm.IsDisposed) { LoadDrillDownForm(); } //Check whether an asynchronous operation is in progress. if (!pivot.IsAsyncInProgress) { // Get the record set associated with the clicked cell. dForm.DataSource = await pivot.CreateDrillDownDataSourceAsync(e.ColumnIndex, e.RowIndex, 25, new List <string> { "ProductName", "Quantity" }); } }
private static object getDoubleForDataTable(PivotCellEventArgs cellEventArgs) { var cellValue = cellEventArgs.Value; if (cellValue == null) { return(DBNull.Value); } var value = cellValue.ConvertedTo <double>(); if (double.IsNaN(value)) { return(DBNull.Value); } return(value); }
private void pivotGridControl1_FocusedCellChanged(object sender, EventArgs e) { PivotCellEventArgs c = this.pivotGridControl1.Cells.GetFocusedCellInfo(); string prodID = string.Empty; foreach (PivotGridField r in c.GetRowFields()) { string strFieldName = r.FieldName; string strFieldValue = r.GetValueText(c.GetFieldValue(r)); if (strFieldName == BalanceTableViewData.CELL_PRODUCT) { prodID = strFieldValue; } } DrawChart(prodID); }
void pivotGrid_CellDoubleClick(object sender, PivotCellEventArgs e) { AsyncCompletedHandler showDrillDownHandler = delegate(AsyncOperationResult result) { try { if (result.Exception != null) { DXMessageBox.Show(result.Exception.Message); } else { ShowDrillDown((PivotDrillDownDataSource)result.Value); } } catch (Exception ex) { DXMessageBox.Show(ex.Message); } }; pivotGrid.CreateDrillDownDataSourceAsync(e.ColumnIndex, e.RowIndex, showDrillDownHandler); }
private static string GetFieldValue(PivotCellEventArgs cell, bool column) { PivotGridField[] fields = column ? cell.GetColumnFields() : cell.GetRowFields(); StringBuilder result = new StringBuilder(); foreach (PivotGridField field in fields) { result.AppendFormat("{0} | ", cell.GetFieldValue(field)); } if (result.Length > 3) { result.Remove(result.Length - 3, 3); } if (column) { switch (cell.ColumnValueType) { case PivotGridValueType.CustomTotal: return(result.AppendFormat(" Total ({0})", cell.ColumnCustomTotal.SummaryType).ToString()); case PivotGridValueType.GrandTotal: return("Grand Total"); case PivotGridValueType.Total: return(result.Append(" Total").ToString()); } } else { switch (cell.RowValueType) { case PivotGridValueType.CustomTotal: return(result.AppendFormat(" Total ({0})", cell.RowCustomTotal.SummaryType).ToString()); case PivotGridValueType.GrandTotal: return("Grand Total"); case PivotGridValueType.Total: return(result.Append(" Total").ToString()); } } return(result.ToString()); }
private void pivotGridControlMain_CellDoubleClick(object sender, PivotCellEventArgs e) { Form form = new Form(); form.Text = "Records"; // Place a DataGrid control on the form. DevExpress.XtraGrid.GridControl grid = new DevExpress.XtraGrid.GridControl(); DevExpress.XtraGrid.Views.Grid.GridView view = new DevExpress.XtraGrid.Views.Grid.GridView(); view.OptionsView.ColumnAutoWidth = false; grid.MainView = view; grid.Parent = form; grid.Dock = DockStyle.Fill; // Get the recrd set associated with the current cell and bind it to the grid. grid.DataSource = e.CreateDrillDownDataSource(); form.Bounds = new Rectangle(100, 100, 500, 400); // Display the form. form.ShowDialog(); form.Dispose(); }
private void pivotGridControl1_CellDoubleClick(object sender, PivotCellEventArgs e) { GridControl grid = new GridControl(); ThemeManager.SetThemeName(grid, ThemeManager.ApplicationThemeName); grid.HorizontalAlignment = HorizontalAlignment.Stretch; grid.VerticalAlignment = VerticalAlignment.Stretch; PivotDrillDownDataSource ds = e.CreateDrillDownDataSource(); grid.ItemsSource = ds; grid.PopulateColumns(); FloatingWindowContainer.ShowDialogContent(grid, this, new Size(520, 300), new FloatingContainerParameters() { AllowSizing = true, CloseOnEscape = true, Title = "Drill Down Form", ClosedDelegate = null }); }
private static void FillDatasetExtracted(PivotGridControl pivot, DataTable dataTable1) { List <object> rowvalues = new List <object>(); string tempRowText = ""; List <PivotGridField> fieldsInRowArea = GetFieldsInArea(pivot, PivotArea.RowArea); for (int i = 0; i < pivot.Cells.RowCount; i++) { PivotCellEventArgs pcea = pivot.Cells.GetCellInfo(0, i); if (pcea.RowValueType == PivotGridValueType.Value) { foreach (PivotGridField item in fieldsInRowArea) { tempRowText += pcea.GetFieldValue(item).ToString() + " | ";//add formatting if it's necessary } tempRowText = tempRowText.Remove(tempRowText.Length - 3, 3); } else { tempRowText = pcea.RowValueType.ToString(); } rowvalues.Clear(); rowvalues.Add(tempRowText); tempRowText = ""; for (int j = 0; j < pivot.Cells.ColumnCount; j++) { pcea = pivot.Cells.GetCellInfo(j, i); if (pcea.Value != null) { rowvalues.Add(pcea.Value); } else { rowvalues.Add(DBNull.Value); } } dataTable1.Rows.Add(rowvalues.ToArray()); } }
private void PivotGridControlModifiedCellClick(object sender, PivotCellEventArgs e) { if (e.Value == null) return; if (e.ColumnField == null || e.RowField == null || e.DataField != Fields["MEASURE_STATUS_NEW"] || FormType == FormTypes.Base || e.Button != MouseButton.Left) return; #region Initialize Condition var fc = e.GetColumnFields(); var fr = e.GetRowFields(); var fieldValues = fc.Select(pivotGridField => new FieldValue { Field = pivotGridField.FieldName, Value = e.GetFieldValue(pivotGridField), ShowBlanks = pivotGridField.FilterValues.ShowBlanks}).ToList(); fieldValues.AddRange(fr.Select(pivotGridField => new FieldValue { Field = pivotGridField.FieldName, Value = e.GetFieldValue(pivotGridField), ShowBlanks = pivotGridField.FilterValues.ShowBlanks })); CellArgs.ConditionValues = fieldValues; #endregion CellArgs.Filters = GetCurrentFiltersState(); #region Context Menu var menu = new ContextMenu(); for (var i = FormActions.Add; i < FormActions.Restore + 1; i++) { MenuItem menuItem; switch (i) { case FormActions.Delete: menuItem = new MenuItem { Tag = i, Header = i.Description(), IsEnabled = (e.DisplayText).Split('&')[3].Equals("0") ? false : true }; menuItem.Click += ContextMenuItemClick; menu.Items.Add(menuItem); break; case FormActions.Add: menuItem = new MenuItem { Tag = i, Header = i.Description(), IsEnabled = (e.DisplayText).Split('&')[3].Equals("2") ? false : true }; menuItem.Click += ContextMenuItemClick; menu.Items.Add(menuItem); break; default: { menuItem = new MenuItem { Tag = i, Header = i.Description() }; menuItem.Click += ContextMenuItemClick; menu.Items.Add(menuItem); } break; } } menu.IsOpen = true; #endregion }
private void pivotGridControl_CellDoubleClick(object sender, PivotCellEventArgs e) { var employeeStatisticDetailForm = new EmployeeStatisticsDetail(); employeeStatisticDetailForm.Display(e.CreateDrillDownDataSource()); }
private void pivotGridControl1_CellDoubleClick(object sender, PivotCellEventArgs e) { F303_ket_qua_dao_tao_de v_f = new F303_ket_qua_dao_tao_de(); v_f.display(e.CreateDrillDownDataSource()); }
private void PivotGridControlRowOrientedCellClick(object sender, PivotCellEventArgs e) { if (e.RowField == null) return; #region Initialize Condition var fc = e.GetColumnFields(); var fr = e.GetRowFields(); var fieldValues = fc.Select(pivotGridField => new FieldValue { Field = pivotGridField.FieldName, Value = e.GetFieldValue(pivotGridField) }).ToList(); fieldValues.AddRange(fr.Select(pivotGridField => new FieldValue { Field = pivotGridField.FieldName, Value = e.GetFieldValue(pivotGridField) })); CellArgs = new CellInputDataEventArgs(); CellArgs.ConditionValues = fieldValues; #endregion #region Initialize Filters //var fields = GetFieldsByArea(FieldArea.FilterArea); //var filters = new List<FilterValues>(); //foreach (var field in fields) //{ // filters.Add(new FilterValues { Field = field.FieldName, Values = field.FilterValues.ValuesIncluded.ToList(), ShowBlanks = field.FilterValues.ShowBlanks }); //} var filters = (from field in Fields where field.Visible && field.FilterValues.HasFilter select new FilterValues { Field = field.FieldName, Values = field.FilterValues.ValuesIncluded.ToList(), ShowBlanks = field.FilterValues.ShowBlanks }).ToList(); CellArgs.Filters = filters; #endregion #region Calculate Condition Locs /* var setIL = _db.DataTableGetILByCondition(Table.TableRowSource, CellArgs.ConditionValues, CellArgs.Filters); var locs = _db.DataTableGetLocsByIL(setIL); */ var userWhList = _db.UserWhList.Keys.ToList(); /* foreach (var loc in locs) { if (userWhList.Contains(loc)) { userWhList.Remove(loc); } } var items = _db.DataTableGetItemsByIL(setIL); foreach (var item in items) { var whs = _db.DataTableGetWhRowsByItem(item); foreach (var wh in whs) { if (userWhList.Contains(wh))userWhList.Remove(wh); } } */ #endregion #region Input Data Types //CellArgs.FieldName = e.DataField.FieldName; //CellArgs.DataTypeName = e.DataField.DataType.Name;)) if (e.DataField == Fields["DIM_ITEMLOC_SUPPLIER_NEW"] || e.DataField == Fields["DIM_ITEMLOC_SUPPLIER_DESC_NEW"]) { CellArgs.SetValues.Add(new FieldValue { Field = "DIM_ITEMLOC_SUPPLIER_NEW", Value = null }); CellArgs.SetValues.Add(new FieldValue { Field = "DIM_ITEMLOC_SUPPLIER_DESC_NEW", Value = null }); CellArgs.Type = InputDataTypes.Supplier; CellClickInputData(this, CellArgs); } else if (e.DataField == Fields["DIM_ITEMLOC_ORDERPLACE_NEW"]) { CellArgs.SetValues.Add(new FieldValue { Field = e.DataField.FieldName, Value = null }); CellArgs.Type = InputDataTypes.OrderPlace; #region Context Menu var menu = new ContextMenu(); for (var i = OrderPlaces.Supplier; i < OrderPlaces.Office+1; i++) { var menuItem = new MenuItem { Tag = (int)i, Header = i.Description() }; menuItem.Click += ContextMenuItemClick; menu.Items.Add(menuItem); } //var menuItemOrderPlace1 = new MenuItem { Tag = (int)OrderPlace.Supplier, Header = OrderPlace.Supplier.Description() }; //menuItemOrderPlace1.Click += ContextMenuItemOrderPlaceClick; //var menuItemOrderPlace2 = new MenuItem { Tag = (int)OrderPlace.Store, Header = OrderPlace.Store.Description() }; //menuItemOrderPlace2.Click += ContextMenuItemOrderPlaceClick; //var menuItemOrderPlace3 = new MenuItem { Tag = (int)OrderPlace.Office, Header = OrderPlace.Office.Description() }; //menuItemOrderPlace3.Click += ContextMenuItemOrderPlaceClick; //var menu = new ContextMenu(); //menu.Items.Add(menuItemOrderPlace1); //menu.Items.Add(menuItemOrderPlace2); //menu.Items.Add(menuItemOrderPlace3); menu.IsOpen = true; #endregion } else if (e.DataField == Fields["DIM_ITEMLOC_SOURCEMETHOD_NEW"]) { CellArgs.SetValues.Add(new FieldValue { Field = e.DataField.FieldName, Value = null }); CellArgs.SetValues.Add(new FieldValue { Field = "DIM_ITEMLOC_SOURCEWH_NEW", Value = null }); CellArgs.Type = InputDataTypes.SourceMethod; #region Context Menu var menuItemSourceMethod = new MenuItem { Tag = (char)SourceMethods.S, Header = SourceMethods.S.Description() }; menuItemSourceMethod.Click += ContextMenuItemClick; var menu = new ContextMenu(); menu.Items.Add(menuItemSourceMethod); //if (_db.UserWhList.Count != 0) if (userWhList.Count != 0) { var menuItemSourceMethod2 = new MenuItem { Tag = (char)SourceMethods.W, Header = SourceMethods.W.Description() }; menuItemSourceMethod2.Click += ContextMenuItemClick; var menuItemSourceMethod3 = new MenuItem { Tag = (char)SourceMethods.T, Header = SourceMethods.T.Description() }; menuItemSourceMethod3.Click += ContextMenuItemClick; menu.Items.Add(menuItemSourceMethod2); menu.Items.Add(menuItemSourceMethod3); menu.IsOpen = true; } menu.IsOpen = true; #endregion } else if (e.DataField == Fields["DIM_ITEMLOC_SOURCEWH_NEW"]) { #region Check Source Method var r = e.GetRowFields(); var sourcemethod = e.GetCellValue(null, r.Select(f => e.GetFieldValue(f)).ToArray(), Fields["DIM_ITEMLOC_SOURCEMETHOD_NEW"]) as CellRowOriented; if (sourcemethod == null) return; if (sourcemethod.Value == "" || Convert.ToChar(sourcemethod.Value) == (char)SourceMethods.S || sourcemethod.Value == "?") return; #endregion CellArgs.SetValues.Add(new FieldValue { Field = e.DataField.FieldName, Value = null}); CellArgs.Type = InputDataTypes.SourceWh; #region Context Menu var menu = new ContextMenu(); foreach (var wh in userWhList) { //var menuItemSource = new MenuItem { Header = wh.Key, Tag = wh.Key }; var menuItemSource = new MenuItem { Header = wh, Tag = wh }; menuItemSource.Click += ContextMenuItemClick; menu.Items.Add(menuItemSource); } menu.IsOpen = true; #endregion } else { return; } #endregion }