public static void Add(string lb, string dbase, string dtheir, string dmine, string ttheir, string tmine, string result) { MergeRowData evtData = new MergeRowData(); evtData.Label = lb; evtData.DesBase = dbase; evtData.DesTheir = dtheir; evtData.DesMine = dmine; evtData.TheirTag = ttheir; evtData.MyTag = tmine; evtData.Conflict = result == ""; evtData.ConflictResult = result; evtData.AutoMerge = result != ""; DataList.Add(evtData); }
private static void DetectRowChange() { foreach (var myRowData in dtMine) { if (myRowData.Value.Tag == "Add") { if (dtTheirs[myRowData.Key].Tag == "Add") { bool sameData = true; for (int j = 1; j < dtTheirs[myRowData.Key].Datas.Count; j++) { if (dtMine[myRowData.Key].Datas[j].Content != dtTheirs[myRowData.Key].Datas[j].Content) { sameData = false; break; } } if (sameData) //插了一样的数据,自动merge { MergeRowData.Add(myRowData.Key, "无记录", "添加了记录(相同)", "添加了记录(相同)", "", "", "添加了记录(相同)"); } else { MergeRowData.Add(myRowData.Key, "无记录", "添加了记录", "添加了记录(我)", "Modify", "", ""); } } else { MergeRowData.Add(myRowData.Key, "无记录", "无记录", "添加了记录(我)", "", "", "添加了记录(我)"); } } else if (myRowData.Value.Tag == "Delete") { var otherTag = dtTheirs[myRowData.Key].Tag; if (otherTag == "Modify") { MergeRowData.Add(myRowData.Key, "有记录", "修改了记录", "删除了记录(我)", "Add", "", ""); } else if (otherTag == "Delete") { //大家都删除,相安无事 MergeRowData.Add(myRowData.Key, "有记录", "删除了记录", "删除了记录", "", "", "删除了记录"); } else { MergeRowData.Add(myRowData.Key, "有记录", "无修改", "删除了记录(我)", "", "", "删除了记录(我)"); } } else if (myRowData.Value.Tag == "Modify") { var otherTag = dtTheirs[myRowData.Key].Tag; if (otherTag == "Modify") { // 不用考虑 } else if (otherTag == "Delete") { MergeRowData.Add(myRowData.Key, "有记录", "删除了记录", "修改了记录(我)", "Delete", "", ""); } } else { var otherTag = dtTheirs[myRowData.Key].Tag; if (otherTag == "Add") { MergeRowData.Add(myRowData.Key, "无记录", "添加了记录", "无记录", "Add", "", "添加了记录"); } else if (otherTag == "Delete") { MergeRowData.Add(myRowData.Key, "有记录", "删除了记录", "无修改(我)", "Delete", "", "删除了记录"); } } } }