// // (C) Copyright 2003-2009 by Autodesk, Inc. // // Permission to use, copy, modify, and distribute this software in // object code form for any purpose and without fee is hereby granted, // provided that the above copyright notice appears in all copies and // that both that copyright notice and the limited warranty and // restricted rights notice below appear in all supporting // documentation. // // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE // UNINTERRUPTED OR ERROR FREE. // // Use, duplication, or disclosure by the U.S. Government is subject to // restrictions set forth in FAR 52.227-19 (Commercial Computer // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) // (Rights in Technical Data and Computer Software), as applicable. // using System; using System.Collections.Generic; using System.Text; using System.Data; namespace Revit.SDK.Samples.RDBLink.CS { /// /// Preserves error information of a table after importing /// public class ErrorTable { #region Fields /// /// The table name /// string m_tableName; /// /// The DataTable /// DataTable m_dataTable; /// /// Indicates if there are any changes made to Revit /// bool m_hasChange; /// /// Indicates whether the table supports importing or not /// bool m_notSupportImporting; /// /// Table resource id /// string m_tableId; /// /// ErrorRow list /// List m_rows; #endregion #region Properties /// /// Gets ErrorRow list /// public List Rows { get { return m_rows; } //set { m_rows = value; } } /// /// Gets or sets whether there are any changes made to Revit /// public bool HasChange { get { return m_hasChange; } set { m_hasChange = value; } } /// /// Gets or sets whether the table supports importing or not /// public bool NotSupportImporting { get { return m_notSupportImporting; } set { m_notSupportImporting = value; } } /// /// Gets the corresponding DataTable /// public DataTable DataTable { get { return m_dataTable; } //set { m_dataTable = value; } } /// /// Gets the table name /// public string TableName { get { return m_tableName; } //set { m_tableName = value; } } /// /// Gets table resource id /// public string TableId { get { return m_tableId; } /*set { m_tableKey = value; }*/ } #endregion #region Constructors /// /// Constructor, initialize variables /// /// table name resource id /// table name /// DataTable public ErrorTable(string tableId, string tableName, DataTable dataTable) { m_rows = new List(); m_tableName = tableName; m_tableId = tableId; m_dataTable = dataTable; } #endregion }; /// /// Preserves error information of a row after importing /// public class ErrorRow { #region Fields /// /// Corresponding DataRow /// DataRow m_dataRow; /// /// ErrorCell list /// List m_cells; /// /// Indicates if there are any changes made to Revit related with this row /// bool m_hasChange; /// /// Row state /// DataRowState m_state; #endregion #region Properties /// /// Gets or sets the state of the ErrorRow /// public DataRowState State { get { return m_state; } set { m_state = value; } } /// /// Gets or sets whether there are any changes made to Revit related with this row /// public bool HasChange { get { return m_hasChange; } set { m_hasChange = value; } } /// /// Gets the corresponding DataRow /// public DataRow DataRow { get { return m_dataRow; } //set { m_dataRow = value; } } /// /// Gets ErrorCell list /// public List Cells { get { return m_cells; } //set { m_cells = value; } } #endregion #region Constructors /// /// Constructor, initialize variables /// /// The corresponding DataRow public ErrorRow(DataRow dataRow) { m_dataRow = dataRow; m_cells = new List(); } #endregion }; /// /// Preserves error information of a cell after importing /// public class ErrorCell { #region Fields /// /// Column name /// string m_columnName; /// /// Importing result /// UpdateResult m_state; #endregion #region Properties /// /// Gets the column name /// public string ColumnName { get { return m_columnName; } //set { m_columnName = value; } } /// /// Gets or sets the result state /// public UpdateResult State { get { return m_state; } set { m_state = value; } } #endregion #region Constructors /// /// Constructor /// /// Column name /// Importing result public ErrorCell(string columnName, UpdateResult state) { m_columnName = columnName; m_state = state; } #endregion }; /// /// Indicates single cell importing result. /// public enum UpdateResult { /// /// An unknown result /// Unknown, /// /// Can't deal with AssemblyCode /// AssemblyCode, /// /// Updated successfully /// Success, /// /// Updated failed /// Failed, /// /// Updated failed because the corresponding field is readonly /// ReadOnlyFailed, /// /// Updated failed because the corresponding parameter is null /// ParameterNull, /// /// Updated failed because there is an exception /// Exception, /// /// Nothing happened when import, because the value of the corresponding /// parameter and the cell are equal /// Equals } }