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


C# Row.GetFieldValue方法代码示例

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


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

示例1: RowToRecordInitJSON

      /// <summary>
      /// Generates JSON object suitable for passing into WV.RecordModel.Record(...) constructor on the client.
      /// Pass target to select attributes targeted to ANY target or to the specified one, for example
      ///  may get attributes for client data entry screen that sees field metadata differently, in which case target will reflect the name
      ///   of the screen
      /// </summary>
      public static JSONDataMap RowToRecordInitJSON(Row row, Exception validationError, string recID = null, string target = null, string isoLang = null)
      {
        var result = new JSONDataMap();
        if (row==null) return result;
        if (recID.IsNullOrWhiteSpace()) recID = Guid.NewGuid().ToString();

        result["OK"] = true;
        result["ID"] = recID;
        if (isoLang.IsNotNullOrWhiteSpace())
          result["ISOLang"] = isoLang;

        //20140914 DKh
        if (row is FormModel)
        {
          result[FormModel.JSON_MODE_PROPERTY] = ((FormModel)row).FormMode;
          result[FormModel.JSON_CSRF_PROPERTY] = ((FormModel)row).CSRFToken;
        }
        
        var fields = new JSONDataArray();
        result["fields"] = fields;

        var schemaName = row.Schema.Name;
        if (row.Schema.TypedRowType!=null) schemaName = row.Schema.TypedRowType.FullName;

        foreach(var fdef in row.Schema.FieldDefs.Where(fd=>!fd.NonUI))
        {
          var fld = new JSONDataMap();
          fields.Add(fld);
          fld["def"] = fieldDefToJSON(schemaName, fdef, target);
          fld["val"] = row.GetFieldValue(fdef);
          var ferr = validationError as CRUDFieldValidationException;
          //field level exception
          if (ferr!= null && ferr.FieldName==fdef.Name)
          {
            fld["error"] = ferr.ToMessageWithType();
            fld["errorText"] = localizeString(schemaName, "errorText", ferr.ClientMessage);
          }
        }

        //record level
        if (validationError!=null && !(validationError is CRUDFieldValidationException))
        {
          result["error"] = validationError.ToMessageWithType();
          result["errorText"] = localizeString(schemaName, "errorText", validationError.Message);
        }

        return result;
      }   
开发者ID:sergey-msu,项目名称:nfx,代码行数:54,代码来源:RecordModelGenerator.cs

示例2: GetFieldAsBSON

 protected virtual BSONElement GetFieldAsBSON(Row row, Schema.FieldDef field, string targetName)
 {
   var name = field.GetBackendNameForTarget(targetName);
   var fvalue = row.GetFieldValue(field);
   var el = ConvertCLRtoBSON(name, fvalue, targetName);
   return el;  
 }
开发者ID:huoxudong125,项目名称:nfx,代码行数:7,代码来源:RowConverter.cs

示例3: RowToErlTuple

    /// <summary>
    /// Converts CLR row data into ErlTuple
    /// </summary>
    public ErlTuple RowToErlTuple(Row row, bool keysOnly = false)
    {
      var result = new ErlTuple();
      
      result.Add(new ErlAtom(row.Schema.Name));

      var keys = new List<IErlObject>();

      foreach(var def in row.Schema)
      {
        var atr = def[m_Store.TargetName];

        if (keysOnly && !atr.Key) break;

        if (keys!=null && !atr.Key)
        {
          if (keys.Count>1)
            result.Add( new ErlTuple(keys, false) );
          else
            foreach(var key in keys) result.Add( key ); 
          keys = null;
        }


        IErlObject erlValue = ErlAtom.Undefined;

        var clrValue = row.GetFieldValue(def);
        if (clrValue!=null)
        {
           Func<object, IErlObject> fconv;
           if (!CLR_TO_ERL_TYPEMAP.TryGetValue(atr.BackendType, out fconv))
            throw new ErlDataAccessException(StringConsts.ERL_DS_INTERNAL_MAPPING_ERROR+"erltype'{0}' not matched in the dict".Args(atr.BackendType));

           erlValue = fconv(clrValue);
        }
        
        if (keys!=null)
          keys.Add( erlValue );
        else
          result.Add( erlValue );
      }

      if (keys!=null)
      {
        if (keys.Count>1)
         result.Add( new ErlTuple(keys, false) );
        else
         foreach(var key in keys) result.Add( key ); 
      }

      return result;
    }
开发者ID:vlapchenko,项目名称:nfx,代码行数:55,代码来源:SchemaMap.cs

示例4: RowToErlTuple

    /// <summary>
    /// Converts CLR row data into ErlTuple
    /// </summary>
    public ErlTuple RowToErlTuple(Row row, bool keysOnly = false)
    {
      var result = new ErlTuple();
      
      result.Add(new ErlAtom(row.Schema.Name));

      var keys = new List<IErlObject>();

      foreach(var def in row.Schema)
      {
        var atr = def[m_Store.TargetName];

        if (keysOnly && !atr.Key) break;

        if (keys!=null && !atr.Key)
        {
          if (keys.Count>1)
            result.Add( new ErlTuple(keys, false) );
          else
            foreach(var key in keys) result.Add( key ); 
          keys = null;
        }


        IErlObject erlValue = ErlAtom.Undefined;

        var clrValue = row.GetFieldValue(def);
        if (clrValue!=null)
          erlValue = ClrToErlValue(atr.BackendType, clrValue);
        
        if (keys!=null)
          keys.Add( erlValue );
        else
          result.Add( erlValue );
      }

      if (keys!=null)
      {
        if (keys.Count>1)
         result.Add( new ErlTuple(keys, false) );
        else
         foreach(var key in keys) result.Add( key ); 
      }

      return result;
    }
开发者ID:yhhno,项目名称:nfx,代码行数:49,代码来源:SchemaMap.cs


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