/// <summary> /// 通过单据状态绘制 行的状态。 /// </summary> /// <param name="parentForm"></param> /// <param name="gridView"></param> /// <param name="e"></param> public static void CustomDrawRowStyleByDocState(IViewGridForm parentForm, DevExpress.XtraGrid.Views.Grid.GridView gridView, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) { if (e.RowHandle < 0) { return; } object entity = gridView.GetRow(e.RowHandle); //在新增对象又关闭新增的情况下,虽然rowHandle还存在,但是由于对象已经被取消,数据源中为NULL if (entity == null) { return; } bool exists = MB.WinBase.UIDataEditHelper.Instance.CheckExistsDocState(entity); if (!exists) { return; } var v = MB.WinBase.UIDataEditHelper.Instance.GetEntityDocState(entity); if (v == MB.Util.Model.DocState.Progress) { if (!gridView.IsRowSelected(e.RowHandle)) { e.Appearance.ForeColor = Color.Blue; } } }
private void outputToExcel(IViewGridForm activeForm) { int re = activeForm.DataExport(); if (re != 0) { return; } object mainGrid = activeForm.GetCurrentMainGridView(false); DevExpress.XtraGrid.GridControl grdCtl = mainGrid as DevExpress.XtraGrid.GridControl; if (grdCtl != null) { MB.XWinLib.XtraGrid.XtraGridHelper.Instance.ExportToExcelAndShow(grdCtl); } else { DevExpress.XtraPivotGrid.PivotGridControl pivGrid = mainGrid as DevExpress.XtraPivotGrid.PivotGridControl; if (pivGrid != null) { MB.XWinLib.PivotGrid.PivotGridHelper.Instance.ExportToExcelAndShow(pivGrid); } } }
//从对象浏览窗口的角度执行相应的Command. private int execViewFormCommand(IViewGridForm activeForm, CommandID cmdID) { if (activeForm == null) { return(0); } if (object.Equals(cmdID, UICommand.UICommands.AddNew)) { return(activeForm.AddNew()); } if (object.Equals(cmdID, UICommand.UICommands.Save)) { return(activeForm.Save()); } else if (object.Equals(cmdID, UICommand.UICommands.Open)) { return(activeForm.Open()); } else if (object.Equals(cmdID, UICommand.UICommands.Copy)) { return(activeForm.CopyAsNew()); } else if (object.Equals(cmdID, UICommand.UICommands.Delete)) { return(activeForm.Delete()); } else if (object.Equals(cmdID, UICommand.UICommands.Query)) { return(activeForm.Query()); } else if (object.Equals(cmdID, UICommand.UICommands.Refresh)) { return(activeForm.Refresh()); } else if (object.Equals(cmdID, UICommand.UICommands.DataExport)) { outputToExcel(activeForm); return(1); } else if (object.Equals(cmdID, UICommand.UICommands.DataImport)) { return(activeForm.DataImport()); } else if (object.Equals(cmdID, UICommand.UICommands.PrintPreview)) { showPrintPreview(activeForm); return(1); } else { MB.Util.TraceEx.Assert(false, string.Format("对CommandID:{0} 还没有实现相应的代码!", cmdID.ToString())); } return(0); }
private void showPrintPreview(IViewGridForm activeForm) { object mainGrid = activeForm.GetCurrentMainGridView(false); DevExpress.XtraGrid.GridControl grdCtl = mainGrid as DevExpress.XtraGrid.GridControl; if (grdCtl != null) { grdCtl.ShowPrintPreview(); } else { DevExpress.XtraPivotGrid.PivotGridControl pivGrid = mainGrid as DevExpress.XtraPivotGrid.PivotGridControl; if (pivGrid != null) { pivGrid.ShowPrintPreview(); } } }
/// <summary> /// 创建高级查询控件。 /// </summary> /// <param name="viewGridForm"></param> public void IniLoadFilterControl(IViewGridForm viewGridForm) { IniLoadFilterControl(viewGridForm.ClientRuleObject, viewGridForm.GetCurrentMainGridView(true) as DevExpress.XtraGrid.GridControl); }
/// <summary> /// 显示数据导入处理窗口。 /// </summary> /// <returns></returns> public virtual bool ShowDataImport(IViewGridForm viewGridForm, MB.WinBase.Binding.BindingSourceEx bindingSource) { return(false); }