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; namespace SiaSun.LMS.WPFClient.SYS { /// /// DataGridWindow.xaml 的交互逻辑 /// public partial class SYS_USER : AvalonDock.DocumentContent { bool boolAllowEdit = true; string strTableName = string.Empty; string strOrderField = string.Empty; string strTotalColumn = string.Empty; string strWhere = string.Empty; /// /// 构造函数 /// /// 窗体显示名 /// 数据库表名 /// 查询条件 /// 是否显示选择列 /// 是否允许编辑数据 /// 计算数量总和的列名 public SYS_USER(string TabText, string TableName, string QueryWhere, string OrderField, bool AllowEdit, string TotalColumnName) { InitializeComponent(); //设置空间属性 this.Title = TabText; this.boolAllowEdit = AllowEdit; this.strTableName = TableName; this.strOrderField = OrderField; this.strTotalColumn = TotalColumnName; this.strWhere = QueryWhere; this.ucQKQuery.U_Query += new UC.ucQuickQuery.U_QueryEventHandler(ucQKQuery_U_Query); } /// /// 初始化窗体 /// private void DocumentContent_Loaded(object sender, RoutedEventArgs e) { //初始化查询控件 InitQueryControl(); //加载数据 LoadDataGrid(); } /// /// 初始化查询控件 /// private void InitQueryControl() { try { this.ucQKQuery.U_WindowName = this.GetType().Name; this.ucQKQuery.U_XmlTableName = this.strTableName; this.ucQKQuery.U_InitControl(); } catch (Exception ex) { MainApp._MessageDialog.ShowException(ex); } } /// /// 加载数据 /// private void LoadDataGrid() { try { this.gridQuery.U_WindowName = this.GetType().Name; this.gridQuery.U_TableName = this.strTableName; this.gridQuery.U_Where = this.strWhere; this.gridQuery.U_OrderField = this.strOrderField; this.gridQuery.U_TotalColumnName = this.strTotalColumn; this.gridQuery.U_AllowOperatData = this.boolAllowEdit; this.gridQuery.U_AllowPage = true; this.gridQuery.U_AllowChecked= this.boolAllowEdit; this.gridQuery.U_InitControl(); } catch (Exception ex) { MainApp._MessageDialog.ShowException(ex); } } //查询数据 void ucQKQuery_U_Query(string QueryWhere) { try { //查询 this.strWhere = string.IsNullOrEmpty(strWhere) ? "1=1" : strWhere; this.gridQuery.U_Where = string.IsNullOrEmpty(QueryWhere) ? strWhere : (QueryWhere.Length == 0 ? string.Empty : QueryWhere + " AND " + strWhere); this.gridQuery.U_InitControl(); } catch (Exception ex) { MainApp._MessageDialog.ShowException(ex); } } } }