Пример #1
0
        public static DataTable UnionHouse(DataTable tb)
        {
            DataTable table2;

            try
            {
                DataTable tbDst       = tb.Clone();
                DataRow[] rowArray    = tb.Select("PBSTypeFullName like '住宅%'", "BuildingName");
                string[]  columnNames = new string[] {
                    "TotalInvest", "TotalCompleteInvest", "PCurrentYearInvest", "BeforInvestAccout", "PTotalConstructSize", "PHouseConstructSize", "PToBuildConstructSize", "POtherConstructSize", "PTotalCompleteSize", "PHouseCompleteSize", "PToBuildCompleteSize", "POtherCompleteSize", "HouseArea", "HouseSize", "ToBuildSize", "OtherSize",
                    "RoomArea", "HouseRoomSize", "ToBuildRoomSize", "OtherRoomSize"
                };
                foreach (DataRow row in rowArray)
                {
                    DataRow drDst = tbDst.NewRow();
                    ConvertRule.DataRowCopy(row, drDst, tb, tbDst);
                    string    text      = ConvertRule.ToString(drDst["BuildingName"]);
                    DataRow[] rowArray2 = tb.Select(string.Format("BuildingName like '{0}%' and PBSTypeFullName not like '住宅%'", text));
                    foreach (DataRow row3 in rowArray2)
                    {
                        ConvertRule.DataRowAddDecimal(drDst, row3, columnNames);
                    }
                    tbDst.Rows.Add(drDst);
                }
                table2 = tbDst;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table2);
        }