Ejemplo n.º 1
0
        internal bool LoadExclusionData()
        {
            string fileName = Application.ExecutablePath.ToUpper().Replace("DBS2QVLS.EXE", "Exclusions.xml");

            ExclusionData.Clear();
            ExclusionList.Clear();
            ExclusionData.TableName = "ExclusionData";

            if (File.Exists(fileName))
            {
                ExclusionData.ReadXml(fileName);
            }
            else
            {
                return(false);
            }

            foreach (DataRow row in ExclusionData.Rows)
            {
                ExclusionItem ei = new ExclusionItem();
                ei.Row              = (int)row["Row"];
                ei.SourceTableName  = Convert.IsDBNull(row["SourceTableName"]) ? ""                         : (string)row["SourceTableName"];
                ei.SourceColumnName = Convert.IsDBNull(row["SourceColumnName"]) ? ""                        : (string)row["SourceColumnName"];
//				ei.DestinationTableName		= Convert.IsDBNull(row["DestinationTableName"]) ? ""	: (string) row["DestinationTableName"];
//				ei.DestinationColumnName	= Convert.IsDBNull(row["DestinationColumnName"]) ? ""	: (string) row["DestinationColumnName"];
                ExclusionList.Add(ei);
            }
            return(true);
        }
Ejemplo n.º 2
0
        internal void SaveExclusionData(DataGridViewRow[] gridRows, string fileName)
        {
            ExclusionData.Clear();
            ExclusionList.Clear();
            foreach (DataGridViewRow row in gridRows)
            {
                if (row.IsNewRow)
                {
                    continue;
                }
                DataRow       dataRow = ExclusionData.NewRow();
                ExclusionItem ei      = new ExclusionItem();

                dataRow["Row"]              = (int)row.Cells[0].Value;
                dataRow["SourceTableName"]  = (string)row.Cells[1].Value;
                dataRow["SourceColumnName"] = (string)row.Cells[2].Value;
//				dataRow["DestinationTableName"]		= (string) row.Cells[3].Value;
//				dataRow["DestinationColumnName"]	= (string) row.Cells[4].Value;
                ExclusionData.Rows.Add(dataRow);

                ei.Row              = (int)row.Cells[0].Value;
                ei.SourceTableName  = (string)row.Cells[1].Value;
                ei.SourceColumnName = (string)row.Cells[2].Value;
//				ei.DestinationTableName		= (string) row.Cells[3].Value;
//				ei.DestinationColumnName	= (string) row.Cells[4].Value;
                ExclusionList.Add(ei);
            }
            DataView view = new DataView(ExclusionData);

            view.Sort = "SourceTableName ASC, SourceColumnName ASC";
            DataTable dt = view.ToTable();

            dt.TableName = "ExclusionData";
            dt.WriteXml(fileName, XmlWriteMode.WriteSchema);
            dt.Dispose();
            view.Dispose();
        }