Пример #1
0
        private static void CreateIssueTypeDetail(IssueTypeRequestEntity[] innerIssueTypes, IssueTypeDetail detail, Quilt4DataContext context)
        {
            if (innerIssueTypes == null) return;

            foreach (var issueTypeRequestEntity in innerIssueTypes)
            {
                if (issueTypeRequestEntity == null) return;

                var issueTypeDetail = new IssueTypeDetail
                {
                    Type = issueTypeRequestEntity.Type,
                    Message = issueTypeRequestEntity.Message,
                    StackTrace = issueTypeRequestEntity.StackTrace,
                    IssueTypeDetail1 = detail
                };
                context.IssueTypeDetails.InsertOnSubmit(issueTypeDetail);

                CreateIssueTypeDetail(issueTypeRequestEntity.Inner, issueTypeDetail, context);
            }
        }
Пример #2
0
        private IEnumerable<KeyValuePair<string,string>> GetData(IssueTypeRequestEntity issueTypeRequestEntity)
        {
            if (issueTypeRequestEntity == null)
                yield break;

            if (issueTypeRequestEntity.Data != null)
            {
                foreach (var data in issueTypeRequestEntity.Data)
                {
                    yield return new KeyValuePair<string, string>(data.Key, data.Value);
                }
            }

            if (issueTypeRequestEntity.Inner != null)
            {
                foreach (var inner in issueTypeRequestEntity.Inner)
                {
                    var response = GetData(inner);
                    foreach (var item in response)
                        yield return item;
                }
            }
        }
Пример #3
0
        public void CreateIssueType(Guid issueTypeKey, Guid versionKey, int ticket, string type, string issueLevel, string message, string stackTrace, DateTime serverTime, IssueTypeRequestEntity[] innerIssueTypes)
        {
            using (var context = GetDataContext())
            {
                var itk = GetIssueTypeKey(issueTypeKey, type, issueLevel, message, stackTrace);
                if (itk != null) throw new InvalidOperationException("A IssueType with this signature already exists.");

                var detail = new IssueTypeDetail
                {
                    Type = type,
                    Message = message,
                    StackTrace = stackTrace,                        
                };
                context.IssueTypeDetails.InsertOnSubmit(detail);

                var newIssueType = new IssueType
                {
                    IssueTypeKey = issueTypeKey,
                    VersionId = context.Versions.Single(x => x.VersionKey == versionKey).VersionId,
                    Ticket = ticket,
                    Level = issueLevel,
                    CreationServerTime = serverTime,
                    IssueTypeDetail = detail
                };
                context.IssueTypes.InsertOnSubmit(newIssueType);

                CreateIssueTypeDetail(innerIssueTypes, detail, context);

                context.SubmitChanges();
            }
        }