0

我正在尝试复制存储在 RavenDB 文档中的数组,如下所示:

{
  "CreatedAt": "2013-04-03T13:37:12.0261044",
  "IsMostRecent": false,
  "ClientId": "clients/641",
  "ChangeReason": "CommunityBasedAssessmentNewClient",
  "StatusType": "Live",
  "Start": "2013-04-01T00:00:00.0000000",
  "End": "2013-04-01T00:00:00.0000000",
  "EndCharge": null,
  "AssessmentDate": null,
  "Correspondence": null,
  "Service": {
    "$type": "Cordia.Care.Core.Models.Personalisation, Cordia.Care.Core",
    "IsDirectBilling": false,
    "Visits": [
     {
        "DayOfWeek": "Monday",
        "Start": "09:00:00",
        "End": "11:00:00",
        "AdditionalResources": false,
        "SocialWork": {
        "Duration": 120,
        "BillableTo": "SocialWork",
        "VisitTasks": [
        "DressingAssistance"
      ]
    },
    "PrivateWork": {
      "Duration": 0,
      "BillableTo": "Private",
      "VisitTasks": []
    }
  }

我遇到的问题是保存“VisitTasks”,我在这部分使用以下脚本但没有任何乐趣:

replicateToSocialWork( 
{
        Duration: visit.SocialWork.Duration,
        BillableTo: visit.SocialWork.BillableTo
});

for (var i=0; i<this.Service.Visits.SocialWork.VisitTasks.length; i++)
{
    var visitTask = this.Service.Visits.SocialWork.VisitTasks[i];
    replicateToSWVisitTask(
    {
        VisitTask: visitTask
    });
}

replicateToPrivateWork( 
{
        Duration: visit.PrivateWork.Duration,
        BillableTo: visit.PrivateWork.BillableTo
});

for (var i=0; i<this.Service.Visits.PrivateWork.VisitTasks.length; i++)
{
    var visitTask = this.Service.Visits.PrivateWork.VisitTasks[i];
    replicateToPWVisitTask(
    {
        VisitTask: visitTask
    });
}

这是正在运行的更大脚本的一部分,只是这部分我无法工作。任何帮助将不胜感激。

4

1 回答 1

0

执行时:

 replicateToPWVisitTask(
 {
     VisitTask: visitTask
 });

您正在尝试将序列化为 json 的 visitTask 对象复制到 VisitTask。如果要发送值,则需要提取值。

于 2013-04-03T16:32:02.797 回答