void lvSetting_SelectionChanged(object sender, SelectionChangedEventArgs e) { var item = lvSetting.SelectedItem as ViewColumnInfoItem; if (item != null) { mCurrentViewColumnItem = item; } }
private void LoadCustomColumnData() { try { mListObject_Kpi.Clear(); WebRequest webRequest = new WebRequest(); webRequest.Code = (int)RequestCode.WSGetUserViewColumnList; webRequest.Session = CurrentApp.Session; webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString()); webRequest.ListData.Add("4602001"); Service11012Client client = new Service11012Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11012")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } List <ViewColumnInfo> listColumns = new List <ViewColumnInfo>(); for (int i = 0; i < webReturn.ListData.Count; i++) { OperationReturn optReturn = XMLHelper.DeserializeObject <ViewColumnInfo>(webReturn.ListData[i]); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } ViewColumnInfo columnInfo = optReturn.Data as ViewColumnInfo; if (columnInfo != null) { columnInfo.Display = columnInfo.ColumnName; listColumns.Add(columnInfo); } } listColumns = listColumns.OrderBy(c => c.SortID).ToList(); if (listColumns.Where(p => p.SortID == 0).First().ColumnName == "UERName")//按对象分组 { rabObject.IsChecked = true; } else { rabKpi.IsChecked = true; } mListCustomColumns.Clear(); for (int i = 0; i < listColumns.Count; i++) { ViewColumnInfoItem item = new ViewColumnInfoItem(listColumns[i]); item.Display = CurrentApp.GetLanguageInfo(string.Format("4601P00{0}", item.LangID.ToString().Substring(1, 3)), item.ColumnName); item.StrIsVisible = CurrentApp.GetLanguageInfo(string.Format("4601P0004{0}", listColumns[i].Visibility), listColumns[i].Visibility); if (i % 2 != 0) { item.Background = Brushes.LightGray; } else { item.Background = Brushes.AntiqueWhite; } if (item.ColumnName == "UERName" || item.ColumnName == "KPIName")//对象、PM指标列不能修改顺序,在提交应用时再加上去 { mListObject_Kpi.Add(listColumns[i]); } else { mListCustomColumns.Add(item); } } } catch (Exception ex) { ShowException(ex.Message); } }
void BtnConfirm_Click(object sender, RoutedEventArgs e) { try { mAllColumnsList.Clear(); if (rabObject.IsChecked.Equals(true))//按对象分组 { mListObject_Kpi.Where(p => p.ColumnName == "UERName").First().SortID = 0; mListObject_Kpi.Where(p => p.ColumnName == "KPIName").First().SortID = 1; } else { mListObject_Kpi.Where(p => p.ColumnName == "KPIName").First().SortID = 0; mListObject_Kpi.Where(p => p.ColumnName == "UERName").First().SortID = 1; } foreach (ViewColumnInfo item in mListObject_Kpi) { ViewColumnInfoItem viewitem = new ViewColumnInfoItem(item); mAllColumnsList.Add(viewitem); } foreach (ViewColumnInfoItem item in mListCustomColumns) { mAllColumnsList.Add(item); } WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4602Codes.SaveViewColumnInfos; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add("4602001"); int intCount = mAllColumnsList.Count; webRequest.ListData.Add(intCount.ToString()); OperationReturn optReturn; for (int i = 0; i < intCount; i++) { optReturn = XMLHelper.SeriallizeObject(mAllColumnsList[i].ViewColumnInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } webRequest.ListData.Add(optReturn.Data.ToString()); } Service46012Client client = new Service46012Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service46012")); WebReturn webReturn = client.UPMSOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } #region 写操作日志 //string strLog = string.Format("{0}", Utils.FormatOptLogString("31021211")); //CurrentApp.WriteOperationLog(S3102Consts.OPT_CUSTOMSETTING.ToString(), ConstValue.OPT_RESULT_SUCCESS, strLog); #endregion ShowInformation(CurrentApp.GetLanguageInfo("4601P00045", "Save Sucessed!")); PageParent.CreateCharTable(); } catch (Exception ex) { ShowException(ex.Message); } }