protected override void AssignColumns(ColumnView cv, bool synchronize) { if (_gridListEditor == null) { base.AssignColumns(cv, synchronize); return; } if (synchronize) { base.AssignColumns(cv, true); } else { Columns.Clear(); var columnsListEditorModelSynchronizer = new ColumnsListEditorModelSynchronizer(_gridListEditor, _gridListEditor.Model); columnsListEditorModelSynchronizer.ApplyModel(); var gridColumns = _gridListEditor.GridView.Columns.OfType<XafGridColumn>(); foreach (var column in gridColumns){ var xpandXafGridColumn = new XpandXafGridColumn(column.TypeInfo, _gridListEditor); xpandXafGridColumn.ApplyModel(column.Model); Columns.Add(xpandXafGridColumn); xpandXafGridColumn.Assign(column); } } }
static void Main(string[] args) { EventBus bus = new EventBus(); _eventStore = new MemoryEventStore(bus); IEventSourcedRepository<Column> eventSourcedRepository = UseSnapshotting ? CreateSnapshottingRepository(EventsPerSnapshot) : CreateNonSnapshottingRepository(); ColumnCommandHandler commandHandler = new ColumnCommandHandler(eventSourcedRepository); _columnRepository = new MemoryRepository<ColumnDTO>(); _calculationRepository = new MemoryRepository<CalculationDTO>(); ColumnView columnView = new ColumnView(_columnRepository); CalculationView calculationView = new CalculationView(_calculationRepository); //bus.Subscribe<IEvent>(ev => _log.Information("New Event: {@Event}", ev)); bus.Subscribe<ColumnCreated>(columnView.Handle); bus.Subscribe<ColumnRenamed>(columnView.Handle); bus.Subscribe<ColumnDataTypeChanged>(columnView.Handle); bus.Subscribe<ColumnMadePrimary>(columnView.Handle); bus.Subscribe<ColumnPrimaryCleared>(columnView.Handle); bus.Subscribe<CalculationAdded>(columnView.Handle); bus.Subscribe<CalculationRemoved>(columnView.Handle); bus.Subscribe<CalculationAdded>(calculationView.Handle); bus.Subscribe<CalculationRemoved>(calculationView.Handle); bus.Subscribe<CalculationOperandChanged>(calculationView.Handle); bus.Subscribe<CalculationOperatorChanged>(calculationView.Handle); PerformSomeActions(commandHandler); ShowReadModel(); PerformLotsOfActions(commandHandler); }
/// <summary> /// Initialises the view. /// </summary> /// <param name="grid">The layoutRoot grid.</param> /// <param name="columnManager">Look ahead view column manager.</param> public void InitializeView(Grid grid, ColumnManager columnManager) { System.Collections.ObjectModel.Collection<ColumnManager> columns = new System.Collections.ObjectModel.Collection<ColumnManager>(); columns.Add(columnManager); this.view = new ColumnView(grid, columns, true); }
private XtraPropertyInfoCollection GetFilterProps(ColumnView view) { var store = new XtraPropertyInfoCollection(); var propList = new ArrayList(); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(view); propList.Add(properties.Find("Columns", false)); propList.Add(properties.Find("OptionsView", false)); propList.Add(properties.Find("ActiveFilterEnabled", false)); propList.Add(properties.Find("ActiveFilterString", false)); propList.Add(properties.Find("MRUFilters", false)); propList.Add(properties.Find("ActiveFilter", false)); MethodInfo mi = typeof (SerializeHelper).GetMethod("SerializeProperty", BindingFlags.NonPublic | BindingFlags.Instance); MethodInfo miGetXtraSerializableProperty = typeof (SerializeHelper).GetMethod( "GetXtraSerializableProperty", BindingFlags.NonPublic | BindingFlags.Instance); var helper = new SerializeHelper(view); (view as IXtraSerializable).OnStartSerializing(); foreach (PropertyDescriptor prop in propList) { var newXtraSerializableProperty = miGetXtraSerializableProperty.Invoke(helper, new object[] {view, prop}) as XtraSerializableProperty; var p = new SerializablePropertyDescriptorPair(prop, newXtraSerializableProperty); mi.Invoke(helper, new object[] {store, view, p, XtraSerializationFlags.None, null}); } (view as IXtraSerializable).OnEndSerializing(); return store; }
public void LoadUserViewLayout(ColumnView view) { try { string strl = LoadLayout(); var mss = new MemoryStream(Encoding.UTF8.GetBytes(strl)); view.RestoreLayoutFromStream(mss); } catch { } }
public static void GridViewFocusObject(ColumnView cView, object obj) { if(obj == null) return; int oldFocusedRowHandle = cView.FocusedRowHandle; for(int i = 0; i < cView.DataRowCount; ++i) { object rowObj = cView.GetRow(i) as object; if(rowObj == null) continue; if(ReferenceEquals(obj, rowObj)) { if(i == oldFocusedRowHandle) cView.FocusedRowHandle = GridControl.InvalidRowHandle; cView.FocusedRowHandle = i; break; } } }
protected IXtraPropertyCollection GetFilterProps(ColumnView view, string[] propertyNames) { var store = new XtraPropertyInfoCollection(); if (propertyNames.Length > 0) { var propList = new ArrayList(); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(view); foreach (string propertyName in propertyNames) propList.Add(properties.Find(propertyName, false)); var helper = new SerializeHelper(); MethodInfo mi = typeof (SerializeHelper).GetMethod("SerializeProperty", BindingFlags.NonPublic | BindingFlags.Instance); (view as IXtraSerializable).OnStartSerializing(); foreach (PropertyDescriptor prop in propList) { mi.Invoke(helper, new object[] {store, view, prop, XtraSerializationFlags.None, null}); } (view as IXtraSerializable).OnEndSerializing(); } return store; }
public MyCheckedColumnFilterPopup(ColumnView view, GridColumn column, Control owner, object creator) : base(view, column, owner, creator) { }
public ColumnPainter(UIElement headerView, ColumnView view, ColumnVM vm) { this.headerView = headerView; this.vm = vm; this.view = view; }
public void AssignSynchronizers(ColumnView columnView) { throw new NotImplementedException(); }
private void RefreshCarTypeView() { if (gridControlCarType.Visible) { var listResult = CarTypeBusiness.Instance.GetCarTypes(); gridControlCarType.DataSource = listResult; gridControlCarType.DefaultView.RefreshData(); defaultGridView = gridControlCarType.DefaultView as ColumnView; this.btnUpdate.Enabled = this.btnDelete.Enabled = listResult.Count > 0; } }
public static void SaveFilter(ColumnView view, Stream stream, string[] propertyNames) { var serializer = new MoreSerializer(); serializer.Serialize(stream, serializer.GetFilterProps(view, propertyNames), "View"); }
public static void AddDynamicColumns(ColumnView gridView, IDynamicPropertyList propertyList, ESortBy sortBy, ESortDirection sortDir, string nullText) { AddDynamicColumns(gridView, propertyList, sortBy, sortDir, nullText, null, true); }
public CommonGridColumnCollection(ColumnView view) : base(view) { }
private bool getBooleanValue(string fieldName, ColumnView view, int listSourceRowIndex) { DataRow row = gridView.GetDataRow(listSourceRowIndex); if (row != null) { object value = row[fieldName]; if (value != null && value.ToString().ToUpper().StartsWith("Y")) { return true; } } return false; }
public ColumnViewHelper(ColumnView view, CollectionViewModel <TEntity, TID, TUnitOfWork> viewModel) { this.view = view; this.viewModel = viewModel; }
private IEnumerable<DXMenuItem> GetColumnContextMenuItems(ColumnView targetView, GridColumn targetColumn) { var items = new List<DXMenuItem>(); if (_spotColumns.Any(sc => sc.Visible && sc == targetColumn)) { items.Add(new DXMenuItem("Create Weekly Snapshot", (o, args) => { targetView.CloseEditor(); using (var form = new FormSnapshotFromSection()) { form.SnapshotName = _sectionContainer.SectionData.Name; if (form.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK) { var newSnapshot = _sectionContainer.SectionData.CopyScheduleToSnapshot( form.SnapshotName, (DateTime)((object[])targetColumn.Tag)[3], form.CopySpots); _sectionContainer.RaiseDataChanged(new SectionDataChangedEventArgs { SnapshotsChanged = true }); using (var confirmation = new FormCopyContentConfirmation()) { confirmation.Text = "Create Snapshot"; confirmation.labelControlTitle.Text = String.Format(confirmation.labelControlTitle.Text, "Snapshot successfully added"); confirmation.buttonXOK.Text = String.Format("Go to {0}", Controller.Instance.TabSnapshot.Text); if (confirmation.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK) ContentRibbonManager<MediaScheduleChangeInfo>.ShowRibbonTab( ContentIdentifiers.Snapshots, new SnapshotOpenEventArgs { SnapshotId = newSnapshot.UniqueID, EditorType = SnapshotEditorType.Schedule }); } } } })); } return items; }
private IEnumerable<DXMenuItem> GetCellContextMenuItems(ColumnView targetView, GridColumn targetColumn, int targetRowHandle) { var items = new List<DXMenuItem>(); if (_spotColumns.Any(sc => sc.Visible && sc == targetColumn)) { var columnName = ((object[])targetColumn.Tag)[1]; items.Add(new DXMenuItem(String.Format("Clone {1} to all {0}s", SpotTitle, columnName), (o, args) => { targetView.CloseEditor(); var valueToClone = targetView.GetRowCellValue(targetRowHandle, targetColumn); CloneSpots(targetRowHandle, valueToClone, -1, false); })); items.Add(new DXMenuItem(String.Format("Clone {1} to all Remaining {0}s", SpotTitle, columnName), (o, args) => { targetView.CloseEditor(); var valueToClone = targetView.GetRowCellValue(targetRowHandle, targetColumn); CloneSpots(targetRowHandle, valueToClone, targetColumn.VisibleIndex, false); })); items.Add(new DXMenuItem(String.Format("Clone {1} to every other Remaining {0}s", SpotTitle, columnName), (o, args) => { targetView.CloseEditor(); var valueToClone = targetView.GetRowCellValue(targetRowHandle, targetColumn); CloneSpots(targetRowHandle, valueToClone, targetColumn.VisibleIndex, true); })); items.Add(new DXMenuItem("Wipe all Spots on this line", (o, args) => CloneSpots(targetRowHandle, null, -1, false))); } else if (targetColumn == bandedGridColumnIndex || targetColumn == bandedGridColumnLogoImage || targetColumn == bandedGridColumnStation || targetColumn == bandedGridColumnDaypart || targetColumn == bandedGridColumnName) { var sourceIndex = targetView.GetDataSourceRowIndex(targetRowHandle); items.Add(new DXMenuItem("Clone this Entire Line", (o, args) => CloneProgram(sourceIndex, true))); items.Add(new DXMenuItem("Clone Just this Program", (o, args) => CloneProgram(sourceIndex, false))); items.Add(new DXMenuItem("Delete this Line", OnDeleteProgram)); } return items; }
private void ResetColumnOrder(ColumnView columnView, Dictionary<GridColumn, bool> storedVisiblity, Dictionary<GridColumn, int> storedVisibleIndices) { int i = 100; foreach (GridColumn column in columnView.Columns) { if (!storedVisiblity[column]) continue; if (storedVisibleIndices.ContainsKey(column)) { column.Visible = true; column.VisibleIndex = storedVisibleIndices[column]; } else { column.VisibleIndex = i++; } } }
public static void SaveLayout(ColumnView view, Stream stream) { var serializer = new GridLayoutSerializer(); serializer.Serialize(stream, serializer.GetFilterProps(view), "View"); }
private string GetSortExpression(ColumnView view) { string fields = ""; foreach (GridColumnSortInfo info in view.SortInfo) { if (fields != "") fields += ";"; fields += string.Format("{0}", info.Column.FieldName); if (info.SortOrder == DevExpress.Data.ColumnSortOrder.Descending) fields += "|DESC"; else fields += "|ASC"; } return fields; }
// 查看详细 private void dgvCljbxx_MouseDoubleClick(object sender, MouseEventArgs e) { ColumnView cv = (ColumnView)dgvCljbxx.FocusedView; DataRowView dr = (DataRowView)cv.GetFocusedRow(); if (dr == null) { return; } string vin = (string)dr.Row["VIN"];; // 获取此VIN的详细信息,带入窗口 string sql = @"select * from FC_CLJBXX where vin = @vin"; OleDbParameter[] param = { new OleDbParameter("@vin", vin) }; DataSet ds = AccessHelper.ExecuteDataSet(AccessHelper.conn, sql, param); DataTable dt = ds.Tables[0]; // 弹出详细信息窗口,可修改 JbxxViewForm jvf = new JbxxViewForm(); jvf.status = "1"; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Columns.Count; i++) { DataColumn dc = dt.Columns[i]; Control[] c = jvf.Controls.Find("tb" + dc.ColumnName, true); if (c.Length > 0) { if (c[0] is TextEdit) { c[0].Text = dt.Rows[0].ItemArray[i].ToString(); continue; } if (c[0] is DevExpress.XtraEditors.ComboBoxEdit) { DevExpress.XtraEditors.ComboBoxEdit cb = c[0] as DevExpress.XtraEditors.ComboBoxEdit; cb.Text = dt.Rows[0].ItemArray[i].ToString(); if (cb.Text == "汽油" || cb.Text == "柴油" || cb.Text == "两用燃料" || cb.Text == "双燃料" || cb.Text == "纯电动" || cb.Text == "非插电式混合动力" || cb.Text == "插电式混合动力" || cb.Text == "燃料电池") { string rlval = cb.Text; if (cb.Text == "汽油" || cb.Text == "柴油" || cb.Text == "两用燃料" || cb.Text == "双燃料") { rlval = "传统能源"; } // 构建燃料参数控件 jvf.getParamList(rlval, true); } } } } } // 获取燃料信息 string rlsql = @"select e.* from RLLX_PARAM_ENTITY e where e.vin = @vin"; ds = AccessHelper.ExecuteDataSet(AccessHelper.conn, rlsql, param); dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { DataRow drrlxx = dt.Rows[i]; string cName = drrlxx.ItemArray[1].ToString(); Control[] c = jvf.Controls.Find(cName, true); if (c.Length > 0) { if (c[0] is TextEdit) { c[0].Text = drrlxx.ItemArray[3].ToString(); continue; } if (c[0] is DevExpress.XtraEditors.ComboBoxEdit) { DevExpress.XtraEditors.ComboBoxEdit cb = c[0] as DevExpress.XtraEditors.ComboBoxEdit; cb.Text = drrlxx.ItemArray[3].ToString(); } } } (jvf.Controls.Find("tc", true)[0] as XtraTabControl).SelectedTabPageIndex = 0; jvf.MaximizeBox = false; jvf.MinimizeBox = false; jvf.setVisible("btnbaocun", false); jvf.setVisible("btnbaocunshangbao", false); Utils.SetFormMid(jvf); jvf.formClosingEventHandel += new FormClosingEventHandler(refrashBySubForm); jvf.ShowDialog(); }
private void gridView2_ValidateRow(object sender, ValidateRowEventArgs e) { using (Session session1 = new Session()) { session1.BeginTransaction(); try { ColumnView view = sender as ColumnView; GridColumn column1 = view.Columns["CODE"]; GridColumn column2 = view.Columns["AGENCY"]; GridColumn column3 = view.Columns["CAT"]; GridColumn column4 = view.Columns["Time"]; GridColumn column5 = view.Columns["START_DATE"]; GridColumn column6 = view.Columns["END_DATE"]; GridColumn column7 = view.Columns["ResDate_Start"]; GridColumn column8 = view.Columns["ResDate_End"]; //Get the value of the columns string val1 = (string)view.GetRowCellValue(e.RowHandle, column1); string val2 = (string)view.GetRowCellValue(e.RowHandle, column2); string val3 = (string)view.GetRowCellValue(e.RowHandle, column3); string val4 = (string)view.GetRowCellValue(e.RowHandle, column4); DateTime time1 = (DateTime)view.GetRowCellValue(e.RowHandle, column5); DateTime time2 = (DateTime)view.GetRowCellValue(e.RowHandle, column6); DateTime time3 = new DateTime(); DateTime time4 = new DateTime(); if ((string)view.GetRowCellValue(e.RowHandle, column7) != null) { time3 = (DateTime)view.GetRowCellValue(e.RowHandle, column7); } if ((string)view.GetRowCellValue(e.RowHandle, column8) != null) { time4 = (DateTime)view.GetRowCellValue(e.RowHandle, column8); } var load = from c in context.CPRATES where c.CODE == val1 && c.AGENCY == val2 && c.CAT == val3 select new { c.START_DATE, c.END_DATE, c.ResDate_Start, c.ResDate_End }; //Validity criterion if (load.Count() > 0) { foreach (var d in load) { DateTime dateStart2 = (DateTime)d.START_DATE; DateTime dateEnd2 = (DateTime)d.END_DATE; if (!checkOverlap(time1, time2, dateStart2, dateEnd2)) { DateTime time5 = new DateTime(); DateTime time6 = new DateTime(); if (d.ResDate_Start != null) { time5 = (DateTime)d.ResDate_Start; } if (d.ResDate_Start != null) { time6 = (DateTime)d.ResDate_End; } if (!checkOverlap(time3, time4, time5, time6)) { GridViewCopy.SetRowCellValue(e.RowHandle, "Over", true); e.Valid = true; } } } } session1.CommitTransaction(); } catch { session1.RollbackTransaction(); } } }
private static void AddDynamicColumns(ColumnView gridView, IDynamicPropertyList propertyList, ESortBy sortBy, ESortDirection sortDir, string nullText, IComparer <IDynamicProperty> comparer, bool allowFilter) { RepositoryItemTextEdit riteCol = null; gridView.BeginDataUpdate(); int visibleIndexValue = 0; foreach (GridColumn column in gridView.Columns) { if (column.VisibleIndex > visibleIndexValue) { visibleIndexValue = column.VisibleIndex; } } if (!string.IsNullOrEmpty(nullText)) { riteCol = new RepositoryItemTextEdit(); riteCol.NullText = nullText; } List <IDynamicProperty> propertyListSorted; if (comparer == null) { propertyListSorted = propertyList.GetPropertiesSorted(true, sortBy, sortDir); } else { propertyListSorted = propertyList.GetPropertiesSorted(true, comparer); } foreach (IDynamicProperty property in propertyListSorted) { var newColumn = new GridColumn(); newColumn.Caption = property.DisplayName; newColumn.FieldName = property.Key; newColumn.Name = "col" + property.Key; newColumn.OptionsColumn.ReadOnly = property.ReadOnly; newColumn.Visible = property.Visible; newColumn.ToolTip = property.Description; newColumn.OptionsFilter.AllowFilter = allowFilter; if (riteCol != null) { newColumn.ColumnEdit = riteCol; } if (property.Visible) { visibleIndexValue++; newColumn.VisibleIndex = visibleIndexValue; } else { newColumn.VisibleIndex = -1; } newColumn.Tag = property.Key; newColumn.UnboundType = GetUnboundType(property); //check if column exists foreach (GridColumn column in gridView.Columns) { Debug.Assert(column.Name != newColumn.Name, "Column with this name exists already"); } gridView.Columns.Add(newColumn); } gridView.EndDataUpdate(); }
// 查看详细 private void gvCLJBXX_MouseDoubleClick(object sender, MouseEventArgs e) { ColumnView cv = (ColumnView)gcCLJBXX.FocusedView; DataRowView dr = (DataRowView)cv.GetFocusedRow(); if (dr == null) { return; } string vin = (string)dr.Row.ItemArray[0]; // 获取此VIN的详细信息,带入窗口 string sql = String.Format(@"select * from FC_CLJBXX where vin = '{0}'", vin); // 获取燃料信息 string rlsql = String.Format(@"select e.* from RLLX_PARAM_ENTITY e where e.vin = '{0}'", vin); DataTable dtJbxx = OracleHelper.ExecuteDataSet(OracleHelper.conn, sql, null).Tables[0]; DataTable dtRlxx = OracleHelper.ExecuteDataSet(OracleHelper.conn, rlsql, null).Tables[0]; // 弹出详细信息窗口,可修改 JbxxViewForm jvf = new JbxxViewForm("UPLOADOT") { status = "1" }; if (dtJbxx.Rows.Count > 0) { for (int i = 0; i < dtJbxx.Columns.Count; i++) { DataColumn dc = dtJbxx.Columns[i]; Control[] c = jvf.Controls.Find("tb" + dc.ColumnName, true); if (c.Length > 0) { if (c[0] is TextEdit) { c[0].Text = dtJbxx.Rows[0].ItemArray[i].ToString(); continue; } if (c[0] is ComboBoxEdit) { ComboBoxEdit cb = c[0] as ComboBoxEdit; cb.Text = dtJbxx.Rows[0].ItemArray[i].ToString(); if (cb.Text == "汽油" || cb.Text == "柴油" || cb.Text == "两用燃料" || cb.Text == "双燃料" || cb.Text == "纯电动" || cb.Text == "非插电式混合动力" || cb.Text == "插电式混合动力" || cb.Text == "燃料电池") { string rlval; if (cb.Text == "汽油" || cb.Text == "柴油" || cb.Text == "两用燃料" || cb.Text == "双燃料") { rlval = "传统能源"; } else { rlval = cb.Text; } // 构建燃料参数控件 jvf.getParamList(rlval, true); } } } } } for (int i = 0; i < dtRlxx.Rows.Count; i++) { DataRow drrlxx = dtRlxx.Rows[i]; string cName = drrlxx.ItemArray[1].ToString(); Control[] c = jvf.Controls.Find(cName, true); if (c.Length > 0) { if (c[0] is TextEdit) { c[0].Text = drrlxx.ItemArray[3].ToString(); continue; } if (c[0] is ComboBoxEdit) { ComboBoxEdit cb = c[0] as ComboBoxEdit; cb.Text = drrlxx.ItemArray[3].ToString(); } } } (jvf.Controls.Find("tc", true)[0] as XtraTabControl).SelectedTabPageIndex = 0; jvf.MaximizeBox = false; jvf.MinimizeBox = false; Utils.SetFormMid(jvf); jvf.ShowDialog(); if (jvf.DialogResult == DialogResult.Cancel) { this.refrashCurrentPage(); } }
private void gvMain_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { ColumnView view = sender as ColumnView; if (e.Column.FieldName == "GioiTinh" && e.ListSourceRowIndex != DevExpress.XtraGrid.GridControl.InvalidRowHandle) { object objGioiTinh = view.GetListSourceRowCellValue(e.ListSourceRowIndex, "GioiTinh"); if (objGioiTinh != DBNull.Value) { sbyte gioiTinh = (sbyte)objGioiTinh; switch (gioiTinh) { case 0: e.DisplayText = "Nữ"; break; case 1: e.DisplayText = "Nam"; break; } } } else if (e.Column.FieldName == "ThoiHoc" && e.ListSourceRowIndex != DevExpress.XtraGrid.GridControl.InvalidRowHandle) { Object thoiHoc = view.GetListSourceRowCellValue(e.ListSourceRowIndex, "ThoiHoc"); e.DisplayText = (thoiHoc != null && thoiHoc.Equals(true)) ? "Thôi học" : "Đang học"; } else if (e.Column.FieldName == "TinhThanhPhoId" && e.ListSourceRowIndex != DevExpress.XtraGrid.GridControl.InvalidRowHandle) { object tinhId = view.GetListSourceRowCellValue(e.ListSourceRowIndex, "TinhThanhPhoId"); if (tinhId != DBNull.Value) { e.DisplayText = StaticDataUtil.GetThanhPhoById(StaticDataFacade.Get(StaticDataKeys.TinhThanhPho) as QLMamNon.Dao.QLMamNonDs.ThanhPhoDataTable, (int)tinhId); } } else if (e.Column.FieldName == "QuanHuyenId" && e.ListSourceRowIndex != DevExpress.XtraGrid.GridControl.InvalidRowHandle) { object quanHuyenId = view.GetListSourceRowCellValue(e.ListSourceRowIndex, "QuanHuyenId"); if (quanHuyenId != DBNull.Value) { e.DisplayText = StaticDataUtil.GetQuanHuyenById(StaticDataFacade.Get(StaticDataKeys.QuanHuyen) as QLMamNon.Dao.QLMamNonDs.QuanHuyenDataTable, (int)quanHuyenId); } } else if (e.Column.FieldName == "PhuongXaId" && e.ListSourceRowIndex != DevExpress.XtraGrid.GridControl.InvalidRowHandle) { object phuongXaId = view.GetListSourceRowCellValue(e.ListSourceRowIndex, "PhuongXaId"); if (phuongXaId != DBNull.Value) { e.DisplayText = StaticDataUtil.GetPhuongXaById(StaticDataFacade.Get(StaticDataKeys.PhuongXa) as QLMamNon.Dao.QLMamNonDs.PhuongXaDataTable, (int)phuongXaId); } } else if (e.Column.Caption == "NgaySinh" && e.ListSourceRowIndex != DevExpress.XtraGrid.GridControl.InvalidRowHandle && e.Value != DBNull.Value) { object ngaySinhObj = view.GetListSourceRowCellValue(e.ListSourceRowIndex, "NgaySinh"); if (ngaySinhObj != DBNull.Value) { DateTime ngaySinh = (DateTime)ngaySinhObj; e.DisplayText = ngaySinh.Day.ToString(); } } else if (e.Column.Caption == "ThangSinh" && e.ListSourceRowIndex != DevExpress.XtraGrid.GridControl.InvalidRowHandle && e.Value != DBNull.Value) { object ngaySinhObj = view.GetListSourceRowCellValue(e.ListSourceRowIndex, "NgaySinh"); if (ngaySinhObj != DBNull.Value) { DateTime ngaySinh = (DateTime)ngaySinhObj; e.DisplayText = ngaySinh.Month.ToString(); } } else if (e.Column.Caption == "NamSinh" && e.ListSourceRowIndex != DevExpress.XtraGrid.GridControl.InvalidRowHandle && e.Value != DBNull.Value) { object ngaySinhObj = view.GetListSourceRowCellValue(e.ListSourceRowIndex, "NgaySinh"); if (ngaySinhObj != DBNull.Value) { DateTime ngaySinh = (DateTime)ngaySinhObj; e.DisplayText = ngaySinh.Year.ToString(); } } }
/// <summary> /// Initializes the view. /// </summary> /// <param name="grid">The main grid.</param> /// <param name="groupingTemplateLogic">The grouping template logic.</param> /// <param name="groupingTemplatePresentation">The grouping template presentation.</param> /// <param name="columnManagers">Main view column managers.</param> public void InitializeView(Grid grid, DataTemplate groupingTemplateLogic, DataTemplate groupingTemplatePresentation, System.Collections.ObjectModel.Collection<ColumnManager> columnManagers) { this.view = new ColumnView(grid, columnManagers, groupingTemplateLogic, groupingTemplatePresentation); this.view.MainView = true; }
private Dictionary<GridColumn, bool> GetColumnVisibility(ColumnView columnView) { Dictionary<GridColumn, bool> storedVisiblity = new Dictionary<GridColumn, bool>(); foreach (GridColumn column in columnView.Columns) { storedVisiblity[column] = column.Visible; } return storedVisiblity; }
private void MSave() { if (text_M_Code.Text.Equals("")) { MessageBox.Show("중분류의 신규 버튼을 눌러주세요.", "저장 실패", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //if (te_EquipCD.Text.Equals("") && gv_Large.GetFocusedRowCellValue("대분류VOCID").ToString() == "Q") //{ // MessageBox.Show("장비코드를 입력해주세요.", "저장 실패", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; //} if (lueEquip.EditValue.ToString().Equals("") && gv_Large.GetFocusedRowCellValue("대분류VOCID").ToString() == "Q") { MessageBox.Show("장비코드를 입력해주세요.", "저장 실패", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string strLCode = text_L_Code.Text; string strMCode = text_M_Code.Text; try { Cesco.FW.Global.DBAdapter.DBAdapters dbA = new Cesco.FW.Global.DBAdapter.DBAdapters(); dbA.LocalInfo = new Cesco.FW.Global.DBAdapter.LocalInfo(_strUserID, System.Reflection.MethodBase.GetCurrentMethod()); dbA.Procedure.ProcedureName = "CESCOEIS.dbo.SP_VOC_MEDIUM_INSERT_NEW"; dbA.Procedure.ParamAdd("@VOCID", text_M_Code.Text); dbA.Procedure.ParamAdd("@PARENTID", text_L_vocid.Text); dbA.Procedure.ParamAdd("@VOCNAME", text_M_MediumName.Text); dbA.Procedure.ParamAdd("@MULTIYN", lu_M_Multi.EditValue); dbA.Procedure.ParamAdd("@USEYN", rdio_M_Usegubun.EditValue); dbA.Procedure.ParamAdd("@ORDERNO", sp_M_Num.EditValue); dbA.Procedure.ParamAdd("@SUBCLASSESSEN", lu_S_Essen.EditValue); dbA.Procedure.ParamAdd("@PROBLEMYN", chkProb_MVOC.Checked ? "Y" : "N"); dbA.Procedure.ParamAdd("@PROBLEMLV", lue_M_ProblemLv.EditValue == null ? "" : lue_M_ProblemLv.EditValue.ToString()); dbA.Procedure.ParamAdd("@EQUICODE", lueEquip.EditValue == null ? "" : lueEquip.EditValue.ToString()); dbA.Procedure.ParamAdd("@TYPECODE", lu_M_GubunCode.EditValue); dbA.Procedure.ParamAdd("@REGID", _strUserID); dbA.Procedure.ParamAdd("@KINDGB", lu_M_Kind.EditValue == null ? "" : lu_M_Kind.EditValue.ToString()); dbA.Procedure.ParamAdd("@BUGCODE", lueBugs.EditValue == null ? "" : lueBugs.EditValue.ToString()); DataSet ds = dbA.ProcedureToDataSetCompress(); MessageBox.Show("저장 완료하였습니다.", "저장 완료", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message); } MRefresh(); MNew(); //저장된 행 선택되어 있도록 ColumnView view = (ColumnView)gc_Large.FocusedView; GridColumn column = view.Columns["대분류VOCID"]; if (column != null) { int rhFound = view.LocateByValue(0, column, strLCode); if (rhFound != GridControl.InvalidRowHandle) { view.FocusedRowHandle = rhFound; } } ColumnView view2 = (ColumnView)gc_Medium.FocusedView; GridColumn column2 = view2.Columns["중분류VOCID"]; if (column2 != null) { int rhFound = view2.LocateByValue(0, column2, strMCode); if (rhFound != GridControl.InvalidRowHandle) { view2.FocusedRowHandle = rhFound; } } }
public static void LoadFilter(ColumnView view, Stream stream, string[] propertyNames) { view.RestoreLayoutFromStream(stream, null); }
private void SSave() { if (text_S_Code.Text.Equals("")) { MessageBox.Show("소분류의 신규 버튼을 눌러주세요.", "저장 실패", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string strLCode = text_L_Code.Text; string strMCode = text_M_Code.Text; string strSCode = text_S_Code.Text; try { Cesco.FW.Global.DBAdapter.DBAdapters dbA = new Cesco.FW.Global.DBAdapter.DBAdapters(); dbA.LocalInfo = new Cesco.FW.Global.DBAdapter.LocalInfo(_strUserID, System.Reflection.MethodBase.GetCurrentMethod()); dbA.Procedure.ProcedureName = "CESCOEIS.dbo.SP_VOC_SMALL_INSERT_NEW"; dbA.Procedure.ParamAdd("@VOCID", text_S_Code.Text); dbA.Procedure.ParamAdd("@PARENTID", text_M_Code.Text); dbA.Procedure.ParamAdd("@VOCNAME", text_S_SmallName.Text); dbA.Procedure.ParamAdd("@USEYN", rdio_S_Usegubun.EditValue); dbA.Procedure.ParamAdd("@ORDERNO", sp_S_Num.EditValue); dbA.Procedure.ParamAdd("@PROBLEMYN", chkProb_SVOC.Checked ? "Y" : "N"); dbA.Procedure.ParamAdd("@PROBLEMLV", lue_S_ProblemLv.EditValue == null ? "" : lue_S_ProblemLv.EditValue.ToString()); dbA.Procedure.ParamAdd("@TYPECODE", lu_S_GubunCode.EditValue == null ? "" : lu_S_GubunCode.EditValue.ToString()); dbA.Procedure.ParamAdd("@REGID", _strUserID); dbA.Procedure.ParamAdd("@KINDGB", lu_S_Kind.EditValue == null ? "" : lu_S_Kind.EditValue.ToString()); DataSet ds = dbA.ProcedureToDataSetCompress(); MessageBox.Show("저장 완료하였습니다.", "저장 완료", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message); } MRefresh(); SRefresh(); SNew(); //저장된 행 선택되어 있도록 ColumnView view = (ColumnView)gc_Large.FocusedView; GridColumn column = view.Columns["대분류VOCID"]; if (column != null) { int rhFound = view.LocateByValue(0, column, strLCode); if (rhFound != GridControl.InvalidRowHandle) { view.FocusedRowHandle = rhFound; } } ColumnView view2 = (ColumnView)gc_Medium.FocusedView; GridColumn column2 = view2.Columns["중분류VOCID"]; if (column2 != null) { int rhFound = view2.LocateByValue(0, column2, strMCode); if (rhFound != GridControl.InvalidRowHandle) { view2.FocusedRowHandle = rhFound; } } ColumnView view3 = (ColumnView)gc_Small.FocusedView; GridColumn column3 = view3.Columns["소분류VOCID"]; if (column3 != null) { int rhFound = view3.LocateByValue(0, column3, strSCode); if (rhFound != GridControl.InvalidRowHandle) { view3.FocusedRowHandle = rhFound; } } //gv_Large_FocusedRowChanged(null, null); //gv_Medium_FocusedRowChanged(null, null); //gv_Small_FocusedRowChanged(null, null); }
private IEnumerable<DXMenuItem> GetCellContextMenuItems(ColumnView targetView, GridColumn targetColumn, int targetRowHandle) { var items = new List<DXMenuItem>(); if (new[] { bandedGridColumnMondaySpot, bandedGridColumnThursdaySpot, bandedGridColumnWednesdaySpot, bandedGridColumnThursdaySpot, bandedGridColumnFridaySpot, bandedGridColumnSaturdaySpot, bandedGridColumnSundaySpot }.Any(sc => sc == targetColumn)) { var columnName = targetColumn.ToolTip; items.Add(new DXMenuItem($"Clone {columnName} to all days", (o, args) => { targetView.CloseEditor(); var valueToClone = targetView.GetRowCellValue(targetRowHandle, targetColumn); CloneSpots(targetRowHandle, valueToClone, -1, false); })); items.Add(new DXMenuItem(String.Format("Clone {0} to all Remaining days", columnName), (o, args) => { targetView.CloseEditor(); var valueToClone = targetView.GetRowCellValue(targetRowHandle, targetColumn); CloneSpots(targetRowHandle, valueToClone, targetColumn.VisibleIndex, false); })); items.Add(new DXMenuItem(String.Format("Clone {0} to every other Remaining days", columnName), (o, args) => { targetView.CloseEditor(); var valueToClone = targetView.GetRowCellValue(targetRowHandle, targetColumn); CloneSpots(targetRowHandle, valueToClone, targetColumn.VisibleIndex, true); })); items.Add(new DXMenuItem("Wipe all Spots on this line", (o, args) => CloneSpots(targetRowHandle, null, -1, false))); } else if (targetColumn == bandedGridColumnIndex || targetColumn == bandedGridColumnStation || targetColumn == bandedGridColumnDaypart || targetColumn == bandedGridColumnTime || targetColumn == bandedGridColumnLogo || targetColumn == bandedGridColumnLength || targetColumn == bandedGridColumnName) { var sourceIndex = targetView.GetDataSourceRowIndex(targetRowHandle); items.Add(new DXMenuItem("Clone this Entire Line", (o, args) => CloneItem(sourceIndex, true))); items.Add(new DXMenuItem("Clone Just this Program", (o, args) => CloneItem(sourceIndex, false))); items.Add(new DXMenuItem("Delete this Line", (o, e) => DeleteItem())); } return items; }
private static void ClearDataSource(this ColumnView view, BindingSource bindingSource, string entityName) { CancelPeddingBackgroundWorker(view, entityName); bindingSource.Clear(); view.RefreshData(); }
//窗体双击事件,VIN号的顺序取决于所查询的表 private void gcDataInfo_MouseDoubleClick(object sender, MouseEventArgs e) { GridControl gc; if (this.xtraTabControl1.SelectedTabPage.Text.Equals("待审批")) { gc = this.gcDataInfo; } else { gc = this.gcBackInfo; } if (gc == null) { return; } ColumnView cv = (ColumnView)gc.FocusedView; DataRowView dr = (DataRowView)cv.GetFocusedRow(); if (dr == null) { return; } string guid = (string)dr.Row["GUID"]; Dictionary <string, string> mapResult = QueryHelper.queryInfomationByVin(guid); if (mapResult.Count < 1) { XtraMessageBox.Show("未查到该vin对应数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Dictionary <string, string> mapRightData = new Dictionary <string, string>(); if (!dr.Row["DCDTXX_XH_GG"].Equals(DBNull.Value)) { mapRightData.Add("DCDTXX_XH", dr.Row["DCDTXX_XH_GG"].ToString()); } if (!dr.Row["DCDTXX_SCQY_GG"].Equals(DBNull.Value)) { mapRightData.Add("DCDTXX_SCQY", dr.Row["DCDTXX_SCQY_GG"].ToString()); } if (!dr.Row["DCZXX_XH_GG"].Equals(DBNull.Value)) { mapRightData.Add("DCZXX_XH", dr.Row["DCZXX_XH_GG"].ToString()); } if (!dr.Row["DCZXX_ZRL_GG"].Equals(DBNull.Value)) { mapRightData.Add("DCZXX_ZRL", dr.Row["DCZXX_ZRL_GG"].ToString()); } if (!dr.Row["DCZXX_SCQY_GG"].Equals(DBNull.Value)) { mapRightData.Add("DCZXX_SCQY", dr.Row["DCZXX_SCQY_GG"].ToString()); } if (!dr.Row["QDDJXX_XH_1_GG"].Equals(DBNull.Value)) { mapRightData.Add("QDDJXX_XH_1", dr.Row["QDDJXX_XH_1_GG"].ToString()); } if (!dr.Row["QDDJXX_EDGL_1_GG"].Equals(DBNull.Value)) { mapRightData.Add("QDDJXX_EDGL_1", dr.Row["QDDJXX_EDGL_1_GG"].ToString()); } if (!dr.Row["QDDJXX_SCQY_1_GG"].Equals(DBNull.Value)) { mapRightData.Add("QDDJXX_SCQY_1", dr.Row["QDDJXX_SCQY_1_GG"].ToString()); } if (!dr.Row["RLDCXX_XH_GG"].Equals(DBNull.Value)) { mapRightData.Add("RLDCXX_XH", dr.Row["RLDCXX_XH_GG"].ToString()); } if (!dr.Row["RLDCXX_EDGL_GG"].Equals(DBNull.Value)) { mapRightData.Add("RLDCXX_EDGL", dr.Row["RLDCXX_EDGL_GG"].ToString()); } if (!dr.Row["RLDCXX_SCQY_GG"].Equals(DBNull.Value)) { mapRightData.Add("RLDCXX_SCQY", dr.Row["RLDCXX_SCQY_GG"].ToString()); } if (Convert.ToDecimal(dr.Row["LJXSLC"]) < 30000) { mapRightData.Add("LJXSLC", "累计续驶里程小于3万公里"); } using (var dlg = new SingleInfoForm(mapResult, mapRightData)) { dlg.ShowDialog(); if (dlg.DialogResult == DialogResult.OK) { this.refrashCurrentPage(); } } }
public static DataServiceQuery CreateQuery(this ColumnView view, string entityName, CriteriaOperator commonFilter, Dictionary <string, string> properties) { return(CreateQuery(entityName, commonFilter, properties)); }
public void CopyQuote() { ColumnView view = gridControl.MainView as ColumnView; int r = view.GetSelectedRows()[0]; QuoteNumber = view.GetRowCellValue(r, "QuoteNumber").ToString(); if (view.GetRowCellValue(r, "EEIPartNumber") != null) { EEIPartNumber = view.GetRowCellValue(r, "EEIPartNumber").ToString(); } if (view.GetRowCellValue(r, "Customer") != null) { Customer = view.GetRowCellValue(r, "Customer").ToString(); } if (view.GetRowCellValue(r, "ReceiptDate") != null) { ReceiptDate = view.GetRowCellValue(r, "ReceiptDate").ToString(); } if (view.GetRowCellValue(r, "CustomerPartNumber") != null) { CustomerPartNumber = view.GetRowCellValue(r, "CustomerPartNumber").ToString(); } if (view.GetRowCellValue(r, "RequestedDueDate") != null) { RequestedDueDate = view.GetRowCellValue(r, "RequestedDueDate").ToString(); } if (view.GetRowCellValue(r, "EAU") != null) { EAU = view.GetRowCellValue(r, "EAU").ToString(); } if (view.GetRowCellValue(r, "EEIPromisedDueDate") != null) { EEIPromisedDueDate = view.GetRowCellValue(r, "EEIPromisedDueDate").ToString(); } if (view.GetRowCellValue(r, "ApplicationName") != null) { ApplicationName = view.GetRowCellValue(r, "ApplicationName").ToString(); } if (view.GetRowCellValue(r, "ProgramManagerInitials") != null) { ProgramManager = view.GetRowCellValue(r, "ProgramManagerInitials").ToString(); } if (view.GetRowCellValue(r, "CustomerQuoteInitials") != null) { EndUser = view.GetRowCellValue(r, "CustomerQuoteInitials").ToString(); } if (view.GetRowCellValue(r, "EngineeringInitials") != null) { ProductEngineer = view.GetRowCellValue(r, "EngineeringInitials").ToString(); } if (view.GetRowCellValue(r, "ModelYear") != null) { ModelYear = view.GetRowCellValue(r, "ModelYear").ToString(); } if (view.GetRowCellValue(r, "SalesInitials") != null) { Salesman = view.GetRowCellValue(r, "SalesInitials").ToString(); } if (view.GetRowCellValue(r, "Program") != null) { Program = view.GetRowCellValue(r, "Program").ToString(); } if (view.GetRowCellValue(r, "CustomerRFQNumber") != null) { CustomerRFQNumber = view.GetRowCellValue(r, "CustomerRFQNumber").ToString(); } if (view.GetRowCellValue(r, "Nameplate") != null) { Nameplate = view.GetRowCellValue(r, "Nameplate").ToString(); } //if (view.GetRowCellValue(r, "Target") != null) Target = view.GetRowCellValue(r, "Target").ToString(); if (view.GetRowCellValue(r, "Requote") != null) { Requote = view.GetRowCellValue(r, "Requote").ToString(); } if (view.GetRowCellValue(r, "Notes") != null) { Notes = view.GetRowCellValue(r, "Notes").ToString(); } if (view.GetRowCellValue(r, "QuotePrice") != null) { QuotePrice = view.GetRowCellValue(r, "QuotePrice").ToString(); } }
public void SetUpGrid(GridControl grid) { ColumnView view = grid.MainView as ColumnView; view.OptionsBehavior.Editable = false; }
private void btnGuardar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //ValidarDatos if (!ValidarDatos()) { return; } if (currentRow != null) { lblStatus.Caption = "Actualizando : " + currentRow["Descr"].ToString(); Application.DoEvents(); currentRow.BeginEdit(); currentRow["Descr"] = this.txtDescr.EditValue; currentRow["Tipo"] = this.txtTipo.EditValue; currentRow["Activo"] = this.chkActivo.EditValue; currentRow.EndEdit(); DataSet _dsChanged = _dsTipoDocumento.GetChanges(DataRowState.Modified); bool okFlag = true; if (_dsChanged.HasErrors) { okFlag = false; string msg = "Error en la fila con el tipo Id"; foreach (DataTable tb in _dsChanged.Tables) { if (tb.HasErrors) { DataRow[] errosRow = tb.GetErrors(); foreach (DataRow dr in errosRow) { msg = msg + dr["IDTipo"].ToString(); } } } lblStatus.Caption = msg; } //Si no hay errores if (okFlag) { TipoDocumentoDAC.oAdaptador.Update(_dsChanged, "Data"); lblStatus.Caption = "Actualizado " + currentRow["Descr"].ToString(); Application.DoEvents(); isEdition = false; _dsTipoDocumento.AcceptChanges(); PopulateGrid(); SetCurrentRow(); HabilitarControles(false); AplicarPrivilegios(); } else { _dsTipoDocumento.RejectChanges(); } } else { //nuevo registro currentRow = _dtTipoDocumento.NewRow(); currentRow["Descr"] = this.txtDescr.Text; currentRow["Tipo"] = this.txtTipo.EditValue; currentRow["Activo"] = this.chkActivo.EditValue; _dtTipoDocumento.Rows.Add(currentRow); try { TipoDocumentoDAC.oAdaptador.Update(_dsTipoDocumento, "Data"); _dsTipoDocumento.AcceptChanges(); isEdition = false; lblStatus.Caption = "Se ha ingresado un nuevo registro"; Application.DoEvents(); PopulateGrid(); SetCurrentRow(); HabilitarControles(false); AplicarPrivilegios(); ColumnView view = this.gridView1; view.MoveLast(); } catch (System.Data.SqlClient.SqlException ex) { _dsTipoDocumento.RejectChanges(); currentRow = null; MessageBox.Show(ex.Message); } } }
/// <summary> ///通用 重新设置实体 /// /// </summary> public override void gridViewRowChanged1(object sender) { try { this.BaseFocusLabel.Focus(); ColumnView view = sender as ColumnView; string WHID = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "WHID")); string SBitID = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "SBitID")); string ItemCode = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "ItemCode")); string ColorNum = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "ColorNum")); string ColorName = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "ColorName")); string Batch = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "Batch")); string VendorBatch = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "VendorBatch")); string VendorID = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "VendorID")); string SectionID = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "SectionID")); string JarNum = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "JarNum")); string DtsSO = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "SO")); string ItemUnit = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "Unit")); string MWidth = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "MWidth")); string MWeight = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "MWeight")); string OrderFormNo = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "OrderFormNo")); #region 查找仓库结算类型 string sql = "SELECT FieldName FROM UV1_WH_WH WHERE WHID=" + SysString.ToDBString(WHID);//获得仓库结算类型字段 DataTable dt = SysUtils.Fill(sql); string FieldNamestr = string.Empty; if (dt.Rows.Count != 0) { FieldNamestr += SysConvert.ToString(dt.Rows[0]["FieldName"]); } #endregion sql = "SELECT * FROM UV1_WH_PackBox WHERE 1=1"; sql += " AND WHID=" + SysString.ToDBString(WHID); sql += " AND SectionID=" + SysString.ToDBString(SectionID); sql += " AND SBitID=" + SysString.ToDBString(SBitID); int CalFieldName = (int)WHCalMethodFieldName.ItemCode; if (FieldNamestr != string.Empty) { string[] FieldName = FieldNamestr.Split('+'); for (int i = 0; i < FieldName.Length; i++) { string sqlFieldName = "SELECT ID FROM Enum_WHCalMethodFieldName WHERE Name=" + SysString.ToDBString(FieldName[i]);//找到库存结算字段对应的ID DataTable dtFieldName = SysUtils.Fill(sqlFieldName); if (dtFieldName.Rows.Count != 0 && dtFieldName.Rows[0]["ID"].ToString() != "") { CalFieldName = SysConvert.ToInt32(dtFieldName.Rows[0]["ID"]); } switch (CalFieldName) { case (int)WHCalMethodFieldName.ItemCode: //产品编码 sql += " AND ISNULL(ItemCode,'')=" + SysString.ToDBString(ItemCode); break; case (int)WHCalMethodFieldName.ColorNum: //色号 sql += " AND ISNULL(ColorNum,'')=" + SysString.ToDBString(ColorNum); break; case (int)WHCalMethodFieldName.ColorName: //颜色 sql += " AND ISNULL(ColorName,'')=" + SysString.ToDBString(ColorName); break; case (int)WHCalMethodFieldName.Batch: //批号 sql += " AND ISNULL(Batch,'')=" + SysString.ToDBString(Batch); break; case (int)WHCalMethodFieldName.VendorBatch: //客户批号 sql += " AND ISNULL(VendorBatch,'')=" + SysString.ToDBString(VendorBatch); break; case (int)WHCalMethodFieldName.VendorID: //客户 sql += " AND ISNULL(DtsVendorID,'')=" + SysString.ToDBString(VendorID); break; case (int)WHCalMethodFieldName.JarNum: //缸号 sql += " AND ISNULL(JarNum,'')=" + SysString.ToDBString(JarNum); break; case (int)WHCalMethodFieldName.MWidth: //门幅 sql += " AND ISNULL(MWidth,'')=" + SysString.ToDBString(MWidth); break; case (int)WHCalMethodFieldName.MWeight: //克重 sql += " AND ISNULL(MWeight,'')=" + SysString.ToDBString(MWeight); break; case (int)WHCalMethodFieldName.DtsOrderFormNo: //克重 sql += " AND ISNULL(OrderFormNo,'')=" + SysString.ToDBString(OrderFormNo); break; default: throw new Exception("结算异常,结算定义的字段底层未对应:" + CalFieldName + ",请联系管理员"); } } } sql += " AND BoxStatusID=" + SysString.ToDBString((int)EnumBoxStatus.入库); sql += " AND (ISNULL(Qty,0)>0 OR ISNULL(Weight,0)>0 OR ISNULL(Yard,0)>0)"; DataTable dt1 = SysUtils.Fill(sql); gridView2.GridControl.DataSource = dt1; gridView2.GridControl.Show(); gridView2.Columns["ReHandle"].OptionsColumn.AllowEdit = true; gridView2.Columns["ReHandle"].OptionsColumn.ReadOnly = false; gridView2.Columns["SplitColor"].OptionsColumn.AllowEdit = true; gridView2.Columns["SplitColor"].OptionsColumn.ReadOnly = false; gridView2.Columns["MiddleDiff"].OptionsColumn.AllowEdit = true; gridView2.Columns["MiddleDiff"].OptionsColumn.ReadOnly = false; gridView2.Columns["HeadTailDiff"].OptionsColumn.AllowEdit = true; gridView2.Columns["HeadTailDiff"].OptionsColumn.ReadOnly = false; } catch (Exception E) { this.ShowMessage(E.Message); } }
private void gcBudget_EmbeddedNavigator_ButtonClick(object sender, DevExpress.XtraEditors.NavigatorButtonClickEventArgs e) { //Append Button is Click if (e.Button.ButtonType == NavigatorButtonType.Append) { try { //Save the latest changes to the bound DataTable ColumnView View = (ColumnView)gcBudget.FocusedView; if (!(View.PostEditor() && View.UpdateCurrentRow())) { return; } this.tblBudgetTableAdapter.Update(this.dsBudget.tblBudget); } catch (Exception ex) { MessageBox.Show(ex.Message + " " + ex.StackTrace); throw; } } //Remove cell from Grid view if (e.Button.ButtonType == NavigatorButtonType.Remove) { if (MessageBox.Show("Do You Want To Delete This Record ? ", "Confirm Delete", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { e.Handled = true; } try { //Delete Selected Rows that is bound DataTable ColumnView ViewDel = (ColumnView)gcBudget.FocusedView; ViewDel.DeleteSelectedRows(); return; this.tblBudgetTableAdapter.Update(this.dsBudget.tblBudget); } catch (Exception ex) { MessageBox.Show(ex.Message + " " + ex.StackTrace); throw; } } //Update Change made to the Grid if (e.Button.ButtonType == NavigatorButtonType.EndEdit) { try { //Update the latest changes to the bound DataTable ColumnView View1 = (ColumnView)gcBudget.FocusedView; if (!(View1.PostEditor() && View1.UpdateCurrentRow())) { return; } this.tblBudgetTableAdapter.Update(this.dsBudget.tblBudget); } catch (Exception ex) { MessageBox.Show(ex.Message + " " + ex.StackTrace); throw; } } }
void gridViewRowChanged3(object sender) { ColumnView view = sender as ColumnView; saveHTDtsID = SysConvert.ToInt32(view.GetRowCellValue(view.FocusedRowHandle, view.Columns["ID"])); }
public static void AddDynamicColumns(ColumnView gridView, IDynamicPropertyList propertyList, ESortBy sortBy) { AddDynamicColumns(gridView, propertyList, sortBy, ESortDirection.Ascending, null, null, true); }
private Dictionary<GridColumn, int> GetVisibleIndices(ColumnView columnView) { Dictionary<GridColumn, int> storedVisibleIndices = new Dictionary<GridColumn, int>(); foreach (GridColumn column in columnView.Columns) { if (column.VisibleIndex > -1) storedVisibleIndices[column] = column.VisibleIndex; } return storedVisibleIndices; }
public static void AddDynamicColumns(ColumnView gridView, IDynamicPropertyList propertyList, IComparer <IDynamicProperty> comparer, string nullText) { AddDynamicColumns(gridView, propertyList, ESortBy.Custom, ESortDirection.None, nullText, comparer, true); }
protected override void GridView_ValidateRow(object sender, ValidateRowEventArgs e) { base.GridView_ValidateRow(sender, e); ColumnView view = sender as ColumnView; }
void UpdateMainView(ColumnView view) { bool isGrid = view is GridView; gidControlUserManage.MainView = view; splitterItem1.Visibility = isGrid ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never; GridHelper.SetFindControlImages(gidControlUserManage); UpdateActionButtons(); }
private IEnumerable<DXMenuItem> GetCellContextMenuItems(ColumnView targetView, int targetRowHandle) { var items = new List<DXMenuItem>(); var sourceIndex = targetView.GetDataSourceRowIndex(targetRowHandle); items.Add(new DXMenuItem("Clone this Line", (o, args) => CloneItem(sourceIndex))); items.Add(new DXMenuItem("Delete this Line", (o, e) => DeleteItem())); return items; }
private void RefreshQuestionView() { if (gridControlQuestion.Visible) { var listResult = EvaluateQuestionBusiness.Instance.GetEvaluateQuestions(); gridControlQuestion.DataSource = listResult; gridControlQuestion.DefaultView.RefreshData(); defaultGridView = gridControlQuestion.DefaultView as ColumnView; this.btnUpdate.Enabled = this.btnDelete.Enabled = listResult.Count > 0; } }
public void SaveUserViewLayout(ColumnView view) { try { var fs = new MemoryStream(); GridLayoutSerializer.SaveLayout(view, fs); byte[] s = fs.ToArray(); string str = Encoding.UTF8.GetString(s); SaveLayout(str.Remove(0, 1)); } catch { } }
public override void Search_Setting() { var StateSetting = Ewatch_MySqlMethod.StateLoad(); gridControl1.DataSource = StateSetting; if (!Flag) { gridView1.OptionsBehavior.Editable = false; //不允取編輯 gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; //不允許欄位聚焦 gridView1.OptionsFind.FindMode = FindMode.FindClick; //搜尋需要點擊 Find或Enter for (int i = 0; i < gridView1.Columns.Count; i++) { gridView1.Columns[i].BestFit(); } RepositoryItemToggleSwitch toggleSwitch = new RepositoryItemToggleSwitch(); gridControl1.RepositoryItems.Add(toggleSwitch); gridView1.Columns["PK"].Visible = false; gridView1.Columns["NotifyFlag"].ColumnEdit = toggleSwitch; gridView1.Columns["CaseNo"].Caption = "案場編號"; gridView1.Columns["StateNo"].Caption = "狀態編號"; gridView1.Columns["StateName"].Caption = "狀態名稱"; gridView1.Columns["NotifyFlag"].Caption = "推播功能"; gridView1.Columns["StateFlag"].Caption = "狀態類型"; gridView1.Columns["StateHigh"].Caption = "狀態高位元"; gridView1.Columns["StateLow"].Caption = "狀態低位元"; gridView1.Columns["LastStateFlag"].Visible = false; #region DI/O狀態顯示 gridView1.CustomColumnDisplayText += (s, e) => { if (e.Column.FieldName == "StateFlag") { string valueCell = e.DisplayText.ToString(); if (valueCell == "0") { e.DisplayText = "DI狀態"; } else if (valueCell == "1") { e.DisplayText = "DO狀態"; } } }; #endregion #region 報表行聚焦 gridView1.FocusedRowChanged += (s, ex) => { ColumnView view = (ColumnView)s; if ((view.FindFilterText == "" || view.ActiveFilterString != "") & !SortGlyphFlag) { if (ex.FocusedRowHandle > -1) { CaseNotextEdit.Text = view.GetListSourceRowCellValue(ex.FocusedRowHandle, "CaseNo").ToString(); StateNotextEdit.Text = view.GetListSourceRowCellValue(ex.FocusedRowHandle, "StateNo").ToString(); StateNametextEdit.Text = view.GetListSourceRowCellValue(ex.FocusedRowHandle, "StateName").ToString(); NotifyFlagtoggleSwitch.IsOn = Convert.ToBoolean(view.GetListSourceRowCellValue(ex.FocusedRowHandle, "NotifyFlag")); StateFlagcomboBoxEdit.SelectedIndex = Convert.ToInt32(view.GetListSourceRowCellValue(ex.FocusedRowHandle, "StateFlag")); StateHightextEdit.Text = view.GetListSourceRowCellValue(ex.FocusedRowHandle, "StateHigh").ToString(); StateLowtextEdit.Text = view.GetListSourceRowCellValue(ex.FocusedRowHandle, "StateLow").ToString(); } } else { if (ex.FocusedRowHandle > -1) { if (FilterStateSetting.Count > 0 && FilterStateSetting.Count > ex.FocusedRowHandle) { CaseNotextEdit.Text = FilterStateSetting[ex.FocusedRowHandle].CaseNo; StateNotextEdit.Text = FilterStateSetting[ex.FocusedRowHandle].StateNo.ToString(); StateNametextEdit.Text = FilterStateSetting[ex.FocusedRowHandle].StateName; NotifyFlagtoggleSwitch.IsOn = FilterStateSetting[ex.FocusedRowHandle].NotifyFlag; StateFlagcomboBoxEdit.SelectedIndex = FilterStateSetting[ex.FocusedRowHandle].StateFlag; StateHightextEdit.Text = FilterStateSetting[ex.FocusedRowHandle].StateHigh; StateLowtextEdit.Text = FilterStateSetting[ex.FocusedRowHandle].StateLow; } } } }; #endregion #region 報表行刪除 gridView1.RowDeleting += (s, ex) => { ColumnView view = (ColumnView)s; string CaseNo = CaseNotextEdit.Text; int StateNo = Convert.ToInt32(StateNotextEdit.Text); Ewatch_MySqlMethod.Delete_StateSetting(CaseNo, StateNo); }; #endregion #region 關鍵字搜尋 gridView1.ColumnFilterChanged += (s, e) => { GridView view = s as GridView; if (view.FindFilterText != "" || view.ActiveFilterString != "") { FilterStateSetting = new List <StateSetting>(); for (int i = 0; i < view.RowCount; i++) { if (view.IsGroupRow(i)) { continue; } var entity = view.GetRow(i) as StateSetting; if (entity == null) { continue; } FilterStateSetting.Add(entity); } } if (FilterStateSetting.Count > 0) { CaseNotextEdit.Text = FilterStateSetting[0].CaseNo; StateNotextEdit.Text = FilterStateSetting[0].StateNo.ToString(); StateNametextEdit.Text = FilterStateSetting[0].StateName; NotifyFlagtoggleSwitch.IsOn = FilterStateSetting[0].NotifyFlag; StateFlagcomboBoxEdit.SelectedIndex = FilterStateSetting[0].StateFlag; StateHightextEdit.Text = FilterStateSetting[0].StateHigh; StateLowtextEdit.Text = FilterStateSetting[0].StateLow; } }; #endregion #region 表頭篩選 gridView1.EndSorting += (s, e) => { GridView view = s as GridView; FilterStateSetting = new List <StateSetting>(); for (int i = 0; i < view.RowCount; i++) { if (view.IsGroupRow(i)) { continue; } var entity = view.GetRow(i) as StateSetting; if (entity == null) { continue; } FilterStateSetting.Add(entity); } SortGlyphFlag = true; gridView1.FocusedRowHandle = 0; }; #endregion gridView1.FocusedRowHandle = 1; Flag = true; } else { gridControl1.Refresh(); } }
private void defaultGridView_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e) { defaultGridView = sender as ColumnView; if (defaultGridView != null) { if (defaultGridView.IsRowSelected(e.ControllerRow)) { defaultGridView.SelectRow(e.ControllerRow); } //ButtonUpdate.Enabled = GridDefaultView.SelectedRowsCount > 0; } }
public MyGridColumnCollection(ColumnView view) : base(view) { }
public static void LoadFilter(ColumnView view, string file, string[] propertyNames) { view.RestoreLayoutFromXml(file, null); }
private object GetRowKey(ColumnView view, int rowHandle) { return(view.GetRowCellValue(rowHandle, "CustomerID")); }
protected internal override void ButtonClick(string tag) { switch (tag) { case TagResources.ContactList: UpdateMainView(gridView1); ClearSortingAndGrouping(); break; case TagResources.ContactAlphabetical: UpdateMainView(gridView1); ClearSortingAndGrouping(); colName.Group(); break; case TagResources.ContactByState: UpdateMainView(gridView1); ClearSortingAndGrouping(); colState.Group(); colCity.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending; break; case TagResources.ContactCard: UpdateMainView(layoutView1); break; case TagResources.FlipLayout: layoutControl1.Root.FlipLayout(); break; case TagResources.ContactDelete: if (CurrentContact == null) { return; } int index = gridView1.FocusedRowHandle; gridControl1.MainView.BeginDataUpdate(); try { DataHelper.Contacts.Remove(CurrentContact); } finally { gridControl1.MainView.EndDataUpdate(); } if (index > gridView1.DataRowCount - 1) { index--; } gridView1.FocusedRowHandle = index; ShowInfo(gridView1); break; case TagResources.ContactNew: Contact contact = new Contact(); if (EditContact(contact) == DialogResult.OK) { gridControl1.MainView.BeginDataUpdate(); try { DataHelper.Contacts.Add(contact); } finally { gridControl1.MainView.EndDataUpdate(); } ColumnView view = gridControl1.MainView as ColumnView; if (view != null) { GridHelper.GridViewFocusObject(view, contact); ShowInfo(view); } } break; case TagResources.ContactEdit: EditContact(CurrentContact); break; } UpdateCurrentContact(); }
internal void ShowInfo(ColumnView view) { if (OwnerForm == null) return; OwnerForm.ShowInfo(view.DataRowCount); }
private void GridControl_ColumnPositionChanged(object sender, EventArgs e) { try { ColumnView gView = this.grdQrySummary.MainView as ColumnView; string expressionPCS = string.Empty; string expressionBOX = string.Empty; //GridView gView = (GridView)this.grdQrySummary.MainView; foreach (GridColumn column in gView.VisibleColumns) { switch (column.FieldName) { case "ALLOC_QTY": expressionPCS += "ALLOC_QTY+"; break; case "FREE_QTY": expressionPCS += "FREE_QTY+"; break; case "ALLOC_BOX": expressionBOX += "ALLOC_BOX+"; break; case "FREE_BOX": expressionBOX += "FREE_BOX+"; break; default: break; } } if (!string.IsNullOrEmpty(expressionPCS)) { expressionPCS = expressionPCS.Substring(0, expressionPCS.LastIndexOf("+")); if (this.dtbStockAsOn.Columns.IndexOf("TOTAL_QTY") == -1) { this.dtbStockAsOn.Columns.Add("TOTAL_QTY", typeof(int), expressionPCS); } else { this.dtbStockAsOn.Columns["TOTAL_QTY"].Expression = expressionPCS; } } if (!string.IsNullOrEmpty(expressionBOX)) { expressionBOX = expressionBOX.Substring(0, expressionBOX.LastIndexOf("+")); if (this.dtbStockAsOn.Columns.IndexOf("TOTAL_BOX") == -1) { this.dtbStockAsOn.Columns.Add("TOTAL_BOX", typeof(int), expressionBOX); } else { this.dtbStockAsOn.Columns["TOTAL_BOX"].Expression = expressionBOX; } } this.grdQrySummary.DataSource = this.dtbStockAsOn; gView.RefreshData(); } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void RefreshLevelView() { if (gridControlLevel.Visible) { var listResult = PurposeLevelBusiness.Instance.GetPurposeLevels(); gridControlLevel.DataSource = listResult; gridControlLevel.DefaultView.RefreshData(); defaultGridView = gridControlLevel.DefaultView as ColumnView; this.btnUpdate.Enabled = this.btnDelete.Enabled = listResult.Count > 0; } }