Example #1
0
        public DataSet UpdateDataSet(DataSet oldSet, DataSet newDataSet, StageDef stage)
        {
            this.stage = stage;
            path       = localPath + @"\Data\Template\" + stage.Code + ".xls";
            BackupExcel(path);
            RebuildTemplate();

            DataSet addedDataSet = new DataSet()
            {
                DataSetName = oldSet.DataSetName
            };
            int count = newDataSet.Tables.Count;

            if (count > 5)
            {
                foreach (DataTable newTable in newDataSet.Tables)
                {
                    if (newTable.Rows.Count < 1)
                    {
                        continue;
                    }
                    DataTable       oldTable   = oldSet.Tables[newTable.TableName];
                    DGObjectDef     dG         = stage.DGObjectContainer.Find(x => (x.LangStr == newTable.TableName || x.Code == newTable.TableName));
                    TableComparator comparator = new TableComparator(oldTable, newTable, dG);
                    comparator.Compare();
                    DataTable UpdatedTable = comparator.updatedTable;
                    updatedDataSet = newDataSet.Clone();
                    updatedDataSet.Tables.Remove(UpdatedTable.TableName);
                    updatedDataSet.Tables.Add(UpdatedTable);

                    foreach (DataRow row in UpdatedTable.Rows)
                    {
                        oldTable.ImportRow(row);
                    }
                    oldSet.Tables.Remove(oldTable.TableName);
                    oldSet.Tables.Add(oldTable);
                }
            }

            return(oldSet);
        }
Example #2
0
        //主要功能是实现数据的比对、数据文件的备份、新的数据模板的生成
        //manin function is to compare data and select the new data
        public DataSet UpdateData(StageDef stage)
        {
            TableComparator comparator = new TableComparator(null, null, null);

            return(null);
        }