//public static void 自动凭证应付对账单生成费用(ArchiveOperationForm masterForm) //{ // IControlManager<业务费用> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager // as IControlManager<业务费用>; // IList<费用> list = new List<费用>(); // foreach (业务费用 item in detailCm.DisplayManagerT.Entities) // { // list.Add(item.Clone() as 业务费用); // } // ArchiveOperationForm masterFormKj = TabbedMdiForm.ShowMenuFormInMdi("凭证_会计付款") as ArchiveOperationForm; // if (masterFormKj != null) // { // if (masterFormKj.DoAdd()) // { // IControlManager<凭证费用明细> detailCmKj = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>; // IBaseDao masterDao = ((IArchiveGrid)masterFormKj.ActiveGrid).Bll as IBaseDao; // MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>; // MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>; // (masterFormKj.DisplayManager.CurrentItem as 凭证).自动手工标志 = 自动手工标志.对账单; // process_pz.AddFees(masterFormKj.DisplayManager.CurrentItem as 凭证, list, detailCmKj, memoryBll, memoryBll2); // //frm_cw_fkpz_kj_detail detailFormTo = form.ArchiveDetailForm as frm_cw_fkpz_kj_detail; // detailCmKj.DisplayManager.DataControls["金额.数额"].SelectedDataValue = detailForm.ControlManager.DisplayManager.DataControls["凭证金额"].SelectedDataValue; // detailCmKj.DisplayManager.DataControls["金额.币制编号"].SelectedDataValue = detailForm.ControlManager.DisplayManager.DataControls["凭证币制编号"].SelectedDataValue; // } // } //} public static void 择应付对账单费用(ArchiveOperationForm masterForm) { if (masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue == null) { MessageForm.ShowError("请先填写相关人编号!"); return; } masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].ReadOnly = true; EntityScript.SetPropertyValue(masterForm.DisplayManager.CurrentItem, "相关人编号", masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue); Dictionary <string, object> dict = new Dictionary <string, object>(); dict["相关人编号"] = masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue; ArchiveCheckForm form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_应付对账单_费用", dict); if (form != null) { IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager; using (var rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <业务费用>()) { foreach (object i in form.SelectedEntites) { 业务费用 item = i as 业务费用; item.对账单 = masterForm.DisplayManager.CurrentItem as 对账单; detailCm.AddNew(); detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = item; detailCm.EndEdit(); } } } }
public static T ConvertTypeFromRealToWS <T>(object i) where T : class, new() { T item = Feng.Utils.ReflectionHelper.CreateInstanceFromType(typeof(T)) as T; foreach (var p in typeof(T).GetProperties()) { object value = EntityScript.GetPropertyValue(i, p.Name); if (value != null) { Type propertyType = value.GetType(); if (propertyType.IsValueType || propertyType == typeof(string) || propertyType.IsEnum) { } else if (propertyType.GetInterface("IEnumerable") != null) // Collections { continue; } else { value = value.ToString(); } } EntityScript.SetPropertyValue(item, p.Name, value); } return(item); }
/// <returns>An enumeration of the (id, item) pairs. Returns null if no items are present</returns> protected virtual List <T> OnGetItems() { if (string.IsNullOrEmpty(m_winTabName)) { m_winTabName = Feng.Server.Utils.ServiceHelper.GetWindowTabNameFromAddress(WebOperationContext.Current.IncomingRequest.UriTemplateMatch.BaseUri.LocalPath); } var r = DataSearchViewService.InternalGetItems(m_winTabName, WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters); if (r == null) { return(null); } List <T> items = new List <T>(); foreach (Dictionary <string, object> i in r) { T item = Feng.Utils.ReflectionHelper.CreateInstanceFromType(typeof(T)) as T; foreach (KeyValuePair <string, object> kvp in i) { EntityScript.SetPropertyValue(item, kvp.Key, kvp.Value); } items.Add(item); } return(items); }
/// <summary> /// SaveRowValues /// </summary> /// <param name="row"></param> /// <param name="grid"></param> public static void SaveRowValues(Xceed.Grid.CellRow row, IArchiveGrid grid) { if (row is InsertionRow) { grid.ControlManager.AddNew(); row.Tag = grid.ControlManager.DisplayManager.CurrentItem; grid.AddThrowInsertRow = true; } else { grid.ControlManager.EditCurrent(); // when insert, dataRow endingedit event will occur also row.Tag = grid.ControlManager.DisplayManager.CurrentItem; } try { foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(grid.GridName)) { if (row.Cells[info.GridColumnName] != null && !string.IsNullOrEmpty(info.PropertyName)) { if (info.GridColumnType == GridColumnType.Normal) { if (row.Cells[info.GridColumnName].ReadOnly) { continue; } if (info.GridColumnType == GridColumnType.Normal) { EntityScript.SetPropertyValue(grid.ControlManager.DisplayManager.CurrentItem, info.Navigator, info.PropertyName, row.Cells[info.GridColumnName].Value); } else if (info.GridColumnType == GridColumnType.ExpressionColumn) { Script.ExecuteStatement(info.Navigator, new Dictionary <string, object> { { "entity", grid.ControlManager.DisplayManager.CurrentItem }, { "cm", grid.ControlManager } }); } } } } } catch (Exception ex) { ExceptionProcess.ProcessWithNotify(ex); throw; } grid.ControlManager.EndEdit(true); grid.AddThrowInsertRow = false; grid.ArchiveGridHelper.ClearError(row); }
public static void 择出口应收对账单费用(ArchiveOperationForm masterForm) { if (masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].SelectedDataValue == null) { MessageForm.ShowError("请先填写费用项编号!"); return; } if (masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue == null) { MessageForm.ShowError("请先填写相关人编号!"); return; } masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].ReadOnly = true; masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].ReadOnly = true; EntityScript.SetPropertyValue(masterForm.DisplayManager.CurrentItem, "费用项编号", masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].SelectedDataValue); EntityScript.SetPropertyValue(masterForm.DisplayManager.CurrentItem, "相关人编号", masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue); string type = (string)masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].SelectedDataValue; ArchiveCheckForm form = null; Dictionary <string, object> dict = new Dictionary <string, object>(); dict["相关人编号"] = masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue; if (type == "000") // 常规 { form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_出口_应收对账单_常规费用", dict); } else if (type == "001") // 额外 { form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_出口_应收对账单_额外费用", dict); } if (form != null) { IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager; foreach (object i in form.SelectedEntites) { 业务费用 item = i as 业务费用; item.对账单 = masterForm.DisplayManager.CurrentItem as 对账单; detailCm.AddNew(); detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = item; detailCm.EndEdit(); } } }
private static void OnBatchSetCellValueCommand(object sender, ExecutedEventArgs e) { Xceed.Grid.Cell contextMenuCell = sender as Xceed.Grid.DataCell; ArchiveGridHelper gridHelper = e.Parameter as ArchiveGridHelper; string fieldName = contextMenuCell.ParentColumn.FieldName; // 开始操作 gridHelper.m_grid.DisplayManager.BeginBatchOperation(); List <Xceed.Grid.DataRow> modifiedRows = new List <Xceed.Grid.DataRow>(); gridHelper.m_grid.GridControl.SuspendLayout(); //bool userBreak = false; foreach (Xceed.Grid.DataRow row in gridHelper.m_grid.GridControl.SelectedRows) { if (!row.Visible) { continue; } if (row == contextMenuCell.ParentRow) { continue; } if (row.Cells[fieldName].ReadOnly) { continue; } if (row.Cells[fieldName].Value == null && contextMenuCell.Value == null) { continue; } if (row.Cells[fieldName].Value != null && contextMenuCell.Value != null && row.Cells[fieldName].Value.ToString() == contextMenuCell.Value.ToString()) { continue; } bool doit = true; if (row.Cells[fieldName].Value != null) { if (gridHelper.m_allowSetListWarning) { DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("已有值 \"" + row.Cells[fieldName].GetDisplayText() + "\",是否改变?", "确认", System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Information); if (dialogResult == DialogResult.Cancel) { //userBreak = true; break; } else { doit = (dialogResult == DialogResult.Yes); } } } if (doit) { try { row.BeginEdit(); object oldValue = row.Cells[fieldName].Value; // 设置目标列值 row.Cells[fieldName].Value = contextMenuCell.Value; if (row.Cells[fieldName].Value == oldValue) { continue; } // 有些因为Combo的原因,设置值有限制 row.Cells[fieldName].EnterEdit(); row.Cells[fieldName].LeaveEdit(true); if (row.Cells[fieldName].Value == null && contextMenuCell.Value != null) { row.Cells[fieldName].Value = oldValue; row.CancelEdit(); continue; } try { row.EndEdit(); } catch (Exception) { // 当保存不进去的时候,cancel row.CancelEdit(); } modifiedRows.Add(row); gridHelper.m_grid.ControlManager.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, row.Index)); //CancelEventArgs ee = new CancelEventArgs(); //row_EndingEdit(row, ee); } // 不知道 //// when in 批量费用登记(有分组的界面) //catch (Xceed.Grid.GridValidationException) //{ //} catch (Exception ex) { row.CancelEdit(); ExceptionProcess.ProcessWithNotify(ex); if (!MessageForm.ShowYesNo("出现错误,是否继续?")) { break; } } } } // 即使用户取消,也要保存先前的内容 //if (userBreak) //{ //} //else //{ IBatchDao batchDao = gridHelper.m_grid.ControlManager.Dao as IBatchDao; if (batchDao == null) { ServiceProvider.GetService <IMessageBox>().ShowWarning("不支持批量保存,将逐条保存!"); } try { if (batchDao != null) { batchDao.SuspendOperation(); } foreach (Xceed.Grid.DataRow row in modifiedRows) { object entity = row.Tag; foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(gridHelper.m_grid.GridName)) { if (row.Cells[info.GridColumnName] != null && !string.IsNullOrEmpty(info.PropertyName)) { if (row.Cells[info.GridColumnName].ReadOnly) { continue; } if (info.GridColumnType == GridColumnType.Normal) { EntityScript.SetPropertyValue(entity, info.Navigator, info.PropertyName, row.Cells[info.GridColumnName].Value); } } } gridHelper.m_grid.ControlManager.Dao.Update(entity); } if (batchDao != null) { batchDao.ResumeOperation(); } } catch (Exception ex) { if (batchDao != null) { batchDao.CancelSuspendOperation(); } ExceptionProcess.ProcessWithNotify(ex); gridHelper.m_grid.ReloadData(); } finally { } gridHelper.m_grid.GridControl.ResumeLayout(); gridHelper.m_grid.DisplayManager.EndBatchOperation(); MyGrid.SetCurrentRow(gridHelper.m_grid.GridControl, gridHelper.m_grid.DataRows[gridHelper.m_grid.DisplayManager.Position]); MyGrid.SyncSelectedRowToCurrentRow(gridHelper.m_grid.GridControl); }
private void tsbSave_Click(object sender, EventArgs e) { if (m_haveSaved) { if (!ServiceProvider.GetService <IMessageBox>().ShowYesNoDefaultNo("已保存过一次,是否再次保存(会导致2份记录)?", "确认")) { return; } } int cnt = 0; IBatchDao batchDao = m_cm.Dao as IBatchDao; if (batchDao == null) { ServiceProvider.GetService <IMessageBox>().ShowWarning("不支持批量保存,将逐条保存!"); } try { m_cm.CancelEdit(); MyGrid.CancelEditCurrentDataRow(m_excelGrid); if (batchDao != null) { batchDao.SuspendOperation(); } foreach (Xceed.Grid.DataRow row in m_excelGrid.DataRows) { bool hasValue = false; foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(m_excelGrid.GridName)) { if (row.Cells[info.GridColumnName] != null && !string.IsNullOrEmpty(info.PropertyName)) { if (row.Cells[info.GridColumnName].ReadOnly) { continue; } if (row.Cells[info.GridColumnName].Value != null) { hasValue = true; } } } if (!hasValue) { continue; } object entity = m_cm.AddNew(); if (entity == null) { continue; } foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(m_excelGrid.GridName)) { if (row.Cells[info.GridColumnName] != null && !string.IsNullOrEmpty(info.PropertyName)) { if (row.Cells[info.GridColumnName].ReadOnly) { continue; } EntityScript.SetPropertyValue(entity, info.Navigator, info.PropertyName, row.Cells[info.GridColumnName].Value); } } m_cm.EndEdit(false); m_cm.Dao.Save(entity); cnt++; } if (batchDao != null) { batchDao.ResumeOperation(); } m_haveSaved = true; MessageForm.ShowInfo(string.Format("已保存{0}条记录!", cnt)); } catch (Exception ex) { if (batchDao != null) { batchDao.CancelSuspendOperation(); } ExceptionProcess.ProcessWithNotify(ex); } }
private static bool InternalExecuteWindowMenu2(IControlManager cm, WindowMenuInfo info, Form parentForm) { object entity = cm.DisplayManager.CurrentItem; int pos = cm.DisplayManager.Position; //ArchiveOperationForm opForm = masterForm as ArchiveOperationForm; switch (info.Type) { case WindowMenuType.Add: { ArchiveOperationForm.DoAddS(cm); } break; case WindowMenuType.Edit: { ArchiveOperationForm.DoEditS(cm, (parentForm as IGridNamesContainer).GridNames[0]); } break; case WindowMenuType.Delete: { ArchiveOperationForm.DoDeleteS(cm, (parentForm as IGridNamesContainer).GridNames[0]); } break; case WindowMenuType.Confirm: { parentForm.ValidateChildren(); ArchiveDetailForm.DoSaveS(cm); } break; case WindowMenuType.Cancel: { ArchiveDetailForm.DoCancelS(cm); } break; case WindowMenuType.Submit: { if (entity == null) { MessageForm.ShowError("请选择要提交的项!"); return(true); } if (!MessageForm.ShowYesNo("是否确认提交?")) { return(true); } ISubmittedEntity se = entity as ISubmittedEntity; if (se == null) { throw new ArgumentException("Submit Entity should be ISubmittedEntity!"); } if (string.IsNullOrEmpty(info.ExecuteParam)) { cm.EditCurrent(); se.Submitted = true; cm.EndEdit(); } else { ISubmittedEntityDao dao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(info.ExecuteParam) as ISubmittedEntityDao; if (dao == null) { throw new ArgumentException("Submit windowMenuType's ExecuteParam should be ISubmittedEntityDao!"); } using (IRepository rep = dao.GenerateRepository()) { try { se.Submitted = true; rep.BeginTransaction(); dao.Submit(rep, entity); rep.CommitTransaction(); cm.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, pos)); } catch (Exception ex) { se.Submitted = false; rep.RollbackTransaction(); ExceptionProcess.ProcessWithNotify(ex); } } } } break; case WindowMenuType.Unsubmit: { if (entity == null) { MessageForm.ShowError("请选择要撤销提交的项!"); return(true); } if (!MessageForm.ShowYesNo("是否确认撤销提交?", "确认", true)) { return(true); } ISubmittedEntity se = entity as ISubmittedEntity; if (se == null) { throw new ArgumentException("Submit Entity should be ISubmittedEntity!"); } if (string.IsNullOrEmpty(info.ExecuteParam)) { cm.EditCurrent(); se.Submitted = false; cm.EndEdit(); } else { ISubmittedEntityDao dao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(info.ExecuteParam) as ISubmittedEntityDao; if (dao == null) { throw new ArgumentException("Submit windowMenuType's ExecuteParam should be ISubmittedEntityDao!"); } using (IRepository rep = dao.GenerateRepository()) { try { se.Submitted = false; rep.BeginTransaction(); dao.Unsubmit(rep, entity); rep.CommitTransaction(); cm.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, pos)); } catch (Exception ex) { se.Submitted = true; rep.RollbackTransaction(); ExceptionProcess.ProcessWithNotify(ex); } } } } break; case WindowMenuType.SubmitMulti: { if (cm.DisplayManager.Count == 0) { MessageForm.ShowError("请选择要提交的项!"); return(true); } if (!MessageForm.ShowYesNo("是否确认提交(当前全部)?")) { return(true); } ISubmittedEntity se = entity as ISubmittedEntity; if (se == null) { throw new ArgumentException("Submit Entity should be ISubmittedEntity!"); } if (string.IsNullOrEmpty(info.ExecuteParam)) { IBatchDao batchDao = cm.Dao as IBatchDao; if (batchDao != null) { batchDao.SuspendOperation(); } for (int i = 0; i < cm.DisplayManager.Count; ++i) { cm.DisplayManager.Position = i; cm.EditCurrent(); (cm.DisplayManager.Items[i] as ISubmittedEntity).Submitted = true; cm.EndEdit(); } if (batchDao != null) { batchDao.ResumeOperation(); } } else { ISubmittedEntityDao dao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(info.ExecuteParam) as ISubmittedEntityDao; if (dao == null) { throw new ArgumentException("Submit windowMenuType's ExecuteParam should be ISubmittedEntityDao!"); } using (IRepository rep = dao.GenerateRepository()) { try { rep.BeginTransaction(); for (int i = 0; i < cm.DisplayManager.Count; ++i) { (cm.DisplayManager.Items[i] as ISubmittedEntity).Submitted = true; dao.Submit(rep, cm.DisplayManager.Items[i]); } rep.CommitTransaction(); cm.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, pos)); } catch (Exception ex) { se.Submitted = false; rep.RollbackTransaction(); ExceptionProcess.ProcessWithNotify(ex); } } } } break; case WindowMenuType.Cancellate: { if (entity == null) { MessageForm.ShowError("请选择要作废的项!"); return(true); } if (!MessageForm.ShowYesNo("是否确认作废?", "确认", true)) { return(true); } ICancellateDao dao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(info.ExecuteParam) as ICancellateDao; if (dao == null) { throw new ArgumentException("Submit windowMenuType's ExecuteParam should be ICancellateDao!"); } using (IRepository rep = dao.GenerateRepository()) { try { rep.BeginTransaction(); dao.Cancellate(rep, entity); rep.CommitTransaction(); cm.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, pos)); } catch (Exception ex) { rep.RollbackTransaction(); ExceptionProcess.ProcessWithNotify(ex); } } } break; case WindowMenuType.DaoProcess: { if (entity == null) { MessageForm.ShowError("请选择要操作的项!"); return(true); } if (!MessageForm.ShowYesNo("是否要执行" + info.Text + "?")) { return(true); } string[] ss = info.ExecuteParam.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (ss.Length != 2) { throw new ArgumentException("DaoProcess windowMenuType's ExecuteParam should be IDao;MethodName!"); } IRepositoryDao dao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(ss[0].Trim()) as IRepositoryDao; if (dao == null) { throw new ArgumentException("DaoProcess windowMenuType's ExecuteParam's first part should be IDao!"); } using (IRepository rep = dao.GenerateRepository()) { try { rep.BeginTransaction(); Feng.Utils.ReflectionHelper.RunInstanceMethod(ss[0].Trim(), ss[1].Trim(), dao, new object[] { rep, entity }); rep.CommitTransaction(); cm.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, pos)); } catch (Exception ex) { rep.RollbackTransaction(); ExceptionProcess.ProcessWithNotify(ex); } } } break; case WindowMenuType.Select: { string[] ss = info.ExecuteParam.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (ss.Length == 0) { throw new ArgumentException("WindowMenu's ExecuteParam is Invalid of WindowMenu " + info.Name); } ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo(ss[0])) as ArchiveCheckForm; if (ss.Length > 1) { string exp = ss[1]; exp = EntityHelper.ReplaceEntity(exp, new EntityHelper.GetReplaceValue(delegate(string paramName) { Tuple <string, object> t = EventProcessUtils.GetDataControlValue(paramName, cm.DisplayManager); if (t.Item2 == null) { throw new InvalidUserOperationException(string.Format("请先填写{0}!", paramName)); } cm.DisplayManager.DataControls[t.Item1].ReadOnly = true; // save controlValue to entity because readonly will not save EntityScript.SetPropertyValue(cm.DisplayManager.CurrentItem, t.Item1, t.Item2); return(t.Item2); })); if (string.IsNullOrEmpty(form.DisplayManager.SearchManager.AdditionalSearchExpression)) { form.DisplayManager.SearchManager.AdditionalSearchExpression = exp; } else { form.DisplayManager.SearchManager.AdditionalSearchExpression = "(" + form.DisplayManager.SearchManager.AdditionalSearchExpression + ") and " + exp; } } int detailGridIdx = 0; if (ss.Length > 2) { detailGridIdx = Feng.Utils.ConvertHelper.ToInt(ss[2]).Value; } if (form.ShowDialog(parentForm) == System.Windows.Forms.DialogResult.OK) { IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)(parentForm as IArchiveMasterForm).ArchiveDetailForm).DetailGrids[detailGridIdx] as IArchiveGrid).ControlManager; var nowList = detailCm.DisplayManager.Items; foreach (object i in form.SelectedEntites) { if (nowList.Contains(i)) { continue; } detailCm.AddNew(); detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = i; detailCm.EndEdit(); } } form.Dispose(); } break; case WindowMenuType.Input: throw new NotSupportedException("Not supported now!"); case WindowMenuType.ManyToOneWindow: { if (cm.DisplayManager.CurrentItem == null) { MessageForm.ShowInfo("无当前项,不能操作!"); return(true); } string[] ss = info.ExecuteParam.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (ss.Length < 2) { throw new ArgumentException("WindowMenu's ExecuteParam is Invalid of WindowMenu " + info.Name); } ArchiveDetailForm selectForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo(ss[0])) as ArchiveDetailForm; string propertyName = ss[1]; object masterEntity = EntityScript.GetPropertyValue(cm.DisplayManager.CurrentItem, propertyName); if (masterEntity == null) { ArchiveOperationForm.DoAddS(selectForm.ControlManager); selectForm.UpdateContent(); if (selectForm.ShowDialog(parentForm) == System.Windows.Forms.DialogResult.OK) { cm.EditCurrent(); EntityScript.SetPropertyValue(cm.DisplayManager.CurrentItem, propertyName, selectForm.DisplayManager.CurrentItem); cm.EndEdit(); cm.OnCurrentItemChanged(); } } else { selectForm.ControlManager.AddNew(); selectForm.DisplayManager.Items[selectForm.DisplayManager.Position] = masterEntity; selectForm.ControlManager.EndEdit(false); ArchiveOperationForm.DoEditS(selectForm.ControlManager, selectForm.GridName); selectForm.UpdateContent(); if (selectForm.ShowDialog(parentForm) == System.Windows.Forms.DialogResult.OK) { ((parentForm as IArchiveMasterForm).MasterGrid as IBoundGrid).ReloadData(); } } selectForm.Dispose(); } break; default: return(false); } return(true); }