通过数据表的DataSet输出XML做数据比对


摘要:

1、通过DataSetConvertToByStr实现XML转成DataSet
2、通过 关键字做逐条数据比对
 
原文链接:
http://www.lookdaima.com/page/docItemDetail.html?id=de9330c8-0bc9-46a4-b29e-681bd45d9ab7
 
界面效果:

相关代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" 
    Inherits="WebForms_WebPages_Blanks_WebTools_Dbs_DataCompares_Default"
    ValidateRequest="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <script language="javascript" type="text/javascript" src="<%=strPhyPath %>/JS/jquery-1.8.3.min.js"></script>

    <script language="javascript" type="text/javascript" src="<%=strPhyPath %>/JS/CreateCode.js"></script>

    <script language="javascript" type="text/javascript" src="<%=strPhyPath %>/JS/DateOper.js"></script>

    <style type="text/css">
        .slxdemo-oneline
        {
            -moz-border-bottom-colors: none;
            -moz-border-left-colors: none;
            -moz-border-right-colors: none;
            -moz-border-top-colors: none;
            border-collapse: collapse;
            border-color: #ccc;
            border-image: none;
            border-style: solid;
            border-width: 1px 0 0 1px;
            margin-top: 0px;
        }
        .slxdemo-oneline th, .slxdemo-oneline td
        {
            -moz-border-bottom-colors: none;
            -moz-border-left-colors: none;
            -moz-border-right-colors: none;
            -moz-border-top-colors: none;
            border-color: #ccc;
            border-image: none;
            border-style: solid;
            border-width: 0 1px 1px 0;
            padding: 6px;
            size: 14px;
        }
        a.DefaultHref
        {
            color: #0000FF;
            text-decoration: none;
        }
        a.DefaultHref:link
        {
            color: #0000FF;
            text-decoration: none;
        }
        a.DefaultHref:hover
        {
            color: #0000FF;
            text-decoration: underline;
        }
        a.DefaultHref:visited
        {
            color: #0000FF;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table border="0" cellpadding="0" cellspacing="5" width="100%">
            <tr>
                <td colspan="1">
                    &nbsp;
                </td>
                <td colspan="1">
                    <b>通过数据表的DataSet输出XML做数据比对</b> &nbsp; | <a href="Default.aspx" class="DefaultHref">刷新</a>
                </td>
            </tr>
            <tr>
                <td align="right" valign="top">
                    执行结果:
                </td>
                <td colspan="3">
                    <asp:Label ID="lbl_ResultTip" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 100px;">
                    源数据:
                </td>
                <td colspan="1">
                    <asp:TextBox ID="txt_Source" runat="server" Width="99%" Height="130px" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 100px;">
                    目标数据:
                </td>
                <td colspan="1">
                    <asp:TextBox ID="txt_Target" runat="server" Width="99%" Height="130px" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 100px;">
                    关键字:
                </td>
                <td colspan="1">
                    <asp:TextBox ID="txt_PkName" runat="server" Width="99%"></asp:TextBox>
                    <br />
                    (组合关键字用|做分隔)
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 100px;">
                    比较字段:
                </td>
                <td colspan="1">
                    <asp:TextBox ID="txt_DcName" runat="server" Width="99%" Height="100px" TextMode="MultiLine"></asp:TextBox>
                    <br />
                    (组合关键字用|做分隔)
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 100px; height: 35px;">
                    &nbsp;
                </td>
                <td colspan="1">
                    <asp:Button ID="btn_SourceDcName" runat="server" Text="源字段清单" OnClick="btn_SourceDcName_Click" />
                    <asp:Button ID="btn_SourceData" runat="server" Text="源数据" OnClick="btn_SourceData_Click" />
                    <asp:Button ID="btn_SourceRowCount" runat="server" Text="源记录数" OnClick="btn_SourceRowCount_Click" />
                    <asp:Button ID="btn_TargetDcName" runat="server" Text="目标字段清单" OnClick="btn_TargetDcName_Click" />
                    <asp:Button ID="btn_TargetData" runat="server" Text="目标数据" OnClick="btn_TargetData_Click" />
                    <asp:Button ID="btn_TargetRowCount" runat="server" Text="目标记录数" OnClick="btn_TargetRowCount_Click" />
                    &nbsp;
                    <asp:Button ID="btn_Example" runat="server" Text="样例" OnClick="btn_Example_Click" />
                    &nbsp; | <a href="Default.aspx" class="DefaultHref">刷新</a>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 100px; height: 35px;">
                    &nbsp;
                </td>
                <td colspan="1">
                    <asp:Button ID="btn_SourceMore" runat="server" Text="源多的数据" OnClick="btn_SourceMore_Click" />
                    <asp:Button ID="btn_TargetMore" runat="server" Text="目标多的数据" OnClick="btn_TargetMore_Click" />
                    <asp:Button ID="btn_EqualData" runat="server" Text="相同的数据" OnClick="btn_EqualData_Click" />
                    <asp:Button ID="btn_NoEqualData" runat="server" Text="不相同的数据" OnClick="btn_NoEqualData_Click" />
                    <asp:Button ID="btn_DcCompare" runat="server" Text="字段是否相同" OnClick="btn_DcCompare_Click" />
                </td>
            </tr>
            <tr>
                <td align="right" valign="top">
                    输出:
                </td>
                <td colspan="3">
                    <asp:Literal ID="lt_Result" runat="server"></asp:Literal>
                    <asp:TextBox ID="txt_Result" Visible="false" runat="server" Width="99%" Height="130px"
                        TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.IO;


public partial class WebForms_WebPages_Blanks_WebTools_Dbs_DataCompares_Default 
    :
    PageBase
{

    #region 样例数据

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Example_Click(object sender, EventArgs e)
    {
        txt_PkName.Text = "Guid";

        txt_Source.Text = @"
<NewDataSet>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>60cafcf3deb7458e90247bfc18aa846b</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-04T15:03:46.3125+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-04T15:03:46.3125+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-04T15:03:46+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>数量测试2</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>47a734fb88a14abd8ca0d82896d7d2f1</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-04T15:16:22.703125+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-04T15:16:22.703125+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-04T15:16:22+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>下次下发任务,是否情况此处内容?</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>1c109716f32140b88bec1e2e4622bcad</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-05T15:44:56.015625+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-05T15:44:56.015625+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-05T15:44:56+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>121212</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>9a6e271b22f94953bfc0cb55997ec477</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-04T15:03:31.921875+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-04T15:03:31.921875+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-04T15:03:31+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>数量测试1</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>a5b5763c85704fa2ab824c2a39649c6f</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-06T11:30:37.02593+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-06T11:30:37.02593+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-06T11:30:37+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>啊啊啊啊啊</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>e4899af22ac44fe8bec6085223fe218d</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-06T09:34:56.500608+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-06T09:34:56.500608+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-06T09:34:56+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>qqqqqqqqqq</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>f964b564b37b4e6f9cf70fa65802a0bc</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-06T09:37:35.601659+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-06T09:37:35.601659+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-06T09:37:35+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>zzzzzzzzzzzzz</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>5a2563ee706945168ae7837a931321f6</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-01T16:36:43.569723+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-01T16:36:43.569723+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-01T16:36:43+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>202020</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>e0dc6581344447e4b36e4d9d11f0134c</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-05T14:57:01.6875+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-05T14:57:01.6875+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-05T14:57:01+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSSJ</JOB_GROUP>
    <JOB>LSSJ</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>撤销看APP情况</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>5913ee4a0f404e09bd39054233a906a4</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-05T14:19:04.453125+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-05T14:19:04.453125+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-05T14:19:04+08:00</ARCHIVE_DATE>
    <JOB_GROUP>TBDRW</JOB_GROUP>
    <JOB>TBDRW</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>1111111111</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>d8621396e58c4c9fbf3d1db5db0708a9</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-06T09:34:09.736506+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-06T09:34:09.736506+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-06T09:34:09+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>eeeeeee</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>0dd8b3e4521a41b19477f5af64dd0033</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-04T09:49:41.596452+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-04T09:49:41.596452+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-04T09:49:41+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>6666</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>73d9bc57540241a783028463de591e64</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-05T10:01:01.899396+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-05T10:01:01.899396+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-05T10:01:01+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>0010313</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>44ebd4cda4ae45e7ba0f945578c0fa4c</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-01T15:02:32.507773+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-01T15:02:32.507773+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-01T15:02:32+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>001</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>d8e40354480e42f3bb3c3a1bdd557d62</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-05T09:33:05.902947+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-05T09:33:05.902947+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-05T09:33:05+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>qqqqqqqqqqqqqq</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>f1ef5340e8254aeaaf0d236680ea8fd6</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-01T16:18:24.286178+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-01T16:18:24.286178+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-01T16:18:24+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>16161616</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
</NewDataSet>
";

        txt_Target.Text = @"
<NewDataSet>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>07af40d4960a4b7baf93bd6f9443f883</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-04T14:57:30.125+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-04T14:57:30.125+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-04T14:57:30+08:00</ARCHIVE_DATE>
    <JOB_GROUP>TBDRW</JOB_GROUP>
    <JOB>TBDRW</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>随便来点</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>60cafcf3deb7458e90247bfc18aa846b</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-04T15:03:46.3125+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-04T15:03:46.3125+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-04T15:03:46+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>数量测试2</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>47a734fb88a14abd8ca0d82896d7d2f1</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-04T15:16:22.703125+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-04T15:16:22.703125+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-04T15:16:22+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>下次下发任务,是否情况此处内容?</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>1c109716f32140b88bec1e2e4622bcad</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-05T15:44:56.015625+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-05T15:44:56.015625+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-05T15:44:56+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>121212</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>9a6e271b22f94953bfc0cb55997ec477</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-04T15:03:31.921875+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-04T15:03:31.921875+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-04T15:03:31+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>数量测试1</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>a5b5763c85704fa2ab824c2a39649c6f</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-06T11:30:37.02593+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-06T11:30:37.02593+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-06T11:30:37+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>啊啊啊啊啊</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>e4899af22ac44fe8bec6085223fe218d</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-06T09:34:56.500608+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-06T09:34:56.500608+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-06T09:34:56+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>qqqqqqqqqq</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>f964b564b37b4e6f9cf70fa65802a0bc</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-06T09:37:35.601659+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-06T09:37:35.601659+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-06T09:37:35+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>zzzzzzzzzzzzz</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>5a2563ee706945168ae7837a931321f6</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-01T16:36:43.569723+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-01T16:36:43.569723+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-01T16:36:43+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>202020</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>e0dc6581344447e4b36e4d9d11f0134c</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-05T14:57:01.6875+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-05T14:57:01.6875+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-05T14:57:01+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSSJ</JOB_GROUP>
    <JOB>LSSJ</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>撤销看APP情况</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>5913ee4a0f404e09bd39054233a906a4</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-05T14:19:04.453125+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-05T14:19:04.453125+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-05T14:19:04+08:00</ARCHIVE_DATE>
    <JOB_GROUP>TBDRW</JOB_GROUP>
    <JOB>TBDRW</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>1111111111</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>d8621396e58c4c9fbf3d1db5db0708a9</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-06T09:34:09.736506+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-06T09:34:09.736506+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-06T09:34:09+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>eeeeeee</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>0dd8b3e4521a41b19477f5af64dd0033</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-04T09:49:41.596452+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-04T09:49:41.596452+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-04T09:49:41+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>6666</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>3e67f689e14e4539bdb3a46dde12814c</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-06T14:18:01.21875+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-06T14:18:01.21875+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-06T14:18:01+08:00</ARCHIVE_DATE>
    <JOB_GROUP>TBDRW</JOB_GROUP>
    <JOB>TBDRW</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>1417</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>73d9bc57540241a783028463de591e64</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-05T10:01:01.899396+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-05T10:01:01.899396+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-05T10:01:01+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LLLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>0010313</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>45ebd4cda4ae45e7ba0f945578c0fa4c</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-01T15:02:32.507773+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-01T15:02:32.507773+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-01T15:02:32+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>001</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
  <BS_NOFLIGHTJOB_ALLOCATION>
    <GUID>d8e40354480e42f3bb3c3a1bdd557d62</GUID>
    <INSERT_OPERATOR>A070388</INSERT_OPERATOR>
    <INSERT_TIME>2019-03-05T09:33:05.902947+08:00</INSERT_TIME>
    <UPDATE_TIME>2019-03-05T09:33:05.902947+08:00</UPDATE_TIME>
    <VALIDITY>1</VALIDITY>
    <ARCHIVE_DATE>2019-03-05T09:33:05+08:00</ARCHIVE_DATE>
    <JOB_GROUP>LSLJC</JOB_GROUP>
    <JOB>LSLJC</JOB>
    <STATUS>Allocation</STATUS>
    <INITIATIVE>0</INITIATIVE>
    <REQUIREMENT>qqqqqqqqqqqqqq</REQUIREMENT>
    <OVERDUE>0</OVERDUE>
    <ACCEPT_THRESHOLD>10</ACCEPT_THRESHOLD>
  </BS_NOFLIGHTJOB_ALLOCATION>
</NewDataSet>
";

    }

    #endregion 样例数据


    #region DataSetConvertToByStr|通过XML(字符串形式)转成DataSet

    /// <summary>
    /// 通过XML(字符串形式)转成DataSet
    /// </summary>
    /// <param name="str"></param>
    /// <returns></returns>
    private DataSet DataSetConvertToByStr(string str)
    {
        DataSet ds = new DataSet();

        using (StringReader xmlSR = new StringReader(str))
        {

            ds.ReadXml(xmlSR, XmlReadMode.InferTypedSchema); //忽视任何内联架构,从数据推断出强类型架构并加载数据。如果无法推断,则解释成字符串数据

            if (ds.Tables.Count > 0)
                return ds;
            else
                return null;
        }
    }

    #endregion DataSetConvertToByStr|通过XML(字符串形式)转成DataSet



    /// <summary>  
    ///   
    /// </summary>  
    /// <param name="strMsg"></param>  
    /// <param name="succFlag"></param>  
    protected void SetResultTip(string strMsg, bool succFlag)
    {

        if (succFlag)
        {
            lbl_ResultTip.ForeColor = System.Drawing.Color.Blue;
        }
        else
        {
            lbl_ResultTip.ForeColor = System.Drawing.Color.Red;
        }

        lbl_ResultTip.Text = strMsg + "&nbsp;" + DateTime.Now.ToString("HH:mm:ss");
    }


    #region 保存
 

    /// <summary>
    /// 保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Ok_Click(object sender, EventArgs e)
    {
        try
        {
            
            // btnOkClick();
        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    #endregion 保存


    

    /// <summary>
    /// 
    /// </summary>
    /// <param name="str"></param>
    /// <returns></returns>
    protected bool ListDcName(string str)
    {
        if (str == null || str.Length == 0 || str.Trim().Length == 0)
        {
            SetResultTip("请输入数据", false);
            return false;
        }

        DataSet ds = DataSetConvertToByStr(str.Trim());

        if (ds == null || ds.Tables.Count ==0)
        {
            SetResultTip("数据不正确", false);
            return false;
        }

        DataTable dt = ds.Tables[0];

        StringBuilder theResult = new StringBuilder();

        foreach (DataColumn dc in dt.Columns)
        {
            theResult.AppendLine(dc.ColumnName);
        }

        txt_Result.Visible = true;
        txt_Result.Text = theResult.ToString();

        SetResultTip("成功", true);

        return true;
    }


    /// <summary>
    /// 
    /// </summary>
    /// <param name="str"></param>
    /// <returns></returns>
    protected bool DataRowCount(string str)
    {
        if (str == null || str.Length == 0 || str.Trim().Length == 0)
        {
            SetResultTip("请输入数据", false);
            return false;
        }

        DataSet ds = DataSetConvertToByStr(str.Trim());

        if (ds == null || ds.Tables.Count == 0)
        {
            SetResultTip("数据不正确", false);
            return false;
        }

        DataTable dt = ds.Tables[0];

        lt_Result.Text = dt.Rows.Count.ToString();

        SetResultTip("成功", true);

        return true;
    }

    #region 源字段清单

    /// <summary>
    /// 源字段清单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SourceDcName_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            string str = txt_Source.Text.Trim();

            if (str.Length == 0)
            {
                SetResultTip("请输入源数据", false);
                return;
            }

            ListDcName(str);
            
        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    #endregion 源字段清单


    #region 目标字段清单

    /// <summary>
    /// 目标字段清单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_TargetDcName_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            string str = txt_Target.Text.Trim();

            if (str.Length == 0)
            {
                SetResultTip("请输入目标数据", false);
                return;
            }

            ListDcName(str);

        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    #endregion 目标字段清单


    
    #region 源记录数

    /// <summary>
    /// 源记录数
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SourceRowCount_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            string str = txt_Source.Text.Trim();

            if (str.Length == 0)
            {
                SetResultTip("请输入源数据", false);
                return;
            }

            DataRowCount(str);

        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    #endregion 源记录数

    #region 目标记录数

    /// <summary>
    /// 目标记录数
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_TargetRowCount_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            string str = txt_Target.Text.Trim();

            if (str.Length == 0)
            {
                SetResultTip("请输入目标数据", false);
                return;
            }

            DataRowCount(str);

        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    #endregion 目标记录数

    #region DataSetToHtmlTable:DataSet转成HTML的Table输出

    private const string P__SQLROWNUMBERVALUE = "P__SQLROWNUMBERVALUE";

    /// <summary>  
    /// DataSet转成HTML的Table输出 - DataSetToHtmlTable +  
    /// </summary>  
    /// <param name="ds"></param>   
    /// <returns></returns>  
    public string DataSetToHtmlTable(System.Data.DataSet ds)
    {
        return DataSetToHtmlTable(ds, -98, true, null);
    }

    /// <summary>  
    /// DataSet转成HTML的Table输出 - DataSetToHtmlTable +  
    /// </summary>  
    /// <param name="ds"></param>   
    /// <param name="showDcNameList">显示的字段列表</param>
    /// <returns></returns>  
    public string DataSetToHtmlTable(System.Data.DataSet ds, List<string> showDcNameList)
    {
        return DataSetToHtmlTable(ds, -98, true, showDcNameList);
    }


    /// <summary>  
    /// DataSet转成HTML的Table输出 - DataSetToHtmlTable +  
    /// </summary>  
    /// <param name="ds"></param>  
    /// <param name="needConvertHtml">是否需要转移Html内容</param>  
    /// <returns></returns>  
    public string DataSetToHtmlTable(System.Data.DataSet ds, bool needConvertHtml)
    {
        return DataSetToHtmlTable(ds, -98, needConvertHtml, null);
    }

    /// <summary>  
    /// DataSet转成HTML的Table输出 - DataSetToHtmlTable +  
    /// </summary>  
    /// <param name="ds"></param>  
    /// <param name="widthValue">表格宽度|如:-98=98%;120=120px</param>  
    /// <param name="needConvertHtml">是否需要转移Html内容</param>  
    /// <param name="showDcNameList">显示的字段列表</param>
    /// <returns></returns>  
    public string DataSetToHtmlTable(System.Data.DataSet ds, int widthValue, bool needConvertHtml,List<string> showDcNameList)
    {
        if (ds == null || ds.Tables.Count == 0)
        {

            throw new Exception
                (
                    "方法:"
                    + System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.FullName
                    + " "
                    + System.Reflection.MethodBase.GetCurrentMethod().ToString()
                    + " 发生异常:"
                    + "传入参数:DataSet ds为null。"
                );
        }

        string widthStyle = "";

        if (widthValue > 0)
        {
            widthStyle = " width:" + widthValue.ToString() + "px;";
        }
        else if (widthValue < 0)
        {
            widthStyle = " width:" + (-widthValue).ToString() + "%;";
        }

        System.Data.DataTable dt = ds.Tables[0];

        StringBuilder theResult = new StringBuilder();

        theResult.Append(@"<table style=""background-color: #CDCDCD; font-family: 仿宋;" + widthStyle + @""" align=""center"" border=""0"" cellpadding=""1"" cellspacing=""1"">");

        int rowIndex = 0;

        bool noAllDcFlag = false;

        if (showDcNameList != null && showDcNameList.Count > 0)
        {
            noAllDcFlag = true;
        }
        
        string strTmp = null;
        string columnName = null;
        object oValue = null;
        DateTime dtValue = DateTime.MinValue;

        if (needConvertHtml)
        {
          

            theResult.Append(@"<tr style=""background-color: #FFFFFF;"">");

            theResult.Append(@"<td style=""background-color: #FFFFFF; font-size: 18px; font-weight: bold; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; text-align: center;"" align=""center"" height=""30px"">");
            theResult.Append("序号");
            theResult.Append("</td>");

            foreach (System.Data.DataColumn dc in dt.Columns)
            {
                columnName = dc.ColumnName;


                if (columnName.Trim().ToUpper() == P__SQLROWNUMBERVALUE)
                {
                    continue;
                }

                if (noAllDcFlag)
                {
                    if (!showDcNameList.Contains(columnName.ToLower()))
                        continue;
                }

                strTmp = columnName;
                strTmp = strTmp.Replace("<", "&lt;").Replace(">", "&gt;");

                theResult.Append(@"<td style=""background-color: #FFFFFF; font-size: 18px; font-weight: bold; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; text-align: center;"" align=""center"" height=""30px"">");
                theResult.Append(strTmp);
                theResult.Append("</td>");
            }

            theResult.Append("</tr>");


            foreach (System.Data.DataRow dr in dt.Rows)
            {
                ++rowIndex;
                theResult.Append(@"<tr style=""background-color: #FFFFFF;"">");


                theResult.Append(@"<td style=""background-color: #FFFFFF; font-size: 14px; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; padding-left: 5px;"" align=""center"" height=""30px"">");
                theResult.Append(rowIndex.ToString());
                theResult.Append("</td>");

                foreach (System.Data.DataColumn dc in dt.Columns)
                {
                    columnName = dc.ColumnName;

                    if (columnName.Trim().ToUpper() == P__SQLROWNUMBERVALUE)
                    {
                        continue;
                    }

                    if (noAllDcFlag)
                    {
                        if (!showDcNameList.Contains(columnName.ToLower()))
                            continue;
                    }

                    oValue = dr[dc.ColumnName];

                    if (oValue == null || oValue == DBNull.Value)
                    {
                        strTmp = "";
                    }
                    else
                    {
                        if (oValue is DateTime)
                        {
                            dtValue = (DateTime)oValue;

                            if (dtValue.Date == dtValue)
                            {
                                strTmp = dtValue.ToString("yyyy-MM-dd");
                            }
                            else
                            {
                                strTmp = dtValue.ToString("yyyy-MM-dd HH:mm:ss");
                            }
                        }
                        else
                        {
                            strTmp = oValue.ToString();
                        }
                    }

                    strTmp = strTmp.Replace("<", "&lt;").Replace(">", "&gt;");

                    theResult.Append(@"<td style=""background-color: #FFFFFF; font-size: 14px; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; padding-left: 5px;"" align=""center"" height=""30px"">");
                    theResult.Append(strTmp);
                    theResult.Append("</td>");
                }

                theResult.Append("</tr>");
            }
        }
        else
        {
            theResult.Append(@"<tr style=""background-color: #FFFFFF;"">");


            theResult.Append(@"<td style=""background-color: #FFFFFF; font-size: 18px; font-weight: bold; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; text-align: center;"" align=""center"" height=""30px"">");
            theResult.Append("序号");
            theResult.Append("</td>");
            foreach (System.Data.DataColumn dc in dt.Columns)
            {

                columnName = dc.ColumnName;


                if (columnName.Trim().ToUpper() == P__SQLROWNUMBERVALUE)
                {
                    continue;
                }

                if (noAllDcFlag)
                {
                    if (!showDcNameList.Contains(columnName.ToLower()))
                        continue;
                }

                theResult.Append(@"<td style=""background-color: #FFFFFF; font-size: 18px; font-weight: bold; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; text-align: center;"" align=""center"" height=""30px"">");
                theResult.Append(dc.ColumnName);
                theResult.Append("</td>");
            }

            theResult.Append("</tr>");

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                ++rowIndex;
                theResult.Append(@"<tr style=""background-color: #FFFFFF;"">");



                theResult.Append(@"<td style=""background-color: #FFFFFF; font-size: 14px; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; padding-left: 5px;"" align=""center"" height=""30px"">");
                theResult.Append(rowIndex.ToString());
                theResult.Append("</td>");

                foreach (System.Data.DataColumn dc in dt.Columns)
                {

                    columnName = dc.ColumnName;


                    if (columnName.Trim().ToUpper() == P__SQLROWNUMBERVALUE)
                    {
                        continue;
                    }

                    if (noAllDcFlag)
                    {
                        if (!showDcNameList.Contains(columnName.ToLower()))
                            continue;
                    }

                    oValue = dr[dc.ColumnName];

                    if (oValue == null || oValue == DBNull.Value)
                    {
                        strTmp = "";
                    }
                    else
                    {
                        if (oValue is DateTime)
                        {
                            dtValue = (DateTime)oValue;

                            if (dtValue.Date == dtValue)
                            {
                                strTmp = dtValue.ToString("yyyy-MM-dd");
                            }
                            else
                            {
                                strTmp = dtValue.ToString("yyyy-MM-dd HH:mm:ss");
                            }
                        }
                        else
                        {
                            strTmp = oValue.ToString();
                        }
                    }


                    theResult.Append(@"<td style=""background-color: #FFFFFF; font-size: 14px; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; padding-left: 5px;"" align=""center"" height=""30px"">");
                    theResult.Append(strTmp);
                    theResult.Append("</td>");
                }

                theResult.Append("</tr>");
            }
        }

        theResult.Append("</table>");

        return theResult.ToString();
    }

    #endregion DataSetToHtmlTable:DataSet转成HTML的Table输出  

    #region StrToListStr:多行字符串转成List-string的值输出

    /// <summary>
    /// 多行字符串转成List-string的值输出
    /// </summary>
    /// <param name="str">字符串</param>
    /// <param name="toLowerFlag">是否转小写</param>
    /// <returns></returns>
    public List<string> StrToListStr(string str,bool toLowerFlag)
    {
        List<string> theResult = new List<string>();

        if (str == null)
            return theResult;

        str = str.Trim();

        if (str.Length == 0)
            return theResult;

        string[] sA = str.Split('\n');
        string strTmp = null;

        foreach (string s in sA)
        {
            if (s == null)
                continue;

            strTmp = s.Trim();

            if (strTmp.Length == 0)
                continue;

            if (toLowerFlag)
                strTmp = strTmp.ToLower();

            if (theResult.Contains(strTmp))
                continue;

            theResult.Add(strTmp);
        }

        return theResult;
    }

    #endregion StrToListStr:多行字符串转成List-string的值输出



    /// <summary>  
    /// DataSet转成HTML的Table输出 - DataSetToHtmlTable +  
    /// </summary>  
    /// <param name="ds"></param>  
    /// <param name="widthValue">表格宽度|如:-98=98%;120=120px</param>  
    /// <param name="needConvertHtml">是否需要转移Html内容</param>  
    /// <param name="showDcNameList">显示的字段列表</param>
    /// <returns></returns>  
    public string DataSetToHtmlTableForNoEqual
        (
            System.Data.DataSet ds, 
            int widthValue,   
            List<string> showDcNameList
        )
    {
        if (ds == null || ds.Tables.Count == 0)
        {

            throw new Exception
                (
                    "方法:"
                    + System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.FullName
                    + " "
                    + System.Reflection.MethodBase.GetCurrentMethod().ToString()
                    + " 发生异常:"
                    + "传入参数:DataSet ds为null。"
                );
        }

        string widthStyle = "";

        if (widthValue > 0)
        {
            widthStyle = " width:" + widthValue.ToString() + "px;";
        }
        else if (widthValue < 0)
        {
            widthStyle = " width:" + (-widthValue).ToString() + "%;";
        }

        System.Data.DataTable dt = ds.Tables[0];


        int rowCount = dt.Rows.Count;

        if (rowCount % 2 == 1)
        {
            return "数据错误,数据应该是2的倍数";
        }

        StringBuilder theResult = new StringBuilder();

        theResult.Append(@"<table style=""background-color: #CDCDCD; font-family: 仿宋;" + widthStyle + @""" align=""center"" border=""0"" cellpadding=""1"" cellspacing=""1"">");

        int rowIndex = 0;

        bool noAllDcFlag = false;

        if (showDcNameList != null && showDcNameList.Count > 0)
        {
            noAllDcFlag = true;
        }

        string strTmp = null;
        string columnName = null;
        object oValue = null;
        DateTime dtValue = DateTime.MinValue;
        DataRow drOne = null;
        DataRow drTwo = null;
        bool compareFlag = false;
        int rowSpan = 1;

        bool needConvertHtml = true;
        if (needConvertHtml)
        {
            theResult.Append(@"<tr style=""background-color: #FFFFFF;"">");

            theResult.Append(@"<td style=""background-color: #FFFFFF; font-size: 18px; font-weight: bold; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; text-align: center;"" align=""center"" height=""30px"">");
            theResult.Append("序号");
            theResult.Append("</td>");

            foreach (System.Data.DataColumn dc in dt.Columns)
            {
                columnName = dc.ColumnName;


                if (columnName.Trim().ToUpper() == P__SQLROWNUMBERVALUE)
                {
                    continue;
                }

                if (noAllDcFlag)
                {
                    if (!showDcNameList.Contains(columnName.ToLower()))
                        continue;
                }

                strTmp = columnName;
                strTmp = strTmp.Replace("<", "&lt;").Replace(">", "&gt;");

                theResult.Append(@"<td style=""background-color: #FFFFFF; font-size: 18px; font-weight: bold; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; text-align: center;"" align=""center"" height=""30px"">");
                theResult.Append(strTmp);
                theResult.Append("</td>");
            }

            theResult.Append("</tr>");

            for(int i = 0; i <rowCount;i=i+2)
            {
                drOne = dt.Rows[i];
                drTwo = dt.Rows[i + 1];

                ++rowIndex;
                theResult.Append(@"<tr style=""background-color: #FFFFFF;"">");


                theResult.Append(@"<td rowspan=""2"" style=""background-color: #FFFFFF; font-size: 14px; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; padding-left: 5px;"" align=""center"" height=""30px"">");
                theResult.Append(rowIndex.ToString());
                theResult.Append("</td>");

                foreach (System.Data.DataColumn dc in dt.Columns)
                {
                    columnName = dc.ColumnName;

                    if (columnName.Trim().ToUpper() == P__SQLROWNUMBERVALUE)
                    {
                        continue;
                    }

                    if (noAllDcFlag)
                    {
                        if (!showDcNameList.Contains(columnName.ToLower()))
                            continue;
                    }

                    compareFlag = ObjCompare(drOne[columnName], drTwo[columnName]);

                    if (compareFlag)
                    {
                        rowSpan = 2;
                    }
                    else
                    {
                        rowSpan = 1;
                    }

                    oValue = drOne[columnName];

                    if (oValue == null || oValue == DBNull.Value)
                    {
                        strTmp = "";
                    }
                    else
                    {
                        if (oValue is DateTime)
                        {
                            dtValue = (DateTime)oValue;

                            if (dtValue.Date == dtValue)
                            {
                                strTmp = dtValue.ToString("yyyy-MM-dd");
                            }
                            else
                            {
                                strTmp = dtValue.ToString("yyyy-MM-dd HH:mm:ss");
                            }
                        }
                        else
                        {
                            strTmp = oValue.ToString();
                        }
                    }

                    strTmp = strTmp.Replace("<", "&lt;").Replace(">", "&gt;");

                    theResult.Append(@"<td rowspan=""" + rowSpan.ToString() + @""" style=""background-color: #FFFFFF; font-size: 14px; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; padding-left: 5px;"" align=""center"" height=""30px"">");
                    theResult.Append(strTmp);
                    theResult.Append("</td>");
                }

                theResult.Append("</tr>");

                theResult.Append(@"<tr style=""background-color: #FFFFFF;"">");

 
                foreach (System.Data.DataColumn dc in dt.Columns)
                {
                    columnName = dc.ColumnName;

                    if (columnName.Trim().ToUpper() == P__SQLROWNUMBERVALUE)
                    {
                        continue;
                    }

                    if (noAllDcFlag)
                    {
                        if (!showDcNameList.Contains(columnName.ToLower()))
                            continue;
                    }

                    compareFlag = ObjCompare(drOne[columnName], drTwo[columnName]);

                    if (compareFlag)
                    {
                        continue;
                    }

                    rowSpan = 1;

                    oValue = drTwo[columnName];

                    if (oValue == null || oValue == DBNull.Value)
                    {
                        strTmp = "";
                    }
                    else
                    {
                        if (oValue is DateTime)
                        {
                            dtValue = (DateTime)oValue;

                            if (dtValue.Date == dtValue)
                            {
                                strTmp = dtValue.ToString("yyyy-MM-dd");
                            }
                            else
                            {
                                strTmp = dtValue.ToString("yyyy-MM-dd HH:mm:ss");
                            }
                        }
                        else
                        {
                            strTmp = oValue.ToString();
                        }
                    }

                    strTmp = strTmp.Replace("<", "&lt;").Replace(">", "&gt;");

                    theResult.Append(@"<td rowspan=""" + rowSpan.ToString() + @""" style=""background-color: #FFFFFF; font-size: 14px; font-family: 宋体; line-height: 20pt; vertical-align: middle; line-height: 20pt; padding-left: 5px;"" align=""center"" height=""30px"">");
                    theResult.Append(strTmp);
                    theResult.Append("</td>");
                }

                theResult.Append("</tr>");
            }
        }
         

        theResult.Append("</table>");

        return theResult.ToString();
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="str"></param>
    /// <returns></returns>
    protected bool ShowHtmlData(string str)
    {
        if (str == null || str.Length == 0 || str.Trim().Length == 0)
        {
            SetResultTip("请输入数据", false);
            return false;
        }

        DataSet ds = DataSetConvertToByStr(str.Trim());

        if (ds == null || ds.Tables.Count == 0)
        {
            SetResultTip("数据不正确", false);
            return false;
        }

        string dcName = txt_DcName.Text.Trim();

        List<string> showDcNameList = null;

        if (dcName.Length > 0)
        {
            showDcNameList = StrToListStr(dcName, true);
        }

        string strHtml = DataSetToHtmlTable(ds, showDcNameList);

        lt_Result.Text = strHtml;

        SetResultTip("成功", true);

        return true;
        
    }

    protected void btn_TargetData_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            string str = txt_Target.Text.Trim();

            if (str.Length == 0)
            {
                SetResultTip("请输入目标数据", false);
                return;
            }

            ShowHtmlData(str);

        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SourceData_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            string str = txt_Source.Text.Trim();

            if (str.Length == 0)
            {
                SetResultTip("请输入源数据", false);
                return;
            }

            ShowHtmlData(str);

        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    public enum EmOper
    {
        /// <summary>
        /// 源多的数据
        /// </summary>
        源多的数据 = 1,
        /// <summary>
        /// 目标多的数据
        /// </summary>
        目标多的数据,
        /// <summary>
        /// 相同的数据
        /// </summary>
        相同的数据,
        /// <summary>
        /// 不相同的数据
        /// </summary>
        不相同的数据,
        /// <summary>
        /// 字段比较
        /// </summary>
        字段比较
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sourceFlag"></param>
    /// <param name="dt"></param>
    /// <param name="sA"></param>
    /// <returns></returns>
    public bool DataTableContainColumns(bool sourceFlag,DataTable dt,List<string> sA)
    {
        if (sA == null)
            return true;
         
        string strTmp = null;
        foreach (string s in sA)
        {
            if (s == null || s.Length == 0)
                continue;

            strTmp = s.Trim();

            if(strTmp.Length ==0)
                continue;

            if (!dt.Columns.Contains(strTmp))
            {
                if (sourceFlag)
                {
                    SetResultTip("源不包含" + strTmp + "字段", false);
                }
                else
                {
                    SetResultTip("目标不包含" + strTmp + "字段", false);
                }

                return false;
            }
        }

        return true;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sA"></param>
    /// <returns></returns>
    public List<string> StrArrayToStrList(string[] sA)
    {
        List<string> theResult = new List<string>();

        if (sA == null || sA.Length == 0)
            return theResult;

        string strTmp = null;

        foreach (string s in sA)
        {
            if (s == null)
                continue;

            strTmp = s.Trim();

            if (theResult.Contains(strTmp))
                continue;

            theResult.Add(strTmp);
        }

        return theResult;
    }

    /// <summary>
    /// 不考虑多对一的情况
    /// </summary>
    /// <param name="drData"></param>
    /// <param name="dt"></param>
    /// <param name="pkList"></param>
    /// <returns></returns>
    protected DataRow DataRowFind(DataRow drData, DataTable dt, List<string> pkList)
    {
        bool findFlag = false;
        bool compareFlag = false;

        foreach (DataRow dr in dt.Rows)
        {
            findFlag = true;

            foreach (string pk in pkList)
            {
                compareFlag = ObjCompare(dr[pk], drData[pk]);

                if(!compareFlag)
                {
                    findFlag = false;
                    break;
                }
            }

            if (findFlag)
            {
                return dr;
            }
        }

        return null;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="objOne"></param>
    /// <param name="objTwo"></param>
    /// <returns></returns>
    protected bool ObjCompare(object objOne, object objTwo)
    {
        bool oneIsEmpty = false;
        bool twoIsEmpty = false;

        if (objOne == null || objOne == DBNull.Value || objOne.ToString().Length == 0)
        {
            oneIsEmpty = true;
        }

        if (objTwo == null || objTwo == DBNull.Value || objTwo.ToString().Length == 0)
        {
            twoIsEmpty = true;
        }

        if (oneIsEmpty)
        {
            if (twoIsEmpty)
                return true;
            else
                return false;
        }

        if (twoIsEmpty)
        {
            if (oneIsEmpty)
                return true;
            else
                return false;
        }


        string strOne = objOne.ToString();
        string strTwo = objTwo.ToString();

        if (strOne == strTwo)
            return true;

        return false;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="drOne"></param>
    /// <param name="drTwo"></param>
    /// <param name="dcList"></param>
    /// <returns></returns>
    protected bool DataRowCompare(DataRow drOne, DataRow drTwo, List<string> dcList)
    {
        bool noAllDcList = false;

        if (dcList != null && dcList.Count > 0)
        {
            noAllDcList = true;
        }

        bool compareFlag = false;
        string dcName = null;

        DataTable dtOne = drOne.Table;
            DataTable dtTwo = drTwo.Table;

        if (noAllDcList)
        {
          
            foreach (string s in dcList)
            {
                dcName = s;
                if (dcName == null || dcName.Length == 0)
                    continue;

                dcName = dcName.Trim();

                if (dcName.Length == 0)
                    continue;

                if (!dtOne.Columns.Contains(dcName))
                    return false;

                if (!dtTwo.Columns.Contains(dcName))
                    return false;


                compareFlag = ObjCompare(drOne[dcName], drTwo[dcName]);

                if (!compareFlag)
                    return false;
            }
        }
        else
        {
            
            foreach (DataColumn dc in dtOne.Columns)
            {
                dcName = dc.ColumnName;

                if (!dtTwo.Columns.Contains(dcName))
                    return false;

                compareFlag = ObjCompare(drOne[dcName], drTwo[dcName]);

                if (!compareFlag)
                    return false;
            }
        }

        return true;

    }


    /// <summary>
    /// 
    /// </summary>
    /// <param name="em"></param>
    /// <returns></returns>
    public bool DataCompareOper(EmOper em)
    {
        string strSource = txt_Source.Text.Trim();

        if (strSource.Length == 0)
        {
            SetResultTip("请输入源数据", false);
            return false;
        }

        string strTarget = txt_Target.Text.Trim();

        if (strTarget.Length == 0)
        {
            SetResultTip("请输入目标数据", false);
            return false;
        }

        string pkName = txt_PkName.Text.Trim();

        if (pkName.Length == 0)
        {
            SetResultTip("请输入比较关键字", false);
            return false;
        }

        string[] pkA = pkName.Split('|');

        List<string> pkList = StrArrayToStrList(pkA);

        string dcName = txt_DcName.Text.Trim();

        List<string> dcList = null;

        if (dcName.Length > 0)
        {
            dcList = StrToListStr(dcName, false);
        }

        DataSet dsSource = DataSetConvertToByStr(strSource);
        DataSet dsTarget = DataSetConvertToByStr(strTarget);

        if (dsSource == null || dsSource.Tables.Count == 0 || dsSource.Tables[0].Rows.Count == 0)
        {
            SetResultTip("源数据为空", false);
            return false;
        }

        if (dsTarget == null || dsTarget.Tables.Count == 0 || dsTarget.Tables[0].Rows.Count == 0)
        {
            SetResultTip("目标数据为空", false);
            return false;
        }

        DataTable dtSource = dsSource.Tables[0];
        DataTable dtTarget = dsTarget.Tables[0];

        bool resultFlag = DataTableContainColumns(true, dtSource, pkList);

        if (!resultFlag)
            return false;

        resultFlag = DataTableContainColumns(false, dtTarget, pkList);

        if (!resultFlag)
            return false;

        resultFlag = DataTableContainColumns(true, dtSource, dcList);

        if (!resultFlag)
            return false;

        resultFlag = DataTableContainColumns(false, dtTarget, dcList);

        if (!resultFlag)
            return false;

        DataSet dsResult = new DataSet();
        DataTable dtResult = null;

        DataRow drFind = null;
        bool compareFlag = false;

        switch (em)
        {
            case EmOper.源多的数据:
                dtResult = dtSource.Clone();

                foreach (DataRow drS in dtSource.Rows)
                {
                    drFind = DataRowFind(drS, dtTarget, pkList);

                    if (drFind == null)
                    {
                        dtResult.ImportRow(drS);
                    }
                }

                if (dtResult.Rows.Count == 0)
                {
                    lt_Result.Text = "没有记录";
                    return true;
                }

                dsResult.Tables.Add(dtResult);
                lt_Result.Text = DataSetToHtmlTable(dsResult, dcList);
                SetResultTip(em.ToString() + "操作成功", true);
                return true;
            case EmOper.目标多的数据:
                dtResult = dtTarget.Clone();

                foreach (DataRow drS in dtTarget.Rows)
                {
                    drFind = DataRowFind(drS, dtSource, pkList);

                    if (drFind == null)
                    {
                        dtResult.ImportRow(drS);
                    }


                }

                if (dtResult.Rows.Count == 0)
                {
                    lt_Result.Text = "没有记录";
                    return true;
                }

                dsResult.Tables.Add(dtResult);
                lt_Result.Text = DataSetToHtmlTable(dsResult, dcList);
                SetResultTip(em.ToString() + "操作成功", true);
                return true;
            case EmOper.相同的数据:
                dtResult = dtSource.Clone();

                foreach (DataRow drS in dtSource.Rows)
                {
                    drFind = DataRowFind(drS, dtTarget, pkList);

                    if (drFind == null)
                    {
                        continue;
                    }

                    compareFlag = DataRowCompare(drFind, drS, dcList);

                    if (compareFlag)
                    {
                        dtResult.ImportRow(drS);
                    }
                }

                if (dtResult.Rows.Count == 0)
                {
                    lt_Result.Text = "没有记录";
                    return true;
                }

                dsResult.Tables.Add(dtResult);
                lt_Result.Text = DataSetToHtmlTable(dsResult, dcList);
                SetResultTip(em.ToString() + "操作成功", true);
                return true;
            case EmOper.不相同的数据:
                dtResult = dtSource.Clone();

                foreach (DataRow drS in dtSource.Rows)
                {
                    drFind = DataRowFind(drS, dtTarget, pkList);

                    if (drFind == null)
                    {
                        continue;
                    }

                    compareFlag = DataRowCompare(drFind, drS, dcList);

                    if (!compareFlag)
                    {
                        dtResult.ImportRow(drS);
                        dtResult.ImportRow(drFind);
                    }
                }

                if (dtResult.Rows.Count == 0)
                {
                    lt_Result.Text = "没有记录";
                    return true;
                }

                dsResult.Tables.Add(dtResult);
                lt_Result.Text =
                    DataSetToHtmlTableForNoEqual(dsResult, -99, dcList);

                SetResultTip(em.ToString() + "操作成功", true);
                return true;
            case EmOper.字段比较:
                StringBuilder sourceMoreSb = new StringBuilder();
                StringBuilder targetMoreSb = new StringBuilder();

                foreach (DataColumn dc in dtSource.Columns)
                {
                    if (!dtTarget.Columns.Contains(dc.ColumnName))
                    {
                        sourceMoreSb.AppendLine(dc.ColumnName);
                    }
                }

                foreach (DataColumn dc in dtTarget.Columns)
                {
                    if (!dtSource.Columns.Contains(dc.ColumnName))
                    {
                        targetMoreSb.AppendLine(dc.ColumnName);
                    }
                }

                StringBuilder compareResultSb = new StringBuilder();
                string strCompareTmp = sourceMoreSb.ToString();

                if (strCompareTmp.Length > 0)
                {
                    compareResultSb.AppendLine("源多的字段:");
                    compareResultSb.AppendLine(strCompareTmp);
                }

                strCompareTmp = targetMoreSb.ToString();

                if (strCompareTmp.Length > 0)
                {
                    compareResultSb.AppendLine("目标多的字段:");
                    compareResultSb.AppendLine(strCompareTmp);
                }

                strCompareTmp = compareResultSb.ToString();

                if (strCompareTmp.Length > 0)
                {
                    txt_Result.Visible = true;
                    txt_Result.Text = strCompareTmp;
                }
                else
                {
                    lt_Result.Text = em.ToString()+"相同";
                }
                SetResultTip(em.ToString() + "操作成功", true);
                return true;

            default:
                SetResultTip(em.ToString() + "未实现", false);
                return false;
        } 

    }

    /// <summary>
    /// 不相同的数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_NoEqualData_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            DataCompareOper(EmOper.不相同的数据);

        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    /// <summary>
    /// 源多的数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SourceMore_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            DataCompareOper(EmOper.源多的数据);

        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    /// <summary>
    /// 相同的数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_EqualData_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            DataCompareOper(EmOper.相同的数据);

        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    /// <summary>
    /// 目标多的数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_TargetMore_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            DataCompareOper(EmOper.目标多的数据);

        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }


    /// <summary>
    /// 字段是否相同
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_DcCompare_Click(object sender, EventArgs e)
    {
        try
        {
            lt_Result.Text = "";
            txt_Result.Visible = false;

            DataCompareOper(EmOper.字段比较);

        }
        catch (Exception err)
        {
            SetResultTip(err.Message, false);
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {



    }
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值