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


C# Row.GetClientFieldValue方法代码示例

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


在下文中一共展示了Row.GetClientFieldValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 virtual JSONDataMap RowToRecordInitJSON(Row row,
            Exception validationError,
            string recID = null,
            string target = null,
            string isoLang = null,
            ModelFieldValueListLookupFunc valueListLookup = 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
            var form = row as FormModel;
            if (form != null)
            {
              result[FormModel.JSON_MODE_PROPERTY] = form.FormMode;
              result[FormModel.JSON_CSRF_PROPERTY] = form.CSRFToken;

              //20160123 DKh
              if (form.HasRoundtripBag)
            result[FormModel.JSON_ROUNDTRIP_PROPERTY] = form.RoundtripBag.ToJSON(JSONWritingOptions.CompactASCII);
            }

            var fields = new JSONDataArray();
            result["fields"] = fields;

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

            foreach(var sfdef in row.Schema.FieldDefs.Where(fd=>!fd.NonUI))
            {
              var fdef = row.GetClientFieldDef(this, sfdef, target, isoLang);
              if (fdef==null || fdef.NonUI) continue;

              var fld = new JSONDataMap();
              fields.Add(fld);
              fld["def"] = FieldDefToJSON(row, schemaName, fdef, target, isoLang, valueListLookup);
              var val = row.GetClientFieldValue(this, sfdef, target, isoLang);
              if (val is GDID && ((GDID)val).IsZero) val = null;
              fld["val"] = val;
              var ferr = validationError as CRUDFieldValidationException;
              //field level exception
              if (ferr!= null && ferr.FieldName==fdef.Name)
              {
            fld["error"] = ferr.ToMessageWithType();
            fld["errorText"] = OnLocalizeString(schemaName, "errorText", ferr.ClientMessage, isoLang);
              }
            }

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

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


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