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


C# ICursor.UpdateRow方法代码示例

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


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

示例1: ChangeDatesOnTable

        public bool ChangeDatesOnTable(ICursor pCursor, string FieldName, string sDate, bool Unversioned, 
      IStepProgressor m_pStepProgressor, ITrackCancel m_pTrackCancel)
        {
            bool bWriteNull = (sDate.Trim() == "");
              object dbNull = DBNull.Value;
              int FldIdx = pCursor.FindField(FieldName);
              int iSysEndDate = pCursor.FindField("systemenddate");
              int iHistorical = pCursor.FindField("historical");

              bool bIsSysEndDate = (FieldName.ToLower() == "systemenddate");
              bool bIsHistorical = (FieldName.ToLower() == "historical");
              bool bHasSysEndDateFld = (iSysEndDate > -1);
              bool bHasHistoricFld = (iHistorical > -1);

              bool bCont = true;
              bool m_bShowProgressor = (m_pStepProgressor != null);

              if (bWriteNull)
              {
            IField pfld = pCursor.Fields.get_Field(FldIdx);
            if (!pfld.IsNullable)
              return false;
              }

              DateTime localNow = DateTime.Now;

              IRow pRow = pCursor.NextRow();
              while (pRow != null)
              {
            //Check if the cancel button was pressed. If so, stop process
            if (m_bShowProgressor)
            {
              bCont = m_pTrackCancel.Continue();
              if (!bCont)
            break;
            }

            if (bWriteNull)
            {
              if (bIsHistorical) //if writing null to Historical field, use 0 instead
            pRow.set_Value(FldIdx, 0);
              else
            pRow.set_Value(FldIdx, dbNull);

              if (bIsHistorical && bHasSysEndDateFld)   // if writing null to Historical field
            pRow.set_Value(iSysEndDate, dbNull);   // then also Null system end date
              if (bIsSysEndDate && bHasHistoricFld)     // if writing null to SystemEndDate field
            pRow.set_Value(iHistorical, 0);            //then set the Historical flag to false = 0
            }
            else
            {
              pRow.set_Value(FldIdx, sDate);
              if (bIsSysEndDate && bHasHistoricFld)     // if writing date to SystemEndDate field
            pRow.set_Value(iHistorical, 1);            //then set the Historical flag to true = 1
            }

            if (Unversioned)
              pCursor.UpdateRow(pRow);
            else
              pRow.Store();

            Marshal.ReleaseComObject(pRow);
            pRow = pCursor.NextRow();
            if (m_bShowProgressor)
            {
              if (m_pStepProgressor.Position < m_pStepProgressor.MaxRange)
            m_pStepProgressor.Step();
            }
              }
              Marshal.ReleaseComObject(pCursor);
              if (!bCont)
            return false;
              return true;
        }
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:74,代码来源:clsFabricUtils.cs

示例2: ChangeDatesOnTableMulti


//.........这里部分代码省略.........
              int i2 = x.IndexOf(",", i1+1);
              string s1= x.Remove(i1 + 1, i2 - i1);
              string s2=s1.Insert(i1 + 1, sDate[0] + ",");
              ParcelToHistory_DICT[pRow.OID] = s2;
            }

            if (bSystemEndDate_Clear && bTryGetTrue)
            {
              pRow.set_Value(FldIdxSystemEnd, dbNull);
              if (bHasHistoricFld)                          // if writing date to SystemEndDate field
            pRow.set_Value(iHistorical, 0);             //then set the Historical flag to true = 1

              //update the dictionary
              //find the location of the System End Date
              string x = ParcelToHistory_DICT[pRow.OID];
              int i1 = x.IndexOf(",", 0);
              int i2 = x.IndexOf(",", i1 + 1);
              string s1 = x.Remove(i1 + 1, i2 - i1);
              string s2 = s1.Insert(i1 + 1, ",");
              ParcelToHistory_DICT[pRow.OID] = s2;
            }

            if (bLegalStDate_Set && bTryGetTrue)
            {
              pRow.set_Value(FldIdxLegalSt, sDate[1]);
              //update the dictionary
              //find the location of the System End Date
              string x = ParcelToHistory_DICT[pRow.OID];
              int i1 = x.IndexOf(",", 0);
              int i2 = x.IndexOf(",", i1 + 1);
              int i3 = x.IndexOf(",", i2 + 1);
              string s1 = x.Remove(i2 + 1, i3 - i2);
              string s2 = s1.Insert(i2 + 1,sDate[1]  + ",");
              ParcelToHistory_DICT[pRow.OID] = s2;
            }

            if (bLegalStDate_Clear && bTryGetTrue)
            {
              pRow.set_Value(FldIdxLegalSt, dbNull);
              //update the dictionary
              //find the location of the System End Date
              string x = ParcelToHistory_DICT[pRow.OID];
              int i1 = x.IndexOf(",", 0);
              int i2 = x.IndexOf(",", i1 + 1);
              int i3 = x.IndexOf(",", i2 + 1);
              string s1 = x.Remove(i2 + 1, i3 - i2);
              string s2 = s1.Insert(i2 + 1, ",");
              ParcelToHistory_DICT[pRow.OID] = s2;
            }

            if (bLegalEndDate_Set && bTryGetTrue)
            {
              pRow.set_Value(FldIdxLegalEnd, sDate[2]);
              //update the dictionary
              //find the location of the System End Date
              string x = ParcelToHistory_DICT[pRow.OID];
              int i1 = x.IndexOf(",", 0);
              int i2 = x.IndexOf(",", i1 + 1);
              int i3 = x.IndexOf(",", i2 + 1);
              int i4 = x.IndexOf(",", i3 + 1);

              string s1 = x.Remove(i3 + 1, i4 - i3);
              string s2 = s1.Insert(i3 + 1, sDate[2] + ",");
              ParcelToHistory_DICT[pRow.OID] = s2;
            }

            if (bLegalEndDate_Clear && bTryGetTrue)
            {
              pRow.set_Value(FldIdxLegalEnd, dbNull);
              //update the dictionary
              //find the location of the System End Date
              string x = ParcelToHistory_DICT[pRow.OID];
              int i1 = x.IndexOf(",", 0);
              int i2 = x.IndexOf(",", i1 + 1);
              int i3 = x.IndexOf(",", i2 + 1);
              int i4 = x.IndexOf(",", i3 + 1);

              string s1 = x.Remove(i3 + 1, i4 - i3);
              string s2 = s1.Insert(i3 + 1, ",");
              ParcelToHistory_DICT[pRow.OID] = s2;
            }

            if (Unversioned)
              pCursor.UpdateRow(pRow);
            else
              pRow.Store();

            Marshal.ReleaseComObject(pRow);
            pRow = pCursor.NextRow();
            if (m_bShowProgressor)
            {
              if (m_pStepProgressor.Position < m_pStepProgressor.MaxRange)
            m_pStepProgressor.Step();
            }
              }
              Marshal.ReleaseComObject(pCursor);
              if (!bCont)
            return false;
              return true;
        }
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:101,代码来源:clsFabricUtils.cs


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