//private object localResource = new Resources.Resource(); //public object LocalResource //{ // get { return localResource; } // set { localResource = value; } //} void client_GetLookupOjbectsCompleted(object sender, GetLookupOjbectsCompletedEventArgs e) { DtGrid.ItemsSource = null; if (e.Error != null && e.Error.Message != "") { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), e.Error.Message, Utility.GetResourceStr("CONFIRMBUTTON")); return; } //绑定系统类型 if (e.Result != null) { string rslt = e.Result; if (string.IsNullOrEmpty(rslt)) { return; } var objs = Utility.DeserializeObject(rslt, type); //DtGrid.ItemsSource = (IEnumerable)objs; //DataSource = (IEnumerable)objs; paging((IEnumerable)objs); DtGrid.Columns.Clear(); if (ColumnNames != null && ColumnNames.Length > 0) { //显示用户指定的列 foreach (string col in ColumnNames) { string colName = GetLocalName(col); if (!string.IsNullOrEmpty(colName)) { DataGridTextColumn txtCol = new DataGridTextColumn(); txtCol.Header = colName; txtCol.Binding = new Binding(col); DtGrid.Columns.Add(txtCol); } } } else { //TODO:反射实体取得所有列的信息 //Type a = ((PagedCollectionView)dataSource).CurrentItem.GetType(); //PropertyInfo[] infos = a.GetProperties(); //DataGridTextColumn[] columns = new DataGridTextColumn[infos.Length]; //string bindColumnName = string.Empty; //for (int i = 0; i < infos.Count(); i++) //{ // PropertyInfo pinfo = infos[i]; // bindColumnName = GetLocalName(pinfo.Name, LocalResource); // if (!string.IsNullOrEmpty(bindColumnName)) // { // columns[i] = new DataGridTextColumn(); // columns[i].Header = bindColumnName; // columns[i].Binding = new Binding(pinfo.Name); // DtGrid.Columns.Add(columns[i]); // } //} } } }
//private object localResource = new SMT.SaaS.OA.UI.Assets.Resources.OASystem(); //public object LocalResource //{ // get { return localResource; } // set { localResource = value; } //} void client_GetLookupOjbectsCompleted(object sender, GetLookupOjbectsCompletedEventArgs e) { //绑定系统类型 if (!string.IsNullOrEmpty(e.Result)) { string rslt = e.Result.ToString(); object objs = Utility.XmlToContractObject(rslt, EntityType); DtGrid.ItemsSource = (IEnumerable)objs; DataSource = (IEnumerable)objs; if (ColumnNames != null && ColumnNames.Count > 0) { //显示用户指定的列 DtGrid.Columns.Clear(); //add by zl foreach (var col in ColumnNames) { //string colName = GetLocalName(col.Key, LocalResource); string colName = GetLocalName(col.Key); if (!string.IsNullOrEmpty(colName)) { DataGridTextColumn txtCol = new DataGridTextColumn(); txtCol.Header = colName; txtCol.Binding = new Binding(col.Value); DtGrid.Columns.Add(txtCol); } } } else { //TODO:反射实体取得所有列的信息 //Type a = ((PagedCollectionView)dataSource).CurrentItem.GetType(); //PropertyInfo[] infos = a.GetProperties(); //DataGridTextColumn[] columns = new DataGridTextColumn[infos.Length]; //string bindColumnName = string.Empty; //for (int i = 0; i < infos.Count(); i++) //{ // PropertyInfo pinfo = infos[i]; // bindColumnName = GetLocalName(pinfo.Name, LocalResource); // if (!string.IsNullOrEmpty(bindColumnName)) // { // columns[i] = new DataGridTextColumn(); // columns[i].Header = bindColumnName; // columns[i].Binding = new Binding(pinfo.Name); // DtGrid.Columns.Add(columns[i]); // } //} } } else { DtGrid.ItemsSource = null; } }
//private object localResource = new Resources.Resource(); //public object LocalResource //{ // get { return localResource; } // set { localResource = value; } //} void client_GetLookupOjbectsCompleted(object sender, GetLookupOjbectsCompletedEventArgs e) { DtGrid.ItemsSource = null; if (e.Error != null && e.Error.Message != "") { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), e.Error.Message, Utility.GetResourceStr("CONFIRMBUTTON")); return; } //绑定系统类型 if (e.Result != null) { string rslt = e.Result; if (string.IsNullOrEmpty(rslt)) return; var objs = Utility.DeserializeObject(rslt, type); //DtGrid.ItemsSource = (IEnumerable)objs; //DataSource = (IEnumerable)objs; paging((IEnumerable)objs); DtGrid.Columns.Clear(); if (ColumnNames != null && ColumnNames.Length > 0) { //显示用户指定的列 foreach (string col in ColumnNames) { string colName = GetLocalName(col); if (!string.IsNullOrEmpty(colName)) { DataGridTextColumn txtCol = new DataGridTextColumn(); txtCol.Header = colName; txtCol.Binding = new Binding(col); DtGrid.Columns.Add(txtCol); } } } else { //TODO:反射实体取得所有列的信息 //Type a = ((PagedCollectionView)dataSource).CurrentItem.GetType(); //PropertyInfo[] infos = a.GetProperties(); //DataGridTextColumn[] columns = new DataGridTextColumn[infos.Length]; //string bindColumnName = string.Empty; //for (int i = 0; i < infos.Count(); i++) //{ // PropertyInfo pinfo = infos[i]; // bindColumnName = GetLocalName(pinfo.Name, LocalResource); // if (!string.IsNullOrEmpty(bindColumnName)) // { // columns[i] = new DataGridTextColumn(); // columns[i].Header = bindColumnName; // columns[i].Binding = new Binding(pinfo.Name); // DtGrid.Columns.Add(columns[i]); // } //} } } }
void client_GetLookupOjbectsCompleted(object sender, GetLookupOjbectsCompletedEventArgs e) { loadbar.Stop(); if (e.Error == null) { //绑定系统类型 if (string.IsNullOrEmpty(e.Result)) { return; } string rslt = e.Result.ToString(); object objs = SMT.FBAnalysis.UI.Common.Utility.XmlToContractObject(rslt, EntityType); DtGrid.ItemsSource = (IEnumerable)objs; DataSource = (IEnumerable)objs; dataPager.PageCount = e.pageCount; if (DtGrid.Columns.Count() > 1) { DtGrid.Columns.RemoveAt(1); } if (ColumnNames == null) { return; } if (ColumnNames.Count == 0) { return; } //显示用户指定的列 foreach (var col in ColumnNames) { string colName = GetLocalName(col.Key); if (string.IsNullOrEmpty(colName)) { continue; } DataGridTextColumn txtCol = new DataGridTextColumn(); txtCol.Header = colName; txtCol.Binding = GetColumnBinding(col.Value); txtCol.IsReadOnly = true; DtGrid.Columns.Add(txtCol); } } }