示例#1
0
        private IList <string> GetTableNames()
        {
            //this ensures that the XDbEnvironment.XDbConnectedType get set correctly
            XDbEnvironment.GetConnectionString(m_fileName);

            IList <string> tableNames = new List <string>();

            try
            {
                string[] restrictionValues = new string[4] {
                    null, null, null, "TABLE"
                };
                using (DataTable tables = m_XDbConnection.GetSchema("Tables", restrictionValues))
                {
                    foreach (DataRow table in tables.Rows)
                    {
                        string tableName = table["TABLE_NAME"].ToString();
                        if (IsTableNameFormatCorrect(tableName))
                        {
                            tableNames.Add(tableName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string msg = string.Format("{0}\n{1}", Resources.ResourceMessages.InstallMsg, ex.Message);
                ApplicationExceptions.Add(new ApplicationException(msg, ex.InnerException));
            }
            return(tableNames);
        }
示例#2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var exception = value as Exception;

            if (value == null)
            {
                return(null);
            }

            return(ApplicationExceptions.ToString(exception));
        }
 /// <summary>
 /// ISeriazable Constructor used for Serializing the Exception
 /// </summary>
 /// <param name="info">Serialization Info Object</param>
 /// <param name="context">Serializtion Context </param>
 protected BanditApplicationException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     try {
         this.number           = (ApplicationExceptions)info.GetValue("number", typeof(ApplicationExceptions));
         this.osNameVersion    = info.GetString("osNameVersion");
         this.frameworkVersion = info.GetString("frameworkVersion");
     }
     catch {}
     finally {
         this.number = ApplicationExceptions.Unknown;
     }
 }
示例#4
0
        private void Initialize()
        {
            if (string.IsNullOrEmpty(m_fileName) || !File.Exists(m_fileName))
            {
                string msg = string.Format("{0} does not exist or is null.", string.IsNullOrEmpty(m_fileName) ? "[Invalid file name passed in]" : m_fileName);
                throw new ApplicationException(msg);
            }

            string conStr = XDbEnvironment.GetConnectionString(m_fileName);

            m_XDbConnection = new XDbConnection(conStr);
            try
            {
                m_XDbConnection.Open();
            }
            catch (Exception ex)
            {
                m_XDbConnection = null;
                ApplicationExceptions.Add(new ApplicationException(ex.Message, ex.InnerException));
                return;
            }
            m_XDbType = XDbEnvironment.XDbConnectedType;
        }
示例#5
0
        private void BuildDataSetFromTableNames()
        {
            if (!IsConnectionValid)
            {
                return;
            }

            ImportDataSet = new DataSet("ImportTables");
            IList <string> tableNames = GetTableNames();

            foreach (string tableName in tableNames)
            {
                try
                {
                    DataTable table = GetDataTable(string.Format("SELECT {0} FROM [{1}]", "*", tableName));
                    table.TableName = SetTableName(tableName);
                    ImportDataSet.Tables.Add(table);
                }
                catch (Exception ex)
                {
                    ApplicationExceptions.Add(new ApplicationException(ex.Message, ex.InnerException));
                }
            }
        }
 /// <summary>
 ///	 Base Constructor with Error Text and Error Number
 /// </summary>
 /// <param name="number">ApplicationExceptions</param>
 /// <param name="errorText">Error Text</param>
 public BanditApplicationException(ApplicationExceptions number, string errorText) : base(errorText)
 {
     this.number = number;
     InitializeEnvironmentInformation();
 }
 /// <summary>
 ///  Base Constructor with Error Number
 /// </summary>
 /// <param name="number">ApplicationExceptions</param>
 public BanditApplicationException(ApplicationExceptions number) : base()
 {
     this.number = number;
     InitializeEnvironmentInformation();
 }
 /// <summary>
 ///	 Base Constructor with Error Text and Error Number
 /// </summary>
 /// <param name="number">ApplicationExceptions</param>
 /// <param name="inner">Inner Exception</param>
 public BanditApplicationException(ApplicationExceptions number, Exception inner) : base(String.Empty, inner)
 {
     this.number = number;
     InitializeEnvironmentInformation();
 }