Ejemplo n.º 1
0
        /// <summary>
        /// Returns the count of tables
        /// </summary>
        /// <returns></returns>
        public int GetRecordCount(Epi2000.View view)
        {
            try
            {
                #region Input Validation
                if (view == null)
                {
                    throw new System.ArgumentNullException("view");
                }
                #endregion Input Validation

                string qryString = " select count(*) from " + db.InsertInEscape(view.TableNames[0]);
                Query  query     = db.CreateQuery(qryString);
                return(Int32.Parse((db.ExecuteScalar(query)).ToString()));
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Could not retrieve record count.", ex); //TODO: move to shared strings
            }
            finally
            {
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method LoadViews()
        /// </summary>
        //protected override void LoadViews()
        public void LoadViews()
        {
            this.views = new Collection <View>();
            System.Collections.Hashtable RelatedViews = new System.Collections.Hashtable();

            DataTable viewsTable = GetViewsAsDataTable();

            foreach (DataRow viewRow in viewsTable.Rows)
            {
                View V = new Epi2000.View(viewRow, this);

                // set the is related view attribute
                IDataReader R = this.collectedData.GetTableDataReader(V.Name);
                while (R.Read())
                {
                    if (R["Name"].ToString().ToUpperInvariant().StartsWith("RELVIEW"))
                    {
                        if (!RelatedViews.ContainsKey(R["DataTable"].ToString()))
                        {
                            RelatedViews.Add(R["DataTable"].ToString(), R["DataTable"].ToString());
                        }
                    }
                }
                R.Close();

                this.views.Add(V);
            }


            foreach (Epi2000.View V in this.views)
            {
                if (RelatedViews.ContainsKey(V.Name))
                {
                    V.IsRelatedView = true;
                }
            }
        }