分类 Dynamics 365 下的文章

  container fileCon = DocumentManagement::getAttachmentAsContainer(_docuRef);
  

System.IO.Stream stream = Binary::constructFromContainer(fileCon).getMemoryStream();

  DocumentManagement::attachFile(tableNum(IWS_DeliveryForecastTable), recId, DataAreaId, '文件', stream, name, '', name);

private str jsonKey2Lower(str _jStr)
{
    str jStr;
    str item;

    System.Text.RegularExpressions.Regex regex;
    System.Text.RegularExpressions.Match match;
    
    regex = new System.Text.RegularExpressions.Regex("\"([A-Za-z0-9]*)\"\:");
    match = regex.Match(_jStr);

    jStr = _jStr;
    while(match.Success)
    {
        item = match.Value;
        jStr = strReplace(jStr, item, strLwr(item));
        match = match.NextMatch();
    }
    return jStr;
}

refer from

origin = System.Text.RegularExpressions.Regex::Replace(origin,'<([A-Za-z0-9]*)>(\\s*|\n|\t|\r)</[A-Za-z0-9]*>','<$1/>');//压缩空节点。

private str getTkValue(Newtonsoft.Json.Linq.JObject entity, str name)
{
    Newtonsoft.Json.Linq.JToken jtk;
    jtk  = entity.getValue(name);
    return jtk==null ? "" :jtk.ToString();
}

switch(anyType)
        {
            case Types::String:
                return any2Str(value);
                break;
            
            case Types::VarString:
                return any2Str(value);
                break;
                        
            case Types::Integer:
                return any2Int(value);
                break;

            case Types::Int64:
                return any2Int64(value);
                break;
                        
            case Types::Enum:
                return any2Enum(anyData)
                break;
                        
            case Types::Real:
                return any2Real(value);
                break;
            
            case Types::Date:
                table.setFieldValue(conPeek(nameCon,j), any2Date(anyData));
                break;

            case Types::Time:
                table.setFieldValue(conPeek(nameCon,j), str2Time(any2Str(anyData)));
                break;

            case Types::UtcDateTime:
                System.DateTime a =  anyValue;
                TimeOfDay time = 0; 
                
                utcdatetime utcData = DateTimeUtil::newDateTime(a.Date,time);
                utcData=DateTimeUtil::addHours(utcData,a.Hour);
                utcData=DateTimeUtil::addMinutes(utcData,a.Minute);
                utcData=DateTimeUtil::addSeconds(utcData,a.Second);
                table.setFieldValue(conPeek(nameCon,j), utcData);
                break;
            
            case Types::Guid:
                table.setFieldValue(conPeek(nameCon,j), any2Guid(anyData));
                break;
            
            case Types::Container:
                table.setFieldValue(conPeek(nameCon,j), str2con(anyData, ","));  // not validate
                break;
            
            default:
                Info(strFmt("%1(%2)类型未定义", conPeek(nameCon,j), dictField.baseType()));
                break;
        }

    MenuFunction menuFunction;
    menuFunction = new MenuFunction(menuItemDisplayStr(xxx), MenuItemType::Display);

    Args args = new Args();
    args.record(_task);
    args.caller(_caller);
    menuFunction.run(args);