// DataControl.SelectedDataValueChanged会触发DisplayManager.SelectedDataValueChanged会出发 void DisplayManager_SelectedDataValueChanged(object sender, SelectedDataValueChangedEventArgs e) { if (e.DataControlName == "任务性质") { 任务预备案_任务性质_SelectedDataValueChanged(e.Container, System.EventArgs.Empty); } }
public static void 车辆_车主驾驶员_对应(object sender, SelectedDataValueChangedEventArgs e) { if (e.DataControlName == "车辆编号") { IDisplayManager dm = sender as IDisplayManager; IDataControl dc = e.Container as IDataControl; if (dc != null) { if (dc.SelectedDataValue != null) { 车辆 cl = EntityBufferCollection.Instance.Get <车辆>(dc.SelectedDataValue); if (cl != null) { if (dm.DataControls["车主编号"] != null && dm.DataControls["车主编号"].SelectedDataValue == null) { dm.DataControls["车主编号"].SelectedDataValue = cl.车主编号; } if (dm.DataControls["承运人编号"] != null && dm.DataControls["承运人编号"].SelectedDataValue == null) { dm.DataControls["承运人编号"].SelectedDataValue = cl.车主编号; } if (dm.DataControls["驾驶员编号"] != null && dm.DataControls["驾驶员编号"].SelectedDataValue == null) { dm.DataControls["驾驶员编号"].SelectedDataValue = cl.默认驾驶员编号; } } } } else { Xceed.Grid.Cell cell = e.Container as Xceed.Grid.Cell; if (cell.Value != null) { 车辆 cl = EntityBufferCollection.Instance.Get <车辆>(cell.Value); if (cl != null) { if (cell.ParentRow.Cells["车主编号"] != null && cell.ParentRow.Cells["车主编号"].Value == null) { cell.ParentRow.Cells["车主编号"].Value = cl.车主编号; } if (cell.ParentRow.Cells["承运人编号"] != null && cell.ParentRow.Cells["承运人编号"].Value == null) { cell.ParentRow.Cells["承运人编号"].Value = cl.车主编号; } if (cell.ParentRow.Cells["驾驶员编号"] != null && cell.ParentRow.Cells["驾驶员编号"].Value == null) { cell.ParentRow.Cells["驾驶员编号"].Value = cl.默认驾驶员编号; } } } } } }
static void DisplayManagerPzfymx_SelectedDataValueChanged(object sender, SelectedDataValueChangedEventArgs e) { Xceed.Grid.Cell cell = e.Container as Xceed.Grid.Cell; IDisplayManager dm = sender as IDisplayManager; if (e.DataControlName == "费用项") { string fyx = (string)cell.ParentRow.Cells["费用项"].Value; if (fyx == "012") // 还借款 { cell.ParentRow.Cells["结算期限"].ReadOnly = false; } else { cell.ParentRow.Cells["结算期限"].ReadOnly = true; } } }
static void DisplayManagerPzsfmx_SelectedDataValueChanged(object sender, SelectedDataValueChangedEventArgs e) { if (e.DataControlName == "收付款方式" || e.DataControlName == "收付标志") { Xceed.Grid.Cell cell = e.Container as Xceed.Grid.Cell; cell.ParentRow.Cells["票据号码"].ReadOnly = true; cell.ParentRow.Cells["银行账户编号"].ReadOnly = true; cell.ParentRow.Cells["出票银行"].ReadOnly = true; cell.ParentRow.Cells["承兑期限"].ReadOnly = true; cell.ParentRow.Cells["付款人编号"].ReadOnly = true; if (cell.ParentRow.Cells["收付款方式"].Value != null && cell.ParentRow.Cells["收付标志"].Value != null) { 收付标志 a = (收付标志)cell.ParentRow.Cells["收付标志"].Value; 收付款方式 b = (收付款方式)cell.ParentRow.Cells["收付款方式"].Value; switch (a) { case 收付标志.收: cell.ParentRow.Cells["票据号码"].ReadOnly = !(b == 收付款方式.现金支票 || b == 收付款方式.转账支票 || b == 收付款方式.银行承兑汇票 || b == 收付款方式.银行本票汇票); cell.ParentRow.Cells["银行账户编号"].ReadOnly = !(b == 收付款方式.转账支票 || b == 收付款方式.银行本票汇票 || b == 收付款方式.银行收付); cell.ParentRow.Cells["出票银行"].ReadOnly = !(b == 收付款方式.银行承兑汇票); cell.ParentRow.Cells["承兑期限"].ReadOnly = !(b == 收付款方式.银行承兑汇票); cell.ParentRow.Cells["付款人编号"].ReadOnly = !(b == 收付款方式.银行承兑汇票); if (b == 收付款方式.银行承兑汇票) { cell.ParentRow.Cells["付款人编号"].Value = (cell.ParentRow.GridControl.FindForm() as ArchiveDetailForm).DisplayManager.DataControls["相关人编号"].SelectedDataValue; } else { cell.ParentRow.Cells["付款人编号"].Value = null; } break; case 收付标志.付: cell.ParentRow.Cells["票据号码"].ReadOnly = !(b == 收付款方式.现金支票 || b == 收付款方式.转账支票 || b == 收付款方式.银行承兑汇票); cell.ParentRow.Cells["银行账户编号"].ReadOnly = !(b == 收付款方式.银行收付 || b == 收付款方式.电汇); cell.ParentRow.Cells["出票银行"].ReadOnly = true; cell.ParentRow.Cells["承兑期限"].ReadOnly = true; cell.ParentRow.Cells["付款人编号"].ReadOnly = true; break; } } } }
/// <summary> /// 按照EventProcessInfo执行 /// </summary> /// <param name="eventProcessInfo"></param> /// <param name="processParams"></param> /// <returns></returns> private static void ExecuteEventProcess(EventProcessInfo eventProcessInfo, object sender, EventArgs e) { if (eventProcessInfo == null) { return; } if (!eventProcessInfo.IsActive) { return; } switch (eventProcessInfo.Type) { case EventProcessType.SelectedDataValueChanged: { SelectedDataValueChangedEventArgs e2 = e as SelectedDataValueChangedEventArgs; string[] ss = eventProcessInfo.ExecuteParam.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in ss) { string[] sss = s.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (sss.Length >= 2) { if (sss[0].Trim() == e2.DataControlName) { ExecuteEventProcess(ADInfoBll.Instance.GetEventProcessInfos(sss[1].Trim()), sender, e); } } } } break; case EventProcessType.ReloadNv: { SelectedDataValueChangedEventArgs e2 = e as SelectedDataValueChangedEventArgs; if (e2 != null) { IDisplayManager dm = sender as IDisplayManager; IDataControl dc = e2.Container as IDataControl; if (dc != null) { ReloadNvFromDataControl(eventProcessInfo, dm, dc, e2.DataControlName); } else { Xceed.Grid.Cell cell = e2.Container as Xceed.Grid.Cell; //if (cell == null) //{ // throw new ArgumentException("SelectedDataValueChangedEventArgs's Container type is invalid!"); //} if (cell != null) { ReloadNvFromGridCell(eventProcessInfo, dm, cell, e2.DataControlName); } else { ReloadNvFromEntity(eventProcessInfo, sender, e2.DataControlName); } } } } break; case EventProcessType.Process: Dictionary <string, object> dict = new Dictionary <string, object>(); dict["sender"] = sender; dict["e"] = e; ProcessInfoHelper.ExecuteProcess(ADInfoBll.Instance.GetProcessInfo(eventProcessInfo.ExecuteParam), dict); break; default: throw new ArgumentException("Invalid EventProcessInfo'Type of " + eventProcessInfo.Name + "!"); } }