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


C# View.GetRecordCount方法代码示例

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


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

示例1: DoImport

        /// <summary>
        /// Initiates a full import on a single form
        /// </summary>
        private void DoImport()
        {
            string importTypeDescription = "Records with matching ID fields will be updated and unmatched records will be appended.";
            if (cmbImportType.SelectedIndex == 0)
            {
                update = true;
                append = true;
            }
            else if (cmbImportType.SelectedIndex == 1)
            {
                update = true;
                append = false;
                importTypeDescription = "Records with matching ID fields will be updated. Unmatched records will be ignored.";
            }
            else
            {
                update = false;
                append = true;
                importTypeDescription = "Records with no matching ID fields will be appended. Records with matching ID fields will be ignored.";
            }

            if (cmbFormName.SelectedIndex >= 0)
            {
                lbxStatus.Items.Clear();
                sourceView = sourceProject.Views[cmbFormName.SelectedItem.ToString()];
                lastRecordId = sourceView.GetLastRecordId();

                if (!CheckForProblems())
                {
                    return;
                }

                textProgress.Text = string.Empty;
                progressBar.Value = 0;
                progressBar.Minimum = 0;

                int recordCount = sourceView.GetRecordCount();
                int gridRowCount = 0;

                foreach (GridField gridField in sourceView.Fields.GridFields)
                {
                    IDataReader reader = sourceProjectDataDriver.GetTableDataReader(gridField.TableName);
                    while (reader.Read())
                    {
                        gridRowCount++;
                    }
                }
                progressBar.Maximum = recordCount * (sourceView.Pages.Count + 1);
                progressBar.Maximum = progressBar.Maximum + gridRowCount;

                if (FormsAreAlike())
                {
                    List<View> viewsToProcess = new List<View>();

                    foreach (View view in sourceProject.Views)
                    {
                        try
                        {
                            if (view.IsRelatedView && !string.IsNullOrEmpty(view.TableName) && sourceProjectDataDriver.TableExists(view.TableName) && destinationProject.Views.Contains(view.Name))
                            {
                                if (IsDescendant(view, sourceView) && !viewsToProcess.Contains(view))
                                {
                                    viewsToProcess.Add(view);
                                    progressBar.Maximum = progressBar.Maximum + (view.GetRecordCount() * (view.Pages.Count + 1));
                                    int relatedGridRowCount = 0;
                                    foreach (GridField relatedGridField in view.Fields.GridFields)
                                    {
                                        IDataReader relatedGridReader = sourceProjectDataDriver.GetTableDataReader(relatedGridField.TableName);
                                        while (relatedGridReader.Read())
                                        {
                                            relatedGridRowCount++;
                                        }
                                    }
                                    progressBar.Maximum = progressBar.Maximum + relatedGridRowCount;
                                }
                            }
                        }
                        catch (NullReferenceException)
                        {
                            continue;
                        }
                    }

                    progressBar.Visible = true;

                    stopwatch = new Stopwatch();
                    stopwatch.Start();

                    AddStatusMessage("Import initiated for form " + cmbFormName.SelectedItem.ToString() + ". " + importTypeDescription);

                    btnBrowse.Enabled = false;
                    btnCancel.Enabled = false;
                    btnOK.Enabled = false;
                    cmbFormName.Enabled = false;
                    cmbImportType.Enabled = false;
                    textProjectFile.Enabled = false;

//.........这里部分代码省略.........
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:101,代码来源:ImportData.cs


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