//private 任务Dao m_rwDao = new 任务Dao(); private void 进口箱批量任务录入_Load(object sender, EventArgs e) { m_暂存区Grid = base.AssociateArchiveGrid(pnl暂存区, "任务备案_进口箱批量任务录入_暂存区") as ArchiveUnboundGrid; m_cm = m_暂存区Grid.ControlManager as IWindowControlManager <进口票>; m_显示区Grid = MyTemplateForm.AssociateArchiveDetailGrid(pnl显示区, "任务备案_进口箱批量任务录入_显示区", m_cm, m_cm.Dao as IRelationalDao) as ArchiveUnboundGrid; m_cm2 = m_显示区Grid.ControlManager as IWindowControlManager <任务>; base.AssociateDataControls(new Control[] { pnl任务性质, pnl转关箱标志, pnl委托人, pnl委托时间, pnl委托联系人, pnl船名, pnl航次, pnl提箱时间要求, pnl还箱进港时间要求, pnl备注, pnl总箱量, pnl提单号, pnl提示性箱号, pnl箱属船公司 }, m_cm.DisplayManager, m_gridName); m_cm.StateControls.Add(new StateControl(btn新增任务, true)); m_cm.StateControls.Add(new StateControl(btn暂存待确认, false)); m_cm.StateControls.Add(new StateControl(btn删除, StateType.View)); m_cm.StateControls.Add(new StateControl(btn修改, StateType.View)); m_cm.StateControls.Add(new StateControl(btn预录入发送, false)); m_cm.StateControls.Add(new StateControl(btn网上导入, false)); m_cm.DisplayManager.DataControls["委托人编号"].SelectedDataValueChanged += new EventHandler(任务预备案_委托人编号_SelectedDataValueChanged); //MyTemplateForm.RestrictToUserAccess(m_cm.DisplayManager.SearchManager, "备案主管"); RemoveGridValidations(); m_cm.DisplayManager.PositionChanging += new Feng.CancelEventHandler(DisplayManager_PositionChanging); m_cm.DisplayManager.PositionChanged += new EventHandler(DisplayManager_PositionChanged); Helper.SetGridDefault(this, m_暂存区Grid); m_cm.DisplayManager.SearchManager.LoadData(); }
private void Initialize(WindowTabInfo windowTabInfo, IControlManager cmParent) { ISearchManager smMaster = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(windowTabInfo, cmParent == null ? null : cmParent.DisplayManager); IWindowControlManager cmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(windowTabInfo, smMaster) as IWindowControlManager; if (cmParent != null && cmParent.Dao is IRelationalDao) { ManagerFactory.GenerateBusinessLayer(cmParent.Dao as IRelationalDao, windowTabInfo); } else { IBaseDao daoMaster = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(windowTabInfo); cmMaster.Dao = daoMaster; } this.SetControlManager(cmMaster, windowTabInfo.GridName); //ArchiveSearchForm searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]); //this.SearchPanel = searchForm; //cmMaster.StateControls.Add(searchForm); // daoParent's subDao is inserted in detailForm if (this is IBoundGridWithDetailGridLoadOnDemand) { ArchiveFormFactory.GenerateDetailGrids(this as IBoundGridWithDetailGridLoadOnDemand, windowTabInfo); } }
private void 任务预备案_Load(object sender, EventArgs e) { m_rightGrid = base.AssociateArchiveGrid(pnl待确认区, "任务备案_任务预备案") as ArchiveUnboundGrid; var cm = m_rightGrid.ControlManager; m_cm = m_rightGrid.ControlManager as IWindowControlManager; m_cmT = m_cm as IWindowControlManager <任务>; MyTemplateForm.AddControl(pnl备案明细窗体, new 备案明细窗体(cm, m_gridName)); cm.DisplayManager.DataControls["装货地编号"].SelectedDataValueChanged += new EventHandler(任务预备案_SelectedDataValueChanged); cm.DisplayManager.DataControls["卸货地编号"].SelectedDataValueChanged += new EventHandler(任务预备案_SelectedDataValueChanged); cm.StateControls.Add(new StateControl(btn预录入发送, false)); cm.StateControls.Add(new StateControl(btn暂存待确认, false)); cm.StateControls.Add(new StateControl(btn删除, StateType.View)); cm.StateControls.Add(new StateControl(btn新增任务, true)); cm.StateControls.Add(new StateControl(btn修改, StateType.View)); cm.StateControls.Add(new StateControl(btn文件导入, true)); cm.DisplayManager.PositionChanged += new EventHandler(DisplayManager_PositionChanged); cm.DisplayManager.PositionChanging += new CancelEventHandler(DisplayManager_PositionChanging); //MyTemplateForm.RestrictToUserAccess(m_cm.DisplayManager.SearchManager, "备案主管"); Helper.SetGridDefault(this, m_rightGrid); cm.DisplayManager.SearchManager.LoadData(); }
/// <summary> /// /// </summary> /// <param name="cm"></param> /// <param name="controlGroupName"></param> /// <param name="detailGridCount"></param> public ArchiveDetailFormAutoWithMultiDetailGrid(IWindowControlManager cm, string controlGroupName, int detailGridCount, string[] texts) : base(cm, controlGroupName) { InitializeComponent(); if (this.DesignMode) return; CreateControls(detailGridCount, texts); }
/// <summary> /// /// </summary> /// <param name="cm"></param> /// <param name="controlGroupName"></param> public ArchiveDetailFormWithDetailGrids(IWindowControlManager cm, string controlGroupName) : base(cm, controlGroupName) { InitializeComponent(); this.FormClosed += new FormClosedEventHandler(ArchiveDetailFormAutoWithDetailGrid_FormClosed); cm.EditCanceled += new EventHandler(cm_EditCanceled); //cm.ListChanged += new ListChangedEventHandler(cm_ListChanged); }
/// <summary> /// /// </summary> /// <param name="cm"></param> /// <param name="controlGroupName"></param> public ArchiveDetailFormAutoWithDetailGrid(IWindowControlManager cm, string controlGroupName) : base(cm, controlGroupName) { InitializeComponent(); if (this.DesignMode) return; CreateControls(); }
/// <summary> /// /// </summary> /// <param name="cm"></param> /// <param name="controlGroupName"></param> /// <param name="detailGridCount"></param> public ArchiveDetailFormAutoWithMultiDetailGrid(IWindowControlManager cm, string controlGroupName, int detailGridCount, string[] texts) : base(cm, controlGroupName) { InitializeComponent(); if (this.DesignMode) { return; } CreateControls(detailGridCount, texts); }
/// <summary> /// /// </summary> /// <param name="cm"></param> /// <param name="controlGroupName"></param> public ArchiveDetailFormAutoWithDetailGrid(IWindowControlManager cm, string controlGroupName) : base(cm, controlGroupName) { InitializeComponent(); if (this.DesignMode) { return; } CreateControls(); }
//public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo) //{ // return GenerateArchiveDetailForm(windowInfo, null); //} public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo) { ArchiveDetailForm ret = null; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos.Count == 0) { throw new ArgumentException("there should be winTab infos in window of " + windowInfo.Name); } ISearchManager sm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IWindowControlManager cmParent = null; if (string.IsNullOrEmpty(tabInfos[0].ControlManagerClassName)) { IDisplayManager dmParent = ServiceProvider.GetService <IManagerFactory>().GenerateDisplayManager(tabInfos[0], sm); ret = GenerateArchiveDetailForm(windowInfo, dmParent); } else { cmParent = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(tabInfos[0], sm) as IWindowControlManager; IBaseDao daoParent = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(tabInfos[0]); cmParent.Dao = daoParent; ret = GenerateArchiveDetailForm(windowInfo, cmParent, daoParent as IRelationalDao); } ret.Text = windowInfo.Text; ret.Name = windowInfo.Name; ArchiveSearchForm searchForm = null; ret.SetSearchPanel(() => { if (searchForm == null) { searchForm = new ArchiveSearchForm(ret, sm, tabInfos[0]); if (cmParent != null) { cmParent.StateControls.Add(searchForm); } } return(searchForm); }); return(ret); }
private void 任务正式备案_Load(object sender, EventArgs e) { m_rightGrid = base.AssociateArchiveGrid(pnl任务预备案信息区, m_gridName) as ArchiveUnboundGrid; m_cm = m_rightGrid.ControlManager as IWindowControlManager; m_rightGrid.DataRowTemplate.Cells["预录入号"].DoubleClick += new EventHandler(任务正式备案_DoubleClick); m_rightGrid.DataRowTemplate.Cells["确认"].DoubleClick += new EventHandler(任务正式备案_DoubleClick); m_rightGrid.DataRowTemplate.Cells["拒绝"].DoubleClick += new EventHandler(任务正式备案_DoubleClick); m_rightGrid.ChangeControlPositionAccordColumn(lbl备案确认区, "确认"); m_rightGrid.ChangeControlPositionAccordColumn(btn批量确认, "确认"); Helper.SetGridDefault(this, m_rightGrid); m_cm.DisplayManager.SearchManager.LoadData(); }
internal static void RemoveAllValidation(IWindowControlManager cm) { foreach (IDataControl dc in cm.DisplayManager.DataControls) { if (dc.Name == "任务性质") { continue; } cm.RemoveValidation(dc.Name); } //m_cm.RemoveValidation("委托人编号"); //m_cm.RemoveValidation("还箱进港时间要求始"); //m_cm.RemoveValidation("还箱进港时间要求止"); //m_cm.RemoveValidation("提箱时间要求始"); //m_cm.RemoveValidation("提箱时间要求止"); //m_cm.RemoveValidation("委托时间"); //m_cm.RemoveValidation("卸货时间要求始"); //m_cm.RemoveValidation("卸货时间要求止"); //m_cm.RemoveValidation("装货时间要求始"); //m_cm.RemoveValidation("装货时间要求止"); //m_cm.RemoveValidation("重量"); //m_cm.RemoveValidation("装货地编号"); //m_cm.RemoveValidation("装货地详细地址"); //m_cm.RemoveValidation("还箱进港点编号"); //m_cm.RemoveValidation("提箱点编号"); //m_cm.RemoveValidation("箱属船公司编号"); //m_cm.RemoveValidation("卸货地编号"); //m_cm.RemoveValidation("价值"); //m_cm.RemoveValidation("船名航次"); //m_cm.RemoveValidation("卸货联系手机"); //m_cm.RemoveValidation("卸货联系座机"); //m_cm.RemoveValidation("卸货联系人"); //m_cm.RemoveValidation("委托联系人"); //m_cm.RemoveValidation("装货联系手机"); //m_cm.RemoveValidation("装货联系座机"); //m_cm.RemoveValidation("装货联系人"); //m_cm.RemoveValidation("箱号"); //m_cm.RemoveValidation("箱型编号"); //m_cm.RemoveValidation("货名"); //m_cm.RemoveValidation("货物特征"); //m_cm.RemoveValidation("提单号"); //m_cm.RemoveValidation("转关箱标志"); }
public static IArchiveGrid AssociateArchiveDetailGrid(Control container, string windowTabName, IControlManager cmParent, IRelationalDao daoParent) { WindowTabInfo windowTabInfo = ADInfoBll.Instance.GetWindowTabInfo(windowTabName); if (windowTabName == null) { return(null); } GeneratedArchiveUnboundGrid grid = new GeneratedArchiveUnboundGrid(windowTabInfo, cmParent); IWindowControlManager subCm = grid.ControlManager as IWindowControlManager; //ISearchManager subSm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(windowTabInfo, cmParent.DisplayManager); //IWindowControlManager subCm = ServiceProvider.GetService<IManagerFactory>().GenerateControlManager(windowTabInfo, subSm) as IWindowControlManager; //subCm.Name = windowTabInfo.Name; //grid.SetControlManager(subCm, windowTabInfo.GridName); //ManagerFactory.GenerateBusinessLayer(daoParent, windowTabInfo); int i = 0; IBaseDao subDao = daoParent.GetRelationalDao(i); if (subDao is IMemoriedRelationalDao) { IMemoryDao subMemoryDao = ((IMemoriedRelationalDao)daoParent.GetRelationalDao(i)).DetailMemoryDao; subCm.Dao = subMemoryDao; //subMemoryDao.AddSubDao(new MasterDetailMemoryDao<>(cmParent)); ((IMemoriedRelationalDao)daoParent.GetRelationalDao(i)).AddRelationToMemoryDao(cmParent.DisplayManager); } else { subCm.Dao = subDao; } AddControl(container, grid); grid.LoadLayout(); grid.IsInDetailMode = true; cmParent.StateControls.Add(grid); cmParent.CheckControls.Add(grid); return(grid); }
internal static void RemoveAllValidation(IWindowControlManager cm) { foreach (IDataControl dc in cm.DisplayManager.DataControls) { if (dc.Name == "任务性质") continue; cm.RemoveValidation(dc.Name); } //m_cm.RemoveValidation("委托人编号"); //m_cm.RemoveValidation("还箱进港时间要求始"); //m_cm.RemoveValidation("还箱进港时间要求止"); //m_cm.RemoveValidation("提箱时间要求始"); //m_cm.RemoveValidation("提箱时间要求止"); //m_cm.RemoveValidation("委托时间"); //m_cm.RemoveValidation("卸货时间要求始"); //m_cm.RemoveValidation("卸货时间要求止"); //m_cm.RemoveValidation("装货时间要求始"); //m_cm.RemoveValidation("装货时间要求止"); //m_cm.RemoveValidation("重量"); //m_cm.RemoveValidation("装货地编号"); //m_cm.RemoveValidation("装货地详细地址"); //m_cm.RemoveValidation("还箱进港点编号"); //m_cm.RemoveValidation("提箱点编号"); //m_cm.RemoveValidation("箱属船公司编号"); //m_cm.RemoveValidation("卸货地编号"); //m_cm.RemoveValidation("价值"); //m_cm.RemoveValidation("船名航次"); //m_cm.RemoveValidation("卸货联系手机"); //m_cm.RemoveValidation("卸货联系座机"); //m_cm.RemoveValidation("卸货联系人"); //m_cm.RemoveValidation("委托联系人"); //m_cm.RemoveValidation("装货联系手机"); //m_cm.RemoveValidation("装货联系座机"); //m_cm.RemoveValidation("装货联系人"); //m_cm.RemoveValidation("箱号"); //m_cm.RemoveValidation("箱型编号"); //m_cm.RemoveValidation("货名"); //m_cm.RemoveValidation("货物特征"); //m_cm.RemoveValidation("提单号"); //m_cm.RemoveValidation("转关箱标志"); }
public static void UpdateContent(IWindowControlManager cm, string gridName) { ArchiveDetailForm.ResetStatusDataControl(cm); ArchiveDetailForm.UpdateStatusDataControl(cm, gridName); //m_masterCm.DisplayManager.OnPositionChanged(System.EventArgs.Empty); if (cm != null) { if (cm.State == StateType.Add) { cm.DisplayManager.DataControls.FocusFirstInsertableControl(); ArchiveDetailForm.SetDataControlDefaultValues(cm); } else if (cm.State == StateType.Edit) { cm.DisplayManager.DataControls.FocusFirstEditableControl(); } } }
private void 任务正式备案二_Load(object sender, EventArgs e) { m_rightGrid = base.AssociateArchiveGrid(pnl请求区, "任务备案_任务正式备案二") as ArchiveUnboundGrid; m_cm = m_rightGrid.ControlManager as IWindowControlManager; m_cmT = m_cm as IWindowControlManager <任务>; MyTemplateForm.AddControl(pnl备案明细窗体, new 备案明细窗体(m_cm, m_gridName)); base.AssociateDataControls(new System.Windows.Forms.Control[] { pnl任务号 }, m_cm.DisplayManager, m_gridName); m_cm.StateControls.Add(new StateControl(btn修改, StateType.View)); m_cm.StateControls.Add(new StateControl(btn拒绝, StateType.View)); m_cm.StateControls.Add(new StateControl(btn放弃, false)); m_cm.StateControls.Add(new StateControl(btn备案确认, StateType.View | StateType.Add | StateType.Edit)); m_cm.StateControls.Add(new StateControl(btn网上委托导入, true)); m_cm.DisplayManager.PositionChanged += new EventHandler(DisplayManager_PositionChanged); m_cm.DisplayManager.PositionChanging += new CancelEventHandler(DisplayManager_PositionChanging); Helper.SetGridDefault(this, m_rightGrid); m_cm.DisplayManager.SearchManager.LoadData(); }
public GeneratedArchiveExcelForm(WindowInfo windowInfo) { this.Name = windowInfo.Name; this.Text = windowInfo.Text; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos == null) { throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name); } if (tabInfos.Count == 0) { throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } if (tabInfos.Count > 1) { throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } ISearchManager sm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IBaseDao daoParent = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(tabInfos[0]); IWindowControlManager cmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(tabInfos[0], sm) as IWindowControlManager; cmMaster.Dao = daoParent; base.ControlManager = cmMaster; this.MasterGrid.GridName = tabInfos[0].GridName; this.ExcelGrid.BeginInitialize(); CreateGridColumns(this.MasterGrid); this.ExcelGrid.EndInitialize(); this.ExcelGrid.SetColumnManagerRowHorizontalAlignment(); // 不需要。和ArchiveOperationForm同一个WindowInfo,会出错 //GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this); }
//private 任务Dao m_rwDao = new 任务Dao(); private void 进口箱批量任务录入_Load(object sender, EventArgs e) { m_暂存区Grid = base.AssociateArchiveGrid(pnl暂存区, "任务备案_进口箱批量任务确认_暂存区") as ArchiveUnboundGrid; m_cm = m_暂存区Grid.ControlManager as IWindowControlManager <进口票>; m_显示区Grid = MyTemplateForm.AssociateArchiveDetailGrid(pnl显示区, "任务备案_进口箱批量任务确认_显示区", m_cm, m_cm.Dao as IRelationalDao) as ArchiveUnboundGrid; m_cm2 = m_显示区Grid.ControlManager as IWindowControlManager <任务>; base.AssociateDataControls(new Control[] { pnl任务性质, pnl转关箱标志, pnl委托人, pnl委托时间, pnl委托联系人, pnl提单号, pnl船名, pnl航次, pnl提箱时间要求, pnl还箱进港时间要求, pnl备注, pnl总箱量, pnl提单号, pnl箱属船公司 }, m_cm.DisplayManager, m_gridName); m_cm.StateControls.Add(new StateControl(btn修改, StateType.View)); m_cm.StateControls.Add(new StateControl(btn拒绝, StateType.View)); m_cm.StateControls.Add(new StateControl(btn放弃, false)); m_cm.StateControls.Add(new StateControl(btn备案确认, StateType.View | StateType.Add | StateType.Edit)); m_cm.DisplayManager.DataControls["委托人编号"].SelectedDataValueChanged += new EventHandler(任务预备案_委托人编号_SelectedDataValueChanged); m_cm.DisplayManager.PositionChanging += new Feng.CancelEventHandler(DisplayManager_PositionChanging); m_cm.DisplayManager.PositionChanged += new EventHandler(DisplayManager_PositionChanged); Helper.SetGridDefault(this, m_暂存区Grid); if (m_提单号 == null) { m_cm.DisplayManager.SearchManager.LoadData(); } else { btn修改.Enabled = false; m_cm.DisplayManager.SearchManager.AdditionalSearchExpression = null; m_cm.DisplayManager.SearchManager.LoadData(SearchExpression.Eq("提单号", m_提单号), null); } }
private void Initialize(WindowInfo windowInfo) { this.Name = windowInfo.Name; this.Text = windowInfo.Text; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos == null) { throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name); } if (tabInfos.Count == 0) { throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } if (tabInfos.Count > 1) { throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } ISearchManager smMaster = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IWindowControlManager cmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(tabInfos[0], smMaster) as IWindowControlManager; IBaseDao daoParent = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(tabInfos[0]); cmMaster.Dao = daoParent; ((IArchiveGrid)base.MasterGrid).SetControlManager(cmMaster, tabInfos[0].GridName); // daoParent's subDao is inserted in detailForm if (base.MasterGrid is IBoundGridWithDetailGridLoadOnDemand) { ArchiveFormFactory.GenerateDetailGrids(base.MasterGrid as IBoundGridWithDetailGridLoadOnDemand, tabInfos[0]); } // Load Additional Menus IList <WindowMenuInfo> windowMenuInfos = ADInfoBll.Instance.GetWindowMenuInfo(windowInfo.Name); IList <WindowMenuInfo> masterWindowMenuInfos; IList <WindowMenuInfo> detailWindowMenuInfos; GeneratedArchiveSeeForm.SplitWindowMenu(windowMenuInfos, out masterWindowMenuInfos, out detailWindowMenuInfos); if (masterWindowMenuInfos.Count > 0) { this.GenerateWindowMenu(masterWindowMenuInfos); } if (windowInfo.GenerateDetailForm) { if (windowInfo.DetailForm != null) { m_detailForm = ArchiveFormFactory.CreateForm(ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name)) as IArchiveDetailForm; if (windowInfo.DetailWindow == null) { ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, cmMaster, daoParent, null, m_detailForm); } } // 和主窗体不关联 else if (windowInfo.DetailWindow != null) { WindowInfo detailWindowInfo = ADInfoBll.Instance.GetWindowInfo(windowInfo.DetailWindow.Name); m_detailForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(detailWindowInfo) as IArchiveDetailForm; var searchWindow = m_detailForm.GetCustomProperty(MyChildForm.SearchPanelName) as ArchiveSearchForm; if (searchWindow != null) { searchWindow.EnableProgressForm = false; } } else { m_detailForm = ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, cmMaster, daoParent as IRelationalDao); } if (m_detailForm != null) { //m_detailWindow.ParentArchiveForm = this; // Generate DetailForm's Menu if (detailWindowMenuInfos.Count > 0) { m_detailForm.GenerateWindowMenu(detailWindowMenuInfos); m_detailForm.VisibleChanged += new EventHandler(m_detailForm_VisibleChanged); } } } ArchiveSearchForm searchForm = null; this.SetSearchPanel(() => { if (searchForm == null) { searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]); if (cmMaster != null) { cmMaster.StateControls.Add(searchForm); } } return(searchForm); }); m_attachmentForm = GeneratedArchiveSeeForm.CreateAttachmentWindow(this, windowInfo); GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this); m_windowInfo = windowInfo; }
public 任务确认详细信息(IWindowControlManager cm) { InitializeComponent(); m_cm = cm; m_cmT = m_cm as IWindowControlManager<任务>; }
public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo, IWindowControlManager cmParent, IRelationalDao daoParent) { return(GenerateArchiveDetailForm(windowInfo, cmParent, daoParent, null)); }
public 预录入任务详细信息(IWindowControlManager<任务> cm) { InitializeComponent(); m_cm = cm; }
public static void ResetStatusDataControl(IWindowControlManager cm) { if (cm == null) return; ResetStatusDataControl(cm.DisplayManager); foreach (IDataControl dc in cm.DisplayManager.DataControls) { cm.RemoveValidation(dc.Name); } cm.ControlCheckExceptionProcess.ClearAllError(); }
public 任务确认详细信息(IWindowControlManager cm) { InitializeComponent(); m_cm = cm; m_cmT = m_cm as IWindowControlManager <任务>; }
private void 任务正式备案二_Load(object sender, EventArgs e) { m_rightGrid = base.AssociateArchiveGrid(pnl请求区, "任务备案_任务正式备案二") as ArchiveUnboundGrid; m_cm = m_rightGrid.ControlManager as IWindowControlManager; m_cmT = m_cm as IWindowControlManager<任务>; MyTemplateForm.AddControl(pnl备案明细窗体, new 备案明细窗体(m_cm, m_gridName)); base.AssociateDataControls(new System.Windows.Forms.Control[] { pnl任务号 }, m_cm.DisplayManager, m_gridName); m_cm.StateControls.Add(new StateControl(btn修改, StateType.View)); m_cm.StateControls.Add(new StateControl(btn拒绝, StateType.View)); m_cm.StateControls.Add(new StateControl(btn放弃, false)); m_cm.StateControls.Add(new StateControl(btn备案确认, StateType.View | StateType.Add | StateType.Edit)); m_cm.StateControls.Add(new StateControl(btn网上委托导入, true)); m_cm.DisplayManager.PositionChanged += new EventHandler(DisplayManager_PositionChanged); m_cm.DisplayManager.PositionChanging += new CancelEventHandler(DisplayManager_PositionChanging); Helper.SetGridDefault(this, m_rightGrid); m_cm.DisplayManager.SearchManager.LoadData(); }
private static void SetDetailGridsAllowInsert(IWindowControlManager cm, GridRowInfo rowInfo) { // DetailGrid AllowInsert if (!string.IsNullOrEmpty(rowInfo.DetailGridAllowInsert)) { object[] ss = ParamCreatorHelper.TryGetParams(rowInfo.DetailGridAllowInsert); foreach (object s in ss) { //string[] sss = s.ToString().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); object[] sss = ParamCreatorHelper.TryGetParams((string)s); // 第一个是GridName,第二个是权限 if (sss.Length == 2) { foreach (IStateControl sc in cm.StateControls) { ArchiveUnboundGrid detailGrid = sc as ArchiveUnboundGrid; if (detailGrid != null && detailGrid.GridName == (string)sss[0]) { if (detailGrid.InsertionRow != null) { detailGrid.AllowInnerInsert = Permission.AuthorizeByRule((string)sss[1], cm.DisplayManager.CurrentItem); detailGrid.InsertionRow.Visible = detailGrid.AllowInnerInsert; } } } } else if (sss.Length == 1) { foreach (IStateControl sc in cm.StateControls) { ArchiveUnboundGrid detailGrid = sc as ArchiveUnboundGrid; if (detailGrid != null) { if (detailGrid.InsertionRow != null) { detailGrid.AllowInnerInsert = Permission.AuthorizeByRule((string)sss[0], cm.DisplayManager.CurrentItem); detailGrid.InsertionRow.Visible = detailGrid.AllowInnerInsert; } } } } else { throw new ArgumentException("DetailGridAllowInsert must have 2 or 1 param!"); } } } else { SetDetailGridsAllowInsertVisible(cm, true); } }
//private static void AddManualDetailForm(System.Windows.Forms.Form form, IArchiveDetailFormAuto detailFormAuto) //{ // form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; // form.TopLevel = false; // detailFormAuto.ReplaceFlowLayoutPanel(form); //} public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo, IWindowControlManager cmParent, IBaseDao daoParent, IDisplayManager dmParent, IArchiveDetailForm originalDetailForm = null) { ArchiveDetailForm detailForm = originalDetailForm as ArchiveDetailForm; IList<WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); IList<WindowTabInfo> detailFormTabInfos = new List<WindowTabInfo>(); IList<WindowTabInfo> detailFormTabInfos2 = new List<WindowTabInfo>(); foreach (WindowTabInfo subTabInfo in tabInfos[0].ChildTabs) { if (subTabInfo.IsInDetailForm) { detailFormTabInfos.Add(subTabInfo); } else { detailFormTabInfos2.Add(subTabInfo); } } //if (detailStyleForm == null && windowInfo.DetailForm != null) //{ // FormInfo formInfo = ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name); // if (formInfo == null) // { // throw new ArgumentException("There is no FormInfo with Name of " + windowInfo.DetailForm.Name); // } // detailStyleForm = CreateForm(formInfo); //} //if (detailStyleForm != null) //{ // ret = detailStyleForm as ArchiveDetailForm; //} // 当第二层的任何一个ControlManager为空时,DetailForm作为不可编辑的。 bool isControlManagerEnable = cmParent != null; if (isControlManagerEnable) { for (int i = 0; i < detailFormTabInfos.Count; ++i) { if (string.IsNullOrEmpty(detailFormTabInfos[i].ControlManagerClassName)) { dmParent = cmParent.DisplayManager; isControlManagerEnable = false; break; } } } if (detailForm == null) { if (detailFormTabInfos.Count == 0) { if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAuto(cmParent, tabInfos[0].GridName); } else { detailForm = new ArchiveDetailFormAuto(dmParent, tabInfos[0].GridName); } } else if (detailFormTabInfos.Count == 1) { if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAutoWithDetailGrid(cmParent, tabInfos[0].GridName); } else { detailForm = new ArchiveDetailFormAutoWithDetailGrid(dmParent, tabInfos[0].GridName); } } else { string[] texts = new string[detailFormTabInfos.Count]; for (int i = 0; i < detailFormTabInfos.Count; ++i) { texts[i] = detailFormTabInfos[i].Text; } if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(cmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts); } else { detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(dmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts); } } //IArchiveDetailFormAuto detailFormAuto = ret as IArchiveDetailFormAuto; //if (detailStyleForm != null && detailFormAuto != null) //{ // AddManualDetailForm(detailStyleForm, detailFormAuto); //} } else { // Dao 在cmParent处已经设置了 if (isControlManagerEnable) { detailForm.SetControlMananger(cmParent, tabInfos[0].GridName); } else { detailForm.SetDisplayManager(dmParent, tabInfos[0].GridName); } } detailForm.Name = windowInfo.Name; detailForm.Text = windowInfo.Text; // 只有2层可编辑。主层(控件)-第二层(grid)。再下去就是第二层grid的DetailGrid,不可编辑。 IArchiveDetailFormWithDetailGrids detailFormWithGrids = detailForm as IArchiveDetailFormWithDetailGrids; if (detailFormWithGrids != null) { for (int i = 0; i < detailFormTabInfos.Count; ++i) { if (i >= detailFormWithGrids.DetailGrids.Count) break; // 主是ControlManager,并不一定子也是ControlManager。 // 主可以在grid编辑,不能通过DetailForm编辑。此时DetailForm是另外显示的东西。 if (isControlManagerEnable) { var daoRelational = daoParent as IRelationalDao; if (daoRelational == null) { throw new ArgumentException("IArchiveDetailFormWithDetailGrids must has IRelationalDao."); } ISearchManager subSm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], cmParent.DisplayManager); IWindowControlManager subCm = ServiceProvider.GetService<IManagerFactory>().GenerateControlManager(detailFormTabInfos[i], subSm) as IWindowControlManager; subCm.Name = detailFormTabInfos[i].Name; ((IArchiveGrid)detailFormWithGrids.DetailGrids[i]).SetControlManager(subCm, detailFormTabInfos[i].GridName); ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos[i]); IBaseDao subDao = daoRelational.GetRelationalDao(i); if (subDao is IMemoriedRelationalDao) { IMemoryDao subMemoryDao = ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).DetailMemoryDao; subCm.Dao = subMemoryDao; //subMemoryDao.AddSubDao(new MasterDetailMemoryDao<>(cmParent)); ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).AddRelationToMemoryDao(cmParent.DisplayManager); } else { subCm.Dao = subDao; } } else { ISearchManager subSm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], dmParent); IDisplayManager subDm = ServiceProvider.GetService<IManagerFactory>().GenerateDisplayManager(detailFormTabInfos[i], subSm); subDm.Name = detailFormTabInfos[i].Name; detailFormWithGrids.DetailGrids[i].SetDisplayManager(subDm, detailFormTabInfos[i].GridName); } GenerateDetailGrids(detailFormWithGrids.DetailGrids[i], detailFormTabInfos[i]); } } if (isControlManagerEnable) { // Generate Other Daos for (int i = 0; i < detailFormTabInfos2.Count; ++i) { if (!string.IsNullOrEmpty(detailFormTabInfos2[i].BusinessLayerClassName)) { ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos2[i]); } } } // if Master Tab's IsInDetailForm=false, Invisible it if (!tabInfos[0].IsInDetailForm) { if (detailForm is IArchiveDetailFormAuto) { (detailForm as IArchiveDetailFormAuto).RemoveControls(); } } return detailForm; }
public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo, IWindowControlManager cmParent, IRelationalDao daoParent) { return GenerateArchiveDetailForm(windowInfo, cmParent, daoParent, null); }
/// <summary> /// /// </summary> /// <param name="cm"></param> /// <param name="controlGroupName"></param> public ArchiveDetailFormAutoWithDetailGridsPanel(IWindowControlManager cm, string controlGroupName) : base(cm, controlGroupName) { InitializeComponent(); }
public 预录入任务详细信息(IWindowControlManager <任务> cm) { InitializeComponent(); m_cm = cm; }
public static void SetDataControlReadOnly(IWindowControlManager cm, string controlGroupName) { if (cm == null || cm.DisplayManager.CurrentItem == null) { return; } // column notNull if (cm.State == StateType.Add || cm.State == StateType.Edit) { foreach (IDataControl dc in cm.DisplayManager.DataControls) { if (dc.ReadOnly) { continue; } GridColumnInfo columnInfo = dc.Tag as GridColumnInfo; if (columnInfo != null) { dc.ReadOnly = Authority.AuthorizeByRule(columnInfo.ReadOnly); } } } // row and cell notNull if (cm.State == StateType.Edit) { GridRowInfo rowInfo = ADInfoBll.Instance.GetGridRowInfo(controlGroupName); bool readOnly = false; readOnly = Permission.AuthorizeByRule(rowInfo.ReadOnly, cm.DisplayManager.CurrentItem); if (readOnly) { // 全部Readonly,则整个设置View,包括DetailGrid // Todo: SetState调用太多次 foreach (IDataControl dc in cm.DisplayManager.DataControls) { dc.ReadOnly = true; } // DetailGrid is in StateControls foreach (IStateControl sc in cm.StateControls) { sc.SetState(StateType.View); } SetDetailGridsAllowInsertVisible(cm, false); } else { // DataControl Readonly IList<GridCellInfo> cellInfos = ADInfoBll.Instance.GetGridCellInfos(controlGroupName); foreach (GridCellInfo cellInfo in cellInfos) { IDataControl dc = cm.DisplayManager.DataControls[cellInfo.GridColumName]; if (dc != null && !dc.ReadOnly) { dc.ReadOnly = Permission.AuthorizeByRule(cellInfo.ReadOnly, cm.DisplayManager.CurrentItem); } } SetDetailGridsReadOnly(cm, rowInfo); SetDetailGridsAllowInsert(cm, rowInfo); } } else if (cm.State == StateType.Add) { GridRowInfo rowInfo = ADInfoBll.Instance.GetGridRowInfo(controlGroupName); SetDetailGridsReadOnly(cm, rowInfo); SetDetailGridsAllowInsert(cm, rowInfo); } else { SetDetailGridsAllowInsertVisible(cm, false); } }
internal void SetControlMananger(IWindowControlManager cm, string controlGroupName) { if (m_cm != null) { m_cm.DisplayManager.PositionChanging += new CancelEventHandler(DisplayManager_PositionChanging); m_cm.ListChanged += new ListChangedEventHandler(ControlManager_ListChanged); } SetDisplayManager(cm.DisplayManager, controlGroupName); this.m_cm = cm; m_cm.EditCanceled += new EventHandler(cm_EditCanceled); m_cm.DisplayManager.PositionChanging += new CancelEventHandler(DisplayManager_PositionChanging); m_cm.ListChanged += new ListChangedEventHandler(ControlManager_ListChanged); if (m_cm != null) { m_cm.AllowInsert = Authority.AuthorizeByRule(ADInfoBll.Instance.GetGridInfo(m_controlGroupName).AllowInsert); m_cm.AllowEdit = Authority.AuthorizeByRule(ADInfoBll.Instance.GetGridInfo(m_controlGroupName).AllowEdit); m_cm.AllowDelete = Authority.AuthorizeByRule(ADInfoBll.Instance.GetGridInfo(m_controlGroupName).AllowDelete); } }
//private 任务Dao m_rwDao = new 任务Dao(); private void 进口箱批量任务录入_Load(object sender, EventArgs e) { m_暂存区Grid = base.AssociateArchiveGrid(pnl暂存区, "任务备案_进口箱批量任务确认_暂存区") as ArchiveUnboundGrid; m_cm = m_暂存区Grid.ControlManager as IWindowControlManager<进口票>; m_显示区Grid = MyTemplateForm.AssociateArchiveDetailGrid(pnl显示区, "任务备案_进口箱批量任务确认_显示区", m_cm, m_cm.Dao as IRelationalDao) as ArchiveUnboundGrid; m_cm2 = m_显示区Grid.ControlManager as IWindowControlManager<任务>; base.AssociateDataControls(new Control[] { pnl任务性质, pnl转关箱标志, pnl委托人, pnl委托时间, pnl委托联系人, pnl提单号, pnl船名,pnl航次, pnl提箱时间要求, pnl还箱进港时间要求, pnl备注, pnl总箱量, pnl提单号, pnl箱属船公司 }, m_cm.DisplayManager, m_gridName); m_cm.StateControls.Add(new StateControl(btn修改, StateType.View)); m_cm.StateControls.Add(new StateControl(btn拒绝, StateType.View)); m_cm.StateControls.Add(new StateControl(btn放弃, false)); m_cm.StateControls.Add(new StateControl(btn备案确认, StateType.View | StateType.Add | StateType.Edit)); m_cm.DisplayManager.DataControls["委托人编号"].SelectedDataValueChanged += new EventHandler(任务预备案_委托人编号_SelectedDataValueChanged); m_cm.DisplayManager.PositionChanging += new Feng.CancelEventHandler(DisplayManager_PositionChanging); m_cm.DisplayManager.PositionChanged += new EventHandler(DisplayManager_PositionChanged); Helper.SetGridDefault(this, m_暂存区Grid); if (m_提单号 == null) { m_cm.DisplayManager.SearchManager.LoadData(); } else { btn修改.Enabled = false; m_cm.DisplayManager.SearchManager.AdditionalSearchExpression = null; m_cm.DisplayManager.SearchManager.LoadData(SearchExpression.Eq("提单号", m_提单号), null); } }
/// <summary> /// /// </summary> /// <param name="cm"></param> /// <param name="gridName"></param> public static void AddValidations(IWindowControlManager cm, string gridName) { if (cm == null) { return; } // column notNull if (cm.State == StateType.Add || cm.State == StateType.Edit) { foreach (IDataControl dc in cm.DisplayManager.DataControls) { if (dc.ReadOnly) { continue; } GridColumnInfo columnInfo = dc.Tag as GridColumnInfo; if (columnInfo != null) { if (!dc.ReadOnly) { dc.NotNull = Authority.AuthorizeByRule(columnInfo.NotNull); ValidationCriterion cri = ArchiveGridHelper.GetValidationCriterion(columnInfo, cm); if (cri != null) { cm.SetValidation(dc.Name, cri); } if (dc.NotNull) { ShowNotnullIcon(dc as IWindowControl); } } } } } // row and cell notNull if (cm.State == StateType.Edit) { if (cm.DisplayManager.CurrentItem == null) return; IList<GridCellInfo> cellInfos = ADInfoBll.Instance.GetGridCellInfos(gridName); foreach (GridCellInfo cellInfo in cellInfos) { IDataControl dc = cm.DisplayManager.DataControls[cellInfo.GridColumName]; if (dc != null && !dc.ReadOnly) { if (!dc.ReadOnly) { dc.NotNull = Permission.AuthorizeByRule(cellInfo.NotNull, cm.DisplayManager.CurrentItem); GridColumnInfo columnInfo = (dc as Control).Tag as GridColumnInfo; ValidationCriterion cri = ArchiveGridHelper.GetValidationCriterion(columnInfo, cm); if (cri != null) { cm.SetValidation(dc.Name, cri); } } } } } }
//private static void AddManualDetailForm(System.Windows.Forms.Form form, IArchiveDetailFormAuto detailFormAuto) //{ // form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; // form.TopLevel = false; // detailFormAuto.ReplaceFlowLayoutPanel(form); //} public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo, IWindowControlManager cmParent, IBaseDao daoParent, IDisplayManager dmParent, IArchiveDetailForm originalDetailForm = null) { ArchiveDetailForm detailForm = originalDetailForm as ArchiveDetailForm; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); IList <WindowTabInfo> detailFormTabInfos = new List <WindowTabInfo>(); IList <WindowTabInfo> detailFormTabInfos2 = new List <WindowTabInfo>(); foreach (WindowTabInfo subTabInfo in tabInfos[0].ChildTabs) { if (subTabInfo.IsInDetailForm) { detailFormTabInfos.Add(subTabInfo); } else { detailFormTabInfos2.Add(subTabInfo); } } //if (detailStyleForm == null && windowInfo.DetailForm != null) //{ // FormInfo formInfo = ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name); // if (formInfo == null) // { // throw new ArgumentException("There is no FormInfo with Name of " + windowInfo.DetailForm.Name); // } // detailStyleForm = CreateForm(formInfo); //} //if (detailStyleForm != null) //{ // ret = detailStyleForm as ArchiveDetailForm; //} // 当第二层的任何一个ControlManager为空时,DetailForm作为不可编辑的。 bool isControlManagerEnable = cmParent != null; if (isControlManagerEnable) { for (int i = 0; i < detailFormTabInfos.Count; ++i) { if (string.IsNullOrEmpty(detailFormTabInfos[i].ControlManagerClassName)) { dmParent = cmParent.DisplayManager; isControlManagerEnable = false; break; } } } if (detailForm == null) { if (detailFormTabInfos.Count == 0) { if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAuto(cmParent, tabInfos[0].GridName); } else { detailForm = new ArchiveDetailFormAuto(dmParent, tabInfos[0].GridName); } } else if (detailFormTabInfos.Count == 1) { if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAutoWithDetailGrid(cmParent, tabInfos[0].GridName); } else { detailForm = new ArchiveDetailFormAutoWithDetailGrid(dmParent, tabInfos[0].GridName); } } else { string[] texts = new string[detailFormTabInfos.Count]; for (int i = 0; i < detailFormTabInfos.Count; ++i) { texts[i] = detailFormTabInfos[i].Text; } if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(cmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts); } else { detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(dmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts); } } //IArchiveDetailFormAuto detailFormAuto = ret as IArchiveDetailFormAuto; //if (detailStyleForm != null && detailFormAuto != null) //{ // AddManualDetailForm(detailStyleForm, detailFormAuto); //} } else { // Dao 在cmParent处已经设置了 if (isControlManagerEnable) { detailForm.SetControlMananger(cmParent, tabInfos[0].GridName); } else { detailForm.SetDisplayManager(dmParent, tabInfos[0].GridName); } } detailForm.Name = windowInfo.Name; detailForm.Text = windowInfo.Text; // 只有2层可编辑。主层(控件)-第二层(grid)。再下去就是第二层grid的DetailGrid,不可编辑。 IArchiveDetailFormWithDetailGrids detailFormWithGrids = detailForm as IArchiveDetailFormWithDetailGrids; if (detailFormWithGrids != null) { for (int i = 0; i < detailFormTabInfos.Count; ++i) { if (i >= detailFormWithGrids.DetailGrids.Count) { break; } // 主是ControlManager,并不一定子也是ControlManager。 // 主可以在grid编辑,不能通过DetailForm编辑。此时DetailForm是另外显示的东西。 if (isControlManagerEnable) { var daoRelational = daoParent as IRelationalDao; if (daoRelational == null) { throw new ArgumentException("IArchiveDetailFormWithDetailGrids must has IRelationalDao."); } ISearchManager subSm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], cmParent.DisplayManager); IWindowControlManager subCm = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(detailFormTabInfos[i], subSm) as IWindowControlManager; subCm.Name = detailFormTabInfos[i].Name; ((IArchiveGrid)detailFormWithGrids.DetailGrids[i]).SetControlManager(subCm, detailFormTabInfos[i].GridName); ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos[i]); IBaseDao subDao = daoRelational.GetRelationalDao(i); if (subDao is IMemoriedRelationalDao) { IMemoryDao subMemoryDao = ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).DetailMemoryDao; subCm.Dao = subMemoryDao; //subMemoryDao.AddSubDao(new MasterDetailMemoryDao<>(cmParent)); ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).AddRelationToMemoryDao(cmParent.DisplayManager); } else { subCm.Dao = subDao; } } else { ISearchManager subSm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], dmParent); IDisplayManager subDm = ServiceProvider.GetService <IManagerFactory>().GenerateDisplayManager(detailFormTabInfos[i], subSm); subDm.Name = detailFormTabInfos[i].Name; detailFormWithGrids.DetailGrids[i].SetDisplayManager(subDm, detailFormTabInfos[i].GridName); } GenerateDetailGrids(detailFormWithGrids.DetailGrids[i], detailFormTabInfos[i]); } } if (isControlManagerEnable) { // Generate Other Daos for (int i = 0; i < detailFormTabInfos2.Count; ++i) { if (!string.IsNullOrEmpty(detailFormTabInfos2[i].BusinessLayerClassName)) { ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos2[i]); } } } // if Master Tab's IsInDetailForm=false, Invisible it if (!tabInfos[0].IsInDetailForm) { if (detailForm is IArchiveDetailFormAuto) { (detailForm as IArchiveDetailFormAuto).RemoveControls(); } } return(detailForm); }
private void 任务预备案_Load(object sender, EventArgs e) { m_rightGrid = base.AssociateArchiveGrid(pnl待确认区, "任务备案_任务预备案") as ArchiveUnboundGrid; var cm = m_rightGrid.ControlManager; m_cm = m_rightGrid.ControlManager as IWindowControlManager; m_cmT = m_cm as IWindowControlManager<任务>; MyTemplateForm.AddControl(pnl备案明细窗体, new 备案明细窗体(cm, m_gridName)); cm.DisplayManager.DataControls["装货地编号"].SelectedDataValueChanged += new EventHandler(任务预备案_SelectedDataValueChanged); cm.DisplayManager.DataControls["卸货地编号"].SelectedDataValueChanged += new EventHandler(任务预备案_SelectedDataValueChanged); cm.StateControls.Add(new StateControl(btn预录入发送, false)); cm.StateControls.Add(new StateControl(btn暂存待确认, false)); cm.StateControls.Add(new StateControl(btn删除, StateType.View)); cm.StateControls.Add(new StateControl(btn新增任务, true)); cm.StateControls.Add(new StateControl(btn修改, StateType.View)); cm.StateControls.Add(new StateControl(btn文件导入, true)); cm.DisplayManager.PositionChanged += new EventHandler(DisplayManager_PositionChanged); cm.DisplayManager.PositionChanging += new CancelEventHandler(DisplayManager_PositionChanging); //MyTemplateForm.RestrictToUserAccess(m_cm.DisplayManager.SearchManager, "备案主管"); Helper.SetGridDefault(this, m_rightGrid); cm.DisplayManager.SearchManager.LoadData(); }
/// <summary> /// /// </summary> /// <param name="cm"></param> /// <param name="controlGroupName"></param> public ArchiveDetailFormAuto(IWindowControlManager cm, string controlGroupName) : base(cm, controlGroupName) { InitializeComponent(); }
private static void SetDetailGridsReadOnly(IWindowControlManager cm, GridRowInfo rowInfo) { // DetailGrid if (!string.IsNullOrEmpty(rowInfo.DetailGridReadOnly)) { object[] ss = ParamCreatorHelper.TryGetParams(rowInfo.DetailGridReadOnly); foreach (object s in ss) { //string[] sss = s.ToString().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); object[] sss = ParamCreatorHelper.TryGetParams((string)s); // 第一个是GridName,第二个是权限 if (sss.Length == 2) { foreach (IStateControl sc in cm.StateControls) { ArchiveUnboundGrid detailGrid = sc as ArchiveUnboundGrid; if (detailGrid != null && detailGrid.GridName == (string)sss[0]) { detailGrid.ReadOnly = Permission.AuthorizeByRule((string)sss[1], cm.DisplayManager.CurrentItem); // 不用重新设置,RowCell的ReadOnly在读取数据后就设置了。 // 在SetDataBinding时,凡是ReadOnly=true的都设置好。 // 不需要,无DataRow,不用设置。 Column.ReadOnly已经设置好了 //if (!detailGrid.ReadOnly) //{ // // 设置detailGrid的Row,Cell属性 // ArchiveUnboundGrid.SetGridRowCellPermissions(detailGrid); //} } } } else if (sss.Length == 1) { foreach (IStateControl sc in cm.StateControls) { ArchiveUnboundGrid detailGrid = sc as ArchiveUnboundGrid; if (detailGrid != null) { detailGrid.ReadOnly = Permission.AuthorizeByRule((string)sss[0], cm.DisplayManager.CurrentItem); } } } else { throw new ArgumentException("DetailGridReadOnly must have 2 or 1 param!"); } } } }
/// <summary> /// Constructor /// </summary> public ArchiveDetailForm(IWindowControlManager cm, string controlGroupName) : this() { SetControlMananger(cm, controlGroupName); }
//private 任务Dao m_rwDao = new 任务Dao(); private void 进口箱批量任务录入_Load(object sender, EventArgs e) { m_暂存区Grid = base.AssociateArchiveGrid(pnl暂存区, "任务备案_进口箱批量任务录入_暂存区") as ArchiveUnboundGrid; m_cm = m_暂存区Grid.ControlManager as IWindowControlManager<进口票>; m_显示区Grid = MyTemplateForm.AssociateArchiveDetailGrid(pnl显示区, "任务备案_进口箱批量任务录入_显示区", m_cm, m_cm.Dao as IRelationalDao) as ArchiveUnboundGrid; m_cm2 = m_显示区Grid.ControlManager as IWindowControlManager<任务>; base.AssociateDataControls(new Control[] { pnl任务性质, pnl转关箱标志, pnl委托人, pnl委托时间, pnl委托联系人, pnl船名, pnl航次,pnl提箱时间要求, pnl还箱进港时间要求, pnl备注, pnl总箱量, pnl提单号, pnl提示性箱号, pnl箱属船公司 }, m_cm.DisplayManager, m_gridName); m_cm.StateControls.Add(new StateControl(btn新增任务, true)); m_cm.StateControls.Add(new StateControl(btn暂存待确认, false)); m_cm.StateControls.Add(new StateControl(btn删除, StateType.View)); m_cm.StateControls.Add(new StateControl(btn修改, StateType.View)); m_cm.StateControls.Add(new StateControl(btn预录入发送, false)); m_cm.StateControls.Add(new StateControl(btn网上导入, false)); m_cm.DisplayManager.DataControls["委托人编号"].SelectedDataValueChanged += new EventHandler(任务预备案_委托人编号_SelectedDataValueChanged); //MyTemplateForm.RestrictToUserAccess(m_cm.DisplayManager.SearchManager, "备案主管"); RemoveGridValidations(); m_cm.DisplayManager.PositionChanging += new Feng.CancelEventHandler(DisplayManager_PositionChanging); m_cm.DisplayManager.PositionChanged += new EventHandler(DisplayManager_PositionChanged); Helper.SetGridDefault(this, m_暂存区Grid); m_cm.DisplayManager.SearchManager.LoadData(); }
public static void UpdateStatusDataControl(IWindowControlManager cm, string controlGroupName) { if (cm != null) { cm.UpdateControlsState(); SetDataControlReadOnly(cm, controlGroupName); ClearNotnullIcon(); AddValidations(cm, controlGroupName); } }
private static void SetDetailGridsAllowInsertVisible(IWindowControlManager cm, bool visible) { foreach (IStateControl sc in cm.StateControls) { ArchiveUnboundGrid detailGrid = sc as ArchiveUnboundGrid; if (detailGrid != null) { if (detailGrid.InsertionRow != null) { detailGrid.InsertionRow.Visible = visible; } } } }