private MasterHistory FillMasterHistoryVersionAsync(SystemToDbViewModel systemToDbViewModel, JiraRequest jiraRequest, int systemId)
        {
            logger.Info("WebHookReceiver Version MasterHistory");
            var masterHistory = new MasterHistory
            {
                RecordDateCreated = DateTime.Now
            };

            systemToDbViewModel.MasterHistoriesToInsert.Add(masterHistory);

            masterHistory.RecordDateUpdated = DateTime.Now;
            masterHistory.SystemId          = systemId;

            masterHistory.IssueId               = jiraRequest.Version.Id;
            masterHistory.IssueName             = GetVersionName(jiraRequest);
            masterHistory.IssueKey              = jiraRequest.Version.Name.Trim();
            masterHistory.ProjectId             = jiraRequest.Version.ProjectId.ToString();
            masterHistory.ParentVersionReleased = jiraRequest.Version.Released;
            masterHistory.IssueTypeName         = "version";
            masterHistory.IssueTypeId           = "version";
            masterHistory.DateFinish            = jiraRequest.Version.UserReleaseDate;
            masterHistory.DateRelease           = jiraRequest.Version.UserReleaseDate;
            //await unitOfWork.SaveChangesAsync();
            return(masterHistory);
        }
        //on jira request we want to get Sprints to our DB -> we got
        //customfield in webhook for it, so we just need to parse it
        //into our values, and as we don't have rows for them in our tables
        //we store them in field mapping tables
        private void AddSprints(SystemToDbViewModel systemToDbViewModel, JiraRequest jiraRequest, JiraAccessService jiraAccessService,
                                Master master, Staging staging, MasterHistory masterHistory, List <SyncSystemFieldMapping> syncSystemFieldMappings)
        {
            //we receiving fild from jira and getting its value
            CustomField customFieldSprint = customFields.FirstOrDefault(x => x.Name == JiraConstants.SprintFieldName);

            logger.Info($"WebHookReceiver AddSprints issue.Key: {jiraRequest.Issue.Key}");
            if (customFieldSprint != null && jiraRequest.Issue.GetField(customFieldSprint.Id) != null)
            {
                string[] sprintsStrings = JsonConvert.DeserializeObject <string[]>(jiraRequest.Issue.GetField(customFieldSprint.Id).ToString());

                logger.Info($"WebHookReceiver AddSprints jiraRequest.Issue.Key: {jiraRequest.Issue.Key}; " +
                            $"customFieldSprint.Name: {customFieldSprint.Name}; " +
                            $"customFieldSprint.Id: {customFieldSprint.Id}; " +
                            $"sprints.Length: {sprintsStrings.Length}");

                List <MasterFieldMappingValue>        masterFieldMappingValues        = new List <MasterFieldMappingValue>();
                List <MasterHistoryFieldMappingValue> masterHistoryFieldMappingValues = new List <MasterHistoryFieldMappingValue>();
                List <StagingFieldMappingValue>       stagingFieldMappingValues       = new List <StagingFieldMappingValue>();

                JiraSprint jiraSprint = jiraAccessService.ParseSprintField(sprintsStrings);
                commonBusinessService.SetSprintField(jiraSprint, syncSystemFieldMappings, master, masterHistory, staging,
                                                     masterFieldMappingValues, masterHistoryFieldMappingValues, stagingFieldMappingValues);

                systemToDbViewModel.MasterFieldMappingValuesToInsert.AddRange(masterFieldMappingValues);
                systemToDbViewModel.MasterHistoryFieldMappingValuesToInsert.AddRange(masterHistoryFieldMappingValues);
                systemToDbViewModel.StagingFieldMappingValuesToInsert.AddRange(stagingFieldMappingValues);
            }
        }
コード例 #3
0
 public HomeAutomationNetworkContext(RoomieEngine engine, ThreadPool threadPool, IDeviceHistory deviceHistory, INetworkHistory networkHistory)
 {
     _engine    = engine;
     ThreadPool = threadPool;
     //TODO: ninject?
     History  = new MasterHistory(deviceHistory, networkHistory);
     Triggers = new TriggerCollection();
 }
コード例 #4
0
        public void SetUp()
        {
            PopulateIndividualEventLists();

            _deviceHistoryMock = new Mock <IDeviceHistory>();
            _deviceHistoryMock.Setup(x => x.GetEnumerator()).Returns(_deviceEvents.GetEnumerator());

            _networkHistoryMock = new Mock <INetworkHistory>();
            _networkHistoryMock.Setup(x => x.GetEnumerator()).Returns(_networkEvents.GetEnumerator());

            _history = new MasterHistory(_deviceHistoryMock.Object, _networkHistoryMock.Object);
        }
        //function that directly updates our MasterHistory table in DB
        private MasterHistory FillMasterHistoryIssueAsync(SystemToDbViewModel systemToDbViewModel, JiraRequest jiraRequest, string jiraEpicLink, SyncSystemDTO syncSystem)
        {
            logger.Info("WebHookReceiver Issue MasterHistory");
            if (jiraRequest.WebhookEvent == "jira:issue_deleted")
            {
                return(null);
            }
            var masterHistory = new MasterHistory
            {
                RecordDateCreated = DateTime.Now,
                RecordDateUpdated = DateTime.Now,
                SystemId          = syncSystem.SystemId,
                ProjectId         = jiraRequest.Issue.Fields.Project.Id,
                ProjectKey        = jiraRequest.Issue.Fields.Project.Key,
                ProjectName       = jiraRequest.Issue.Fields.Project.Name,
                IssueId           = jiraRequest.Issue.Id,
                IssueKey          = jiraRequest.Issue.Key,
                IssueTypeId       = jiraRequest.Issue.Fields.IssueType.Id,
                IssueTypeName     = jiraRequest.Issue.Fields.IssueType.Name,
                IsSubTask         = jiraRequest.Issue.Fields.IssueType.Subtask,
                IssueName         = GetIssueName(jiraRequest),
                ParentEpicKey     = jiraEpicLink,
                //ParentIssueKey = jiraEpicLink,
                IssueStatus = jiraRequest.Issue.Fields.Status.Name,
                DateStart   = jiraRequest.Issue.Fields.Created
            };

            if (jiraRequest.Issue.Fields.FixVersions != null && jiraRequest.Issue.Fields.FixVersions.Count != 0)
            {
                masterHistory.ParentVersionId       = jiraRequest.Issue.Fields.FixVersions[0].Id;
                masterHistory.ParentVersionName     = jiraRequest.Issue.Fields.FixVersions[0].Name;
                masterHistory.ParentVersionReleased = jiraRequest.Issue.Fields.FixVersions[0].Released;
                masterHistory.DateRelease           = jiraRequest.Issue.Fields.FixVersions[0].ReleaseDate;
            }

            if (jiraRequest.Issue.Fields.Assignee != null)
            {
                masterHistory.Assignee = jiraRequest.Issue.Fields.Assignee.Name.ToLower();
            }
            if (jiraRequest.Issue.Fields.Parent != null)
            {
                masterHistory.ParentIssueId  = jiraRequest.Issue.Fields.Parent.Id;
                masterHistory.ParentIssueKey = jiraRequest.Issue.Fields.Parent.Key;
            }
            systemToDbViewModel.MasterHistoriesToInsert.Add(masterHistory);
            return(masterHistory);
        }
        public async Task <ProxyResponse> AddWebhookToDataBase(string jsonWebhook, int systemId)
        {
            Dictionary <string, object> commonDictionary    = JsonConvert.DeserializeObject <Dictionary <string, object> >(jsonWebhook);
            SystemToDbViewModel         systemToDbViewModel = new SystemToDbViewModel();

            logger.Info("WebHookReceiver UnitOfWork");
            int?id = 0;

            switch (commonDictionary[FieldEventType].ToString())
            {
            case "workitem.created":
                var webHookCreateRequest = JsonConvert.DeserializeObject <WebHookCreateRequest>(jsonWebhook);
                id = webHookCreateRequest.Resource?.Id;
                break;

            case "workitem.updated":
                var webHookUpdateRequest = JsonConvert.DeserializeObject <WebHookUpdateRequest>(jsonWebhook);
                id = webHookUpdateRequest.Resource?.WorkItemId;
                break;
            }
            SyncSystemDTO syncSystem = await syncSystemBusinessService.GetSyncSystemAsync(systemId);

            if (syncSystem == null || !id.HasValue || id == 0)
            {
                //await FillWebHookEntryAsync(unitOfWork, result);
                logger.Info("System not found " + systemId);
                logger.Info("WebHookReceiver END");
                return(new ProxyResponse
                {
                    Result = "ok",
                    Data = "WebHookReceiver POST"
                });
            }

            List <SyncSystemFieldMapping> syncSystemFieldMappings = syncSystemFieldMappingBusinessService.GetSyncSystemFieldMappings(systemId);

            //string.Empty, syncSystem.SystemPassword
            //VssConnection connection = new VssConnection(new Uri(syncSystem.SystemUrl + "/DefaultCollection"), new VssCredentials());

            VssConnection connection = new VssConnection(new Uri(syncSystem.SystemUrl + "/DefaultCollection"),
                                                         new VssBasicCredential(String.Empty, syncSystem.SystemPassword));

            // Create instance of WorkItemTrackingHttpClient using VssConnection
            WIT.WorkItemTrackingHttpClient witClient = connection.GetClient <WIT.WorkItemTrackingHttpClient>();
            WorkItem workItem = await witClient.GetWorkItemAsync(id.Value, expand : WorkItemExpand.Relations);

            //DbContextTransaction transaction = unitOfWork.BeginTransaction();
            try
            {
                #region Staging

                var staging = new Staging
                {
                    RecordDateCreated = DateTime.Now,
                    SystemId          = systemId,
                    ChangedFields     = "all",
                    RecordDateUpdated = DateTime.Now,
                    RecordState       = RecordStateConst.New,
                    WebHookEvent      = commonDictionary[FieldEventType].ToString()
                };

                if (workItem.Fields.ContainsKey("System.TeamProject"))
                {
                    staging.ProjectId   = (string)workItem.Fields["System.TeamProject"];
                    staging.ProjectKey  = (string)workItem.Fields["System.TeamProject"];
                    staging.ProjectName = (string)workItem.Fields["System.TeamProject"];
                }
                staging.IssueId  = workItem.Id?.ToString();
                staging.IssueKey = workItem.Id?.ToString();
                if (workItem.Fields.ContainsKey("System.WorkItemType"))
                {
                    staging.IssueTypeId   = workItem.Fields["System.WorkItemType"].ToString();
                    staging.IssueTypeName = workItem.Fields["System.WorkItemType"].ToString();
                }
                if (workItem.Fields.ContainsKey("System.Title"))
                {
                    staging.IssueName = workItem.Fields["System.Title"].ToString();
                }
                if (workItem.Fields.ContainsKey("System.IterationId"))
                {
                    staging.ParentVersionId = workItem.Fields["System.IterationId"].ToString();
                }
                if (workItem.Fields.ContainsKey("System.IterationLevel2"))
                {
                    staging.ParentVersionName = workItem.Fields["System.IterationLevel2"].ToString();
                }
                if (workItem.Fields.ContainsKey(FieldAssignedTo))
                {
                    if (workItem.Fields[FieldAssignedTo] != null)
                    {
                        staging.Assignee = workItem.Fields[FieldAssignedTo].ToString()
                                           .Substring(workItem.Fields[FieldAssignedTo].ToString()
                                                      .IndexOf("<", StringComparison.Ordinal)).Trim('<', '>');
                    }
                }
                if (workItem.Relations != null)
                {
                    WorkItemRelation relationCrt = workItem.Relations
                                                   .FirstOrDefault(x => x.Rel == "System.LinkTypes.Hierarchy-Reverse");
                    if (relationCrt != null)
                    {
                        if (workItem.Fields["System.WorkItemType"].ToString().ToLower().Equals("feature"))
                        {
                            staging.ParentEpicId  = relationCrt.Url.Substring(relationCrt.Url.LastIndexOf("/", StringComparison.Ordinal) + 1);
                            staging.ParentEpicKey = relationCrt.Url.Substring(relationCrt.Url.LastIndexOf("/", StringComparison.Ordinal) + 1);
                        }
                        else
                        {
                            staging.ParentIssueId  = relationCrt.Url.Substring(relationCrt.Url.LastIndexOf("/", StringComparison.Ordinal) + 1);
                            staging.ParentIssueKey = relationCrt.Url.Substring(relationCrt.Url.LastIndexOf("/", StringComparison.Ordinal) + 1);
                        }
                    }
                    else
                    {
                        staging.ParentIssueId  = null;
                        staging.ParentIssueKey = null;
                    }
                }
                systemToDbViewModel.StagingsToInsert.Add(staging);
                //FillStagingWorklog(unitOfWork, staging, workItem, systemId);

                SyncSystemFieldMapping fieldMappingRecordStateGeneral = syncSystemFieldMappings
                                                                        .FirstOrDefault(x => x.SystemId == staging.SystemId &&
                                                                                        x.EpmFieldName == ProjectServerConstants.RecordStateGeneral);

                if (fieldMappingRecordStateGeneral != null)
                {
                    var stagingFieldMappingValueGeneral = new StagingFieldMappingValue
                    {
                        Staging = staging,
                        SyncSystemFieldMappingId = fieldMappingRecordStateGeneral.SyncSystemFieldMappingId,
                        Value = RecordStateConst.New
                    };
                    systemToDbViewModel.StagingFieldMappingValuesToInsert.Add(stagingFieldMappingValueGeneral);
                }

                SyncSystemFieldMapping fieldMappingRecordStateActual = syncSystemFieldMappings
                                                                       .FirstOrDefault(x => x.SystemId == staging.SystemId &&
                                                                                       x.EpmFieldName == ProjectServerConstants.RecordStateActual);

                if (fieldMappingRecordStateActual != null)
                {
                    var stagingFieldMappingValueActual = new StagingFieldMappingValue
                    {
                        Staging = staging,
                        SyncSystemFieldMappingId = fieldMappingRecordStateActual.SyncSystemFieldMappingId,
                        Value = RecordStateConst.Done
                    };
                    systemToDbViewModel.StagingFieldMappingValuesToInsert.Add(stagingFieldMappingValueActual);
                }

                #endregion

                #region Master

                var master = masterBusinessService.GetIssueById(systemId, id.ToString(), staging.IssueTypeId);
                if (master == null)
                {
                    master = new Master
                    {
                        RecordDateCreated = DateTime.Now
                    };
                    systemToDbViewModel.MastersToInsert.Add(master);
                }

                master.RecordDateUpdated = DateTime.Now;
                master.SystemId          = systemId;

                master.IssueId   = staging.IssueId;
                master.IssueKey  = staging.IssueKey;
                master.IssueName = staging.IssueName;

                master.ProjectId   = staging.ProjectId;
                master.ProjectKey  = staging.ProjectKey;
                master.ProjectName = staging.ProjectName;

                master.IsSubTask = staging.IsSubTask;

                master.ParentVersionReleased = staging.ParentVersionReleased;
                master.IssueTypeName         = staging.IssueTypeName;
                master.IssueTypeId           = staging.IssueTypeId;
                master.DateFinish            = staging.DateFinish;
                master.DateRelease           = staging.DateRelease;

                #endregion

                #region MasterHistory

                var masterHistory = new MasterHistory
                {
                    RecordDateCreated = DateTime.Now
                };
                systemToDbViewModel.MasterHistoriesToInsert.Add(masterHistory);

                masterHistory.RecordDateUpdated = DateTime.Now;
                masterHistory.SystemId          = systemId;

                masterHistory.IssueId   = staging.IssueId;
                masterHistory.IssueKey  = staging.IssueKey;
                masterHistory.IssueName = staging.IssueName;

                masterHistory.ProjectId   = staging.ProjectId;
                masterHistory.ProjectKey  = staging.ProjectKey;
                masterHistory.ProjectName = staging.ProjectName;

                masterHistory.IsSubTask = staging.IsSubTask;

                masterHistory.ParentVersionReleased = staging.ParentVersionReleased;
                masterHistory.IssueTypeName         = staging.IssueTypeName;
                masterHistory.IssueTypeId           = staging.IssueTypeId;
                masterHistory.DateFinish            = staging.DateFinish;
                masterHistory.DateRelease           = staging.DateRelease;


                #endregion

                await commonBusinessService.AddNewData(systemToDbViewModel);

                //await unitOfWork.SaveChangesAsync();
                //unitOfWork.CommitTransaction(transaction);
            }
            //catch (DbEntityValidationException exception)
            //{
            //    logger.Fatal(exception);
            //    unitOfWork.RollbackTransaction(transaction);

            //    foreach (DbEntityValidationResult validationResult in exception.EntityValidationErrors)
            //    {
            //        foreach (DbValidationError error in validationResult.ValidationErrors)
            //        {
            //            logger.Fatal(error.PropertyName + " " + error.ErrorMessage);
            //        }
            //    }
            //}
            catch (Exception exception)
            {
                logger.Fatal(exception);
                //unitOfWork.RollbackTransaction(transaction);
            }

            logger.Info("WebHookReceiver END");
            return(new ProxyResponse
            {
                Result = "ok",
                Data = "WebHookReceiver POST"
            });
        }
        private void FillCustomFields(SystemToDbViewModel systemToDbViewModel, JiraRequest jiraRequest, Master master,
                                      Staging staging, MasterHistory masterHistory, List <SyncSystemFieldMapping> fieldMappings,
                                      string epicName)
        {
            List <MasterFieldMappingValue> masterFieldMappingValues =
                masterBusinessService.GetMasterFieldMappingValues(master.MasterId);

            foreach (SyncSystemFieldMapping fieldMapping in fieldMappings)
            {
                string resultValue = "";
                if (fieldMapping.EpmFieldName == ProjectServerConstants.RecordStateGeneral)
                {
                    SetCustomFields(systemToDbViewModel, fieldMapping, master, staging, masterHistory, RecordStateConst.New, null, true);
                    continue;
                }
                if (fieldMapping.EpmFieldName == ProjectServerConstants.RecordStateActual)
                {
                    SetCustomFields(systemToDbViewModel, fieldMapping, master, staging, masterHistory,
                                    RecordStateConst.Done, null, true);
                    continue;
                }
                if (String.IsNullOrEmpty(fieldMapping.SystemFieldName))
                {
                    continue;
                }
                if (fieldMapping.EpmFieldName == ProjectServerConstants.EpicName &&
                    !String.IsNullOrEmpty(epicName))
                {
                    SetCustomFields(systemToDbViewModel, fieldMapping, master, staging, masterHistory, epicName, masterFieldMappingValues);
                    continue;
                }
                CustomField customField = customFields
                                          .FirstOrDefault(x => x.Name == fieldMapping.SystemFieldName);
                if (customField != null)
                {
                    object customFieldValue = jiraRequest.Issue.GetField(customField.Id);
                    if (customFieldValue != null)
                    {
                        if (fieldMapping.IsMultiSelect && customFieldValue is JArray)
                        {
                            //logger.Info($"FillCustomFields JArray: {customFieldValue}");
                            var array = (JArray)customFieldValue;
                            resultValue = array.Aggregate(resultValue, (current, jToken) => current + (jToken + ",")).Trim(',');
                        }
                        else
                        {
                            if (fieldMapping.IsIdWithValue)
                            {
                                //logger.Info($"WebHookReceiver FillCustomFields fieldMapping.SystemFieldName: {fieldMapping.SystemFieldName} customFieldValue.ToString(): {customFieldValue}");
                                var objectProperties = JsonConvert.DeserializeObject <Dictionary <string, object> >(customFieldValue.ToString());

                                if (objectProperties.ContainsKey("value"))
                                {
                                    resultValue = objectProperties["value"].ToString();
                                }
                            }
                            else
                            {
                                resultValue = customFieldValue.ToString();
                            }
                        }
                        if (String.IsNullOrEmpty(resultValue))
                        {
                            continue;
                        }
                        SetCustomFields(systemToDbViewModel, fieldMapping, master, staging, masterHistory, resultValue, masterFieldMappingValues);
                    }
                }
            }
            //await unitOfWork.SaveChangesAsync();
        }
        private void SetCustomFields(SystemToDbViewModel systemToDbViewModel, SyncSystemFieldMapping fieldMapping,
                                     Master master, Staging staging, MasterHistory masterHistory, string resultValue,
                                     List <MasterFieldMappingValue> masterFieldMappingValues, bool isOnlyStaging = false)
        {
            if (fieldMapping == null)
            {
                return;
            }
            if (!isOnlyStaging)
            {
                if (master != null)
                {
                    MasterFieldMappingValue masterValue = masterFieldMappingValues
                                                          .FirstOrDefault(x => x.SyncSystemFieldMappingId == fieldMapping.SyncSystemFieldMappingId);
                    if (masterValue == null)
                    {
                        masterValue = new MasterFieldMappingValue
                        {
                            Master = master,
                            SyncSystemFieldMappingId = fieldMapping.SyncSystemFieldMappingId
                        };
                        systemToDbViewModel.MasterFieldMappingValuesToInsert.Add(masterValue);
                    }
                    if (!String.IsNullOrEmpty(resultValue))
                    {
                        masterValue.Value = resultValue.RemoveNewLinesTabs();
                    }
                }
                if (masterHistory != null)
                {
                    MasterHistoryFieldMappingValue masterHistoryValue = new MasterHistoryFieldMappingValue
                    {
                        MasterHistory            = masterHistory,
                        SyncSystemFieldMappingId = fieldMapping.SyncSystemFieldMappingId,
                        Value = resultValue
                    };
                    systemToDbViewModel.MasterHistoryFieldMappingValuesToInsert.Add(masterHistoryValue);
                }
            }
            if (staging != null)
            {
                StagingFieldMappingValue stagingValue = new StagingFieldMappingValue
                {
                    Staging = staging,
                    SyncSystemFieldMappingId = fieldMapping.SyncSystemFieldMappingId,
                    Value = resultValue
                };
                systemToDbViewModel.StagingFieldMappingValuesToInsert.Add(stagingValue);
            }
            if (!String.IsNullOrEmpty(fieldMapping.StagingFieldName))
            {
                if (staging != null)
                {
                    PropertyInfo piStaging = typeof(Staging).GetProperty(fieldMapping.StagingFieldName);
                    piStaging?.SetValue(staging, resultValue);
                }

                if (!isOnlyStaging)
                {
                    PropertyInfo piMaster = typeof(Master).GetProperty(fieldMapping.StagingFieldName);
                    piMaster?.SetValue(master, resultValue);

                    PropertyInfo piMasterHistory = typeof(MasterHistory).GetProperty(fieldMapping.StagingFieldName);
                    piMasterHistory?.SetValue(masterHistory, resultValue);
                }
            }
        }
コード例 #9
0
        public void SetSprintField(JiraSprint resultSprint, List <SyncSystemFieldMapping> syncSystemFieldMappings,
                                   Master master, MasterHistory masterHistory, Staging staging,
                                   List <MasterFieldMappingValue> masterFieldMappingValues,
                                   List <MasterHistoryFieldMappingValue> masterHistoryFieldMappingValues,
                                   List <StagingFieldMappingValue> stagingFieldMappingValues)
        {
            if (resultSprint != null)
            {
                Logger.Info($"ParseSprintField resultSprint.Id: {resultSprint.Id} " +
                            $"resultSprint.Name: {resultSprint.Name} " +
                            $"resultSprint.State: {resultSprint.State} " +
                            $"resultSprint.StartDate: {resultSprint.StartDate} " +
                            $"resultSprint.EndDate: {resultSprint.EndDate}");

                //we getting Ids for mapping frob DB
                int sprintIdSyncSystemFieldMappingId =
                    syncSystemFieldMappings.Where(x => x.EpmFieldName == ProjectServerConstants.SprintId)
                    .Select(y => y.SyncSystemFieldMappingId)
                    .FirstOrDefault();
                int sprintNameSyncSystemFieldMappingId =
                    syncSystemFieldMappings.Where(
                        x => x.EpmFieldName == ProjectServerConstants.SprintName)
                    .Select(y => y.SyncSystemFieldMappingId)
                    .FirstOrDefault();
                int sprintStateSyncSystemFieldMappingId =
                    syncSystemFieldMappings.Where(
                        x => x.EpmFieldName == ProjectServerConstants.SprintState)
                    .Select(y => y.SyncSystemFieldMappingId)
                    .FirstOrDefault();
                int sprintStartDateSyncSystemFieldMappingId =
                    syncSystemFieldMappings.Where(
                        x => x.EpmFieldName == ProjectServerConstants.SprintStartDate)
                    .Select(y => y.SyncSystemFieldMappingId)
                    .FirstOrDefault();
                int sprintEndDateSyncSystemFieldMappingId =
                    syncSystemFieldMappings.Where(
                        x => x.EpmFieldName == ProjectServerConstants.SprintEndDate)
                    .Select(y => y.SyncSystemFieldMappingId)
                    .FirstOrDefault();
                if (sprintIdSyncSystemFieldMappingId == 0 || sprintNameSyncSystemFieldMappingId == 0 ||
                    sprintStateSyncSystemFieldMappingId == 0 || sprintStartDateSyncSystemFieldMappingId == 0 ||
                    sprintEndDateSyncSystemFieldMappingId == 0)
                {
                    return;
                }
                //Id
                master.ParentSprintId        = resultSprint.Id;
                masterHistory.ParentSprintId = resultSprint.Id;
                masterFieldMappingValues.Add(new MasterFieldMappingValue
                {
                    Master = master,
                    SyncSystemFieldMappingId = sprintIdSyncSystemFieldMappingId,
                    Value = resultSprint.Id
                });
                masterHistoryFieldMappingValues.Add(new MasterHistoryFieldMappingValue
                {
                    MasterHistory            = masterHistory,
                    SyncSystemFieldMappingId = sprintIdSyncSystemFieldMappingId,
                    Value = resultSprint.Id
                });
                if (staging != null)
                {
                    //Id
                    staging.ParentSprintId = resultSprint.Id;
                    stagingFieldMappingValues.Add(new StagingFieldMappingValue
                    {
                        Staging = staging,
                        SyncSystemFieldMappingId = sprintIdSyncSystemFieldMappingId,
                        Value = resultSprint.Id
                    });
                    //Name
                    staging.ParentSprintName = resultSprint.Name;
                    stagingFieldMappingValues.Add(new StagingFieldMappingValue
                    {
                        Staging = staging,
                        SyncSystemFieldMappingId = sprintNameSyncSystemFieldMappingId,
                        Value = resultSprint.Name
                    });
                    //state
                    stagingFieldMappingValues.Add(new StagingFieldMappingValue
                    {
                        Staging = staging,
                        SyncSystemFieldMappingId = sprintStateSyncSystemFieldMappingId,
                        Value = resultSprint.State
                    });
                    //startdate
                    stagingFieldMappingValues.Add(new StagingFieldMappingValue
                    {
                        Staging = staging,
                        SyncSystemFieldMappingId = sprintStartDateSyncSystemFieldMappingId,
                        Value = resultSprint.StartDate
                    });
                    //enddate
                    stagingFieldMappingValues.Add(new StagingFieldMappingValue
                    {
                        Staging = staging,
                        SyncSystemFieldMappingId = sprintEndDateSyncSystemFieldMappingId,
                        Value = resultSprint.EndDate
                    });
                }
                //Name
                master.ParentSprintName        = resultSprint.Name;
                masterHistory.ParentSprintName = resultSprint.Name;
                masterFieldMappingValues.Add(new MasterFieldMappingValue
                {
                    Master = master,
                    SyncSystemFieldMappingId = sprintNameSyncSystemFieldMappingId,
                    Value = resultSprint.Name
                });
                masterHistoryFieldMappingValues.Add(new MasterHistoryFieldMappingValue
                {
                    MasterHistory            = masterHistory,
                    SyncSystemFieldMappingId = sprintNameSyncSystemFieldMappingId,
                    Value = resultSprint.Name
                });
                //state
                masterFieldMappingValues.Add(new MasterFieldMappingValue
                {
                    Master = master,
                    SyncSystemFieldMappingId = sprintStateSyncSystemFieldMappingId,
                    Value = resultSprint.State
                });
                masterHistoryFieldMappingValues.Add(new MasterHistoryFieldMappingValue
                {
                    MasterHistory            = masterHistory,
                    SyncSystemFieldMappingId = sprintStateSyncSystemFieldMappingId,
                    Value = resultSprint.State
                });
                //startdate
                masterFieldMappingValues.Add(new MasterFieldMappingValue
                {
                    Master = master,
                    SyncSystemFieldMappingId = sprintStartDateSyncSystemFieldMappingId,
                    Value = resultSprint.StartDate
                });
                masterHistoryFieldMappingValues.Add(new MasterHistoryFieldMappingValue
                {
                    MasterHistory            = masterHistory,
                    SyncSystemFieldMappingId = sprintStartDateSyncSystemFieldMappingId,
                    Value = resultSprint.StartDate
                });
                //enddate
                masterFieldMappingValues.Add(new MasterFieldMappingValue
                {
                    Master = master,
                    SyncSystemFieldMappingId = sprintEndDateSyncSystemFieldMappingId,
                    Value = resultSprint.EndDate
                });
                masterHistoryFieldMappingValues.Add(new MasterHistoryFieldMappingValue
                {
                    MasterHistory            = masterHistory,
                    SyncSystemFieldMappingId = sprintEndDateSyncSystemFieldMappingId,
                    Value = resultSprint.EndDate
                });

                Logger.Info($"ParseSprintField stagingFieldMappingValues.Count: {stagingFieldMappingValues.Count} " +
                            $"masterFieldMappingValues.Count: {masterFieldMappingValues.Count} " +
                            $"masterHistoryFieldMappingValues.Count: {masterHistoryFieldMappingValues.Count}");
            }
        }