/// <summary> /// 把查询出的差异转换成UI呈现对象 /// </summary> public void ConvertToCompareResult() { ResultsList.Clear(); RepairedNum = 0; UIShow = ""; foreach (var re in _service.DifTableList) { if (re.ErrorType == 1) { //丢失的列 foreach (var col in re.LostCol) { var tmp = new UICompareResult { ObjectName = re.SourceInfo.name, ObjectType = re.SourceInfo.type, ErrorItem = col.Name, ErrorItemType = "col", ErrorType = DicError[2] }; ResultsList.Add(tmp); UIShow = UIShow + tmp; } //冗余的列 foreach (var col in re.MoreCol) { var tmp = new UICompareResult { ObjectName = re.SourceInfo.name, ObjectType = re.SourceInfo.type, ErrorItem = col.Name, ErrorItemType = "col", ErrorType = DicError[3] }; ResultsList.Add(tmp); UIShow = UIShow + tmp; } } if (re.ErrorType == 2) { var tmp = new UICompareResult { ObjectName = re.SourceInfo.name, ObjectType = re.SourceInfo.type, ErrorItem = re.SourceInfo.name, ErrorItemType = re.SourceInfo.type, ErrorType = DicError[re.ErrorType] }; ResultsList.Add(tmp); UIShow = UIShow + tmp; } if (re.ErrorType == 3) { var tmp = new UICompareResult { ObjectName = re.TargetInfo.name, ObjectType = re.TargetInfo.type, ErrorItem = re.TargetInfo.name, ErrorItemType = re.TargetInfo.type, ErrorType = DicError[re.ErrorType] }; ResultsList.Add(tmp); UIShow = UIShow + tmp; } } if (new AppInfo().NeedCompareIndex) { foreach (var re in _service.DifIndexList) { //如果是丢失 对象信息从源对象取 if (re.ErrorType == 2) { var tmp = new UICompareResult { ObjectName = re.SourceInfo.name, ObjectType = re.SourceInfo.type, ErrorItem = re.SourceInfo.name, ErrorItemType = re.SourceInfo.type, ErrorType = DicError[re.ErrorType] }; ResultsList.Add(tmp); UIShow = UIShow + tmp; } //如果是冗余 对象信息从源对象取 if (re.ErrorType == 3) { var tmp = new UICompareResult { ObjectName = re.TargetInfo.name, ObjectType = re.TargetInfo.type, ErrorItem = re.TargetInfo.name, ErrorItemType = re.TargetInfo.type, ErrorType = DicError[re.ErrorType] }; ResultsList.Add(tmp); UIShow = UIShow + tmp; } } } UIThread.Invoke(() => { NeedRepairNum = ResultsList.Count; NotifyOfPropertyChange(() => CanRepairDB); }); }
/// <summary> /// 把查询出的差异转换成UI呈现对象 /// </summary> public void ConvertToCompareResult() { if (ResultsList == null) { ResultsList = new List <UICompareResult>(); } ResultsList.Clear(); foreach (var re in _service.DifTableList) { if (re.ErrorType == 1) { //丢失的列 foreach (var col in re.LostCol) { var tmp = new UICompareResult { ObjectName = re.SourceInfo.name, ObjectType = re.SourceInfo.type, ErrorItem = col.Name, ErrorItemType = "col", ErrorType = DicError[2] }; ResultsList.Add(tmp); UIShow = UIShow + tmp.ToString(); } //冗余的列 foreach (var col in re.MoreCol) { var tmp = new UICompareResult { ObjectName = re.SourceInfo.name, ObjectType = re.SourceInfo.type, ErrorItem = col.Name, ErrorItemType = "col", ErrorType = DicError[3] }; ResultsList.Add(tmp); UIShow = UIShow + tmp.ToString(); } } if (re.ErrorType == 2) { var tmp = new UICompareResult { ObjectName = re.SourceInfo.name, ObjectType = re.SourceInfo.type, ErrorItem = re.SourceInfo.name, ErrorItemType = re.SourceInfo.type, ErrorType = DicError[re.ErrorType] }; ResultsList.Add(tmp); UIShow = UIShow + tmp.ToString(); } if (re.ErrorType == 3) { var tmp = new UICompareResult { ObjectName = re.TargetInfo.name, ObjectType = re.TargetInfo.type, ErrorItem = re.TargetInfo.name, ErrorItemType = re.TargetInfo.type, ErrorType = DicError[re.ErrorType] }; ResultsList.Add(tmp); UIShow = UIShow + tmp.ToString(); } } if (new AppInfo().NeedCompareIndex) { foreach (var re in _service.DifIndexList) { //如果是丢失 对象信息从源对象取 if (re.ErrorType == 2) { var tmp = new UICompareResult { ObjectName = re.SourceInfo.name, ObjectType = re.SourceInfo.type, ErrorItem = re.SourceInfo.name, ErrorItemType = re.SourceInfo.type, ErrorType = DicError[re.ErrorType] }; ResultsList.Add(tmp); UIShow = UIShow + tmp.ToString(); } //如果是冗余 对象信息从源对象取 if (re.ErrorType == 3) { var tmp = new UICompareResult { ObjectName = re.TargetInfo.name, ObjectType = re.TargetInfo.type, ErrorItem = re.TargetInfo.name, ErrorItemType = re.TargetInfo.type, ErrorType = DicError[re.ErrorType] }; ResultsList.Add(tmp); UIShow = UIShow + tmp.ToString(); } } } }