当前位置: 首页>>代码示例>>C#>>正文


C# View.SetTableName方法代码示例

本文整理汇总了C#中Epi.View.SetTableName方法的典型用法代码示例。如果您正苦于以下问题:C# View.SetTableName方法的具体用法?C# View.SetTableName怎么用?C# View.SetTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Epi.View的用法示例。


在下文中一共展示了View.SetTableName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SynchronizeDataTable

        /// <summary>
        /// Synchronizes metadata and data table 
        /// [drops and/or inserts data columns in the view table]
        /// </summary>
        public void SynchronizeDataTable(View view, bool tryCompact = true)
        {
            try
            {
                if (isWebMode)
                {
                    return;
                }

                Boolean noDataTable = dbDriver.TableExists(view.TableName) == false;

                if (noDataTable)
                {
                    CreateDataTableForView(view, 1);
                }
                else
                {
                    foreach (Page page in view.Pages)
                    {
                        DataTable fieldMetadataSync = view.GetMetadata().GetFieldMetadataSync(page.Id);
                        DeleteUndefinedDataFields(page, fieldMetadataSync);
                    }

                    if (tryCompact)
                    {
                        try
                        {
                            dbDriver.CompactDatabase();
                            if (dbDriver.FullName.Contains("[MS Access]"))
                            {
                                string insertStatement = string.Format("insert into {0}([UniqueKey], [GlobalRecordId]) values (@UniqueKey, @GlobalRecordId)", view.TableName);
                                Query insertQuery = dbDriver.CreateQuery(insertStatement);
                                insertQuery.Parameters.Add(new QueryParameter("@UniqueKey", DbType.Int16, StartingId - 1));
                                insertQuery.Parameters.Add(new QueryParameter("@GlobalRecordId", DbType.String, ""));
                                dbDriver.ExecuteNonQuery(insertQuery);

                                string deleteStatement = string.Format("delete from {0} where UniqueKey={1} ", view.TableName, StartingId - 1);
                                Query deleteQuery = dbDriver.CreateQuery(deleteStatement);
                                dbDriver.ExecuteNonQuery(deleteQuery);
                            }
                        }
                        catch { }
                    }

                    view.SetTableName(view.TableName);

                    foreach (Page page in view.Pages)
                    {
                        SynchronizePageTable(page);
                    }
                }
            }
            catch { }
        }
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:58,代码来源:CollectedDataProvider.cs

示例2: CreateView

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="viewName">New <see cref="Epi.View"/> name.</param>
        /// <param name="isChildView">Is Related (child) view flag.</param>
        /// <returns>New project <see cref="Epi.View"/></returns>
        public View CreateView(string viewName, bool isChildView)
        {
            View newView = new View(this);
            newView.Name = viewName;
            newView.SetTableName(newView.Name);
            newView.IsRelatedView = isChildView;

            if (!Views.Contains(newView))
            {
                Views.Add(newView);
            }

            Metadata.InsertView(newView);
            currentViewElement = newView.ViewElement;
            LoadViews();
            return newView;
        }
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:23,代码来源:Project.cs


注:本文中的Epi.View.SetTableName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。