using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Data; namespace SiaSun.LMS.WPFClient.FLOW_ACTION { /// /// /// public partial class MANAGE_ACTION : AvalonDock.DocumentContent { string strStatus = string.Empty; public MANAGE_ACTION() { InitializeComponent(); this.ucQueryManage.U_Query += new UC.ucQuickQuery.U_QueryEventHandler ((QueryWhere) => { try { this.gridManage.U_AppendWhere = QueryWhere; this.gridManage.U_InitControl(); this.gridManageList.U_DataSource = null; this.ucFlowManageAction.U_Clear(); this.SelectManageDefault(); } catch (Exception ex) { MainApp._MessageDialog.ShowException(ex); } } ); this.ucFlowManageAction.U_ExecuteUpdate += new UC.ucStatusFlowActionsPanel.ExecuteUpdateEventHandler (() => { try { this.gridManage.U_Update(); this.SelectManageDefault(); } catch (Exception ex) { MainApp._MessageDialog.ShowException(ex); } } ); this.gridManage.gridApp.GotFocus += new RoutedEventHandler(gridApp_GotFocus); } void gridApp_GotFocus(object sender, RoutedEventArgs e) { this.gridManage.gridApp.SelectionChanged -= new SelectionChangedEventHandler(gridApp_SelectionChanged); this.gridManage.gridApp.SelectionChanged += new SelectionChangedEventHandler(gridApp_SelectionChanged); } void gridApp_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (gridManage.gridApp.SelectedItem == null) { this.gridManageList.U_DataSource = null; return; } DataRow rowManage = (gridManage.gridApp.SelectedItem as DataRowView).Row; int intManageID = Convert.ToInt32(rowManage["MANAGE_ID"]); ManageListBind(intManageID); this.ManageActionBind(rowManage); } public MANAGE_ACTION(string STATUS) : this() { strStatus = STATUS; } //加载窗体 private void DocumentContent_Loaded(object sender, RoutedEventArgs e) { this.InitQueryControl(); this.Manage_Bind(); } /// /// 初始化查询控件 /// private void InitQueryControl() { try { this.ucQueryManage.U_XmlTableName = "V_MANAGE"; this.ucQueryManage.U_WindowName = this.GetType().Name; this.ucQueryManage.U_InitControl(); } catch (Exception ex) { MainApp._MessageDialog.ShowException(ex); } } /// /// /// private void Manage_Bind() { try { this.gridManage.U_WindowName = this.GetType().Name; this.gridManage.U_TableName = "V_MANAGE"; this.gridManage.U_OrderField = "MANAGE_ID"; //2016/6/28 lv string strWhere = string.Empty; this.gridManage.U_Where = string.Format(strWhere == string.Empty ? "1=1" : "{0} AND {1}", strWhere, strStatus.Length == 0 ? "1=1" : "MANAGE_STATUS IN(" + strStatus.Replace('|', ',') + ") "); this.gridManage.U_AllowChecked = false; this.gridManage.U_AllowOperatData = false; this.gridManage.U_AllowPage = false; this.gridManage.U_InitControl(); this.SelectManageDefault(); } catch (Exception ex) { MainApp._MessageDialog.ShowException(ex); } } /// /// /// private void SelectManageDefault() { if (this.gridManage.gridApp.SelectedItem != null) { DataRow rowManage = (gridManage.gridApp.SelectedItem as DataRowView).Row; int intManageID = Convert.ToInt32(rowManage["MANAGE_ID"]); ManageListBind(intManageID); this.ManageActionBind(rowManage); } } /// /// /// private void ManageListBind(int ManageID) { this.gridManageList.U_WindowName = this.GetType().Name; this.gridManageList.U_TableName = "V_MANAGE_LIST"; this.gridManageList.U_OrderField = "MANAGE_LIST_ID"; this.gridManageList.U_Where = string.Format("MANAGE_ID={0}", ManageID); this.gridManageList.U_SplitGroupColumn = "GOODS_TYPE_ID"; this.gridManageList.U_SplitGroupHeader = "GOODS_TYPE_NAME"; this.gridManageList.U_SplitPropertyColumn = "GOODS_PROPERTY"; this.gridManageList.U_SplitPropertyType = "GOODS_TYPE"; this.gridManageList.U_AllowChecked = false; this.gridManageList.U_AllowOperatData = false; this.gridManageList.U_AllowShowPage = false; //this.gridManageList.U_DetailTableName = "MANAGE_DETAIL"; //this.gridManageList.U_DetailRelatvieColumn = "MANAGE_LIST_ID"; this.gridManageList.U_InitControl(); } private void ManageActionBind(DataRow rowManage) { //初始化控件 this.ucFlowManageAction.U_FLOW_TYPE = "FLOW_MANAGE"; this.ucFlowManageAction.U_FLOW_SOURCE_ROW = rowManage; this.ucFlowManageAction.U_DataSource = MainApp._I_FlowService.ManageGetAction(rowManage["MANAGE_ID"].ToString()); this.ucFlowManageAction.U_InitControl(); } } }