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


C# View.GetPageById方法代码示例

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


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

示例1: ProcessPages

        /// <summary>
        /// Processes all of the fields on a given form, page-by-page, except for the fields on the base table.
        /// </summary>      
        /// <param name="destinationView">The destination form</param>
        /// <param name="destinationGUIDList">The list of GUIDs that exist in the destination</param>
        private void ProcessPages(View destinationView, List<string> destinationGUIDList, string syncFilePath)
        {
            int recordsProcessed = 0;

            foreach (KeyValuePair<string, List<PhoneFieldData>> kvp in _surveyResponses)
            {
                string recordKey = kvp.Key;
                Dictionary<int, List<PhoneFieldData>> pagedFieldDataDictionary = new Dictionary<int, List<PhoneFieldData>>();

                for (int i = 0; i < destinationView.Pages.Count; i++)
                {
                    pagedFieldDataDictionary.Add(destinationView.Pages[i].Id, new List<PhoneFieldData>());
                }

                foreach (PhoneFieldData fieldData in kvp.Value)
                {
                    int pageId = fieldData.Page;
                    if (fieldData.FieldName.ToLower().Equals("globalrecordid") || destinationView.GetPageById(pageId).Fields.Contains(fieldData.FieldName))
                    {
                        pagedFieldDataDictionary[pageId].Add(fieldData);
                    }
                }

                for (int i = 0; i < destinationView.Pages.Count; i++)
                {
                    this.BeginInvoke(new SetStatusDelegate(SetStatusMessage), "Processing records on page " + (i + 1).ToString() + " of " + destinationView.Pages.Count.ToString() + "...");

                    int recordsInserted = 0;
                    int recordsUpdated = 0;

                    Page destinationPage = destinationView.Pages[i];
                    string pageTableName = destinationPage.TableName;
                    List<PhoneFieldData> pagedFieldDataList = pagedFieldDataDictionary[destinationPage.Id];

                    Query selectQuery = destinationProjectDataDriver.CreateQuery("SELECT [GlobalRecordId] FROM [" + pageTableName + "]");
                    IDataReader destReader = destinationProjectDataDriver.ExecuteReader(selectQuery);
                    destinationGUIDList = new List<string>();

                    while (destReader.Read())
                    {
                        destinationGUIDList.Add(destReader[0].ToString());
                    }

                    destReader.Close();

                    try
                    {
                        if (pagedFieldDataList.Count == 0 && append)
                        {
                            InsertEmptyPageTableRecord(recordKey, pageTableName);
                        }

                        string currentGUID = string.Empty;
                        string lastGUID = string.Empty;

                        WordBuilder fieldNames = new WordBuilder(StringLiterals.COMMA);
                        WordBuilder fieldValues = new WordBuilder(StringLiterals.COMMA);
                        List<QueryParameter> fieldValueParams = new List<QueryParameter>();
                        int fieldsInQuery = 0;

                        PhoneFieldData wfData = new PhoneFieldData();
                        wfData.RecordGUID = "__LAST__"; // last field, acts as a flag
                        pagedFieldDataList.Add(wfData);

                        List<string> GUIDList = new List<string>();

                        foreach (PhoneFieldData fieldData in pagedFieldDataList)
                        {
                            currentGUID = fieldData.RecordGUID;

                            if (importWorker.CancellationPending)
                            {
                                this.BeginInvoke(new SetStatusDelegate(AddStatusMessage), "Import cancelled.");
                                return;
                            }

                            string GUID = fieldData.RecordGUID; // sourceReader["GlobalRecordId"].ToString();
                            List<string> updatedGUIDs = new List<string>();

                            if (destinationGUIDList.Contains(GUID) && update)
                            {
                                #region UPDATE

                                currentGUID = fieldData.RecordGUID;

                                if (importWorker.CancellationPending)
                                {
                                    this.BeginInvoke(new SetStatusDelegate(AddStatusMessage), "Import cancelled.");
                                    return;
                                }

                                string updateHeader = string.Empty;
                                string whereClause = string.Empty;
                                fieldValueParams = new List<QueryParameter>();
                                StringBuilder sb = new StringBuilder();
//.........这里部分代码省略.........
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:101,代码来源:ImportPhoneData.cs


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