/// <summary> /// Update Images in Law /// </summary> /// <param name="document"></param> private void UpdateDocumentImageInLaw(LawSyncDocumentDetail document) { var lawDocumentUpdate = new LawDocumentBEO { LawDocId = document.LawDocumentId, ImagePaths = document.ProducedImages }; _lawEvAdapter.UpdateLawImagePaths(lawDocumentUpdate); _documentProcessStateList.Add(GetDocumentProcessStateInformationForImageSync(document, (int)LawSyncProcessState.Completed)); }
private void UpdateDocumentsMetadatasInLaw(LawSyncDocumentCollection lawDocumentsList) { try { var lawEvAdapter = LawBO.GetLawAdapter(_jobParameter.LawCaseId); var lawDocumentUpdateList = new List <LawDocumentBEO>(); var metadatNameList = new List <string>(); if (_jobParameter.MappingFields != null && _jobParameter.MappingFields.Any()) { metadatNameList.AddRange(_jobParameter.MappingFields.Select(fields => fields.Name).ToList()); } if (_jobParameter.MappingTags != null && _jobParameter.MappingTags.Any()) { metadatNameList.AddRange(_jobParameter.MappingTags.Select(tags => tags.Name).ToList()); } metadatNameList.Add(_jobParameter.LawSyncTagName); foreach (var document in lawDocumentsList.Documents.Where(d => !d.IsErrorOnGetMetadata)) { var lawDocumentUpdate = new LawDocumentBEO { LawDocId = document.LawDocumentId, LawMetadatas = document.MetadataList }; lawDocumentUpdateList.Add(lawDocumentUpdate); } if (lawDocumentUpdateList.Any()) { lawEvAdapter.UpdateLawMetadata(lawDocumentUpdateList, metadatNameList); foreach (var document in lawDocumentsList.Documents.Where(d => !d.IsErrorOnGetMetadata)) { _documentProcessStateList.Add(GetDocumentProcessStateInformation(document, (int)LawSyncProcessState.Completed)); } } } catch (Exception ex) { //Construct Log foreach (var document in lawDocumentsList.Documents) { ConstructLog(document.LawDocumentId, document.CorrelationId, document.DocumentControlNumber, Constants.LawSyncFailureinSyncMetadataMessage); _documentProcessStateList.Add(GetDocumentProcessStateInformation(document, (int)LawSyncProcessState.Failed)); document.IsErrorOnSyncMetadata = true; } ex.Trace().Swallow(); ReportToDirector(ex); } }
protected void btnSyncImagePaths_Click(object sender, EventArgs e) { try { string lawIniFile = txtLawIniFile.Text; int lawDocID = Convert.ToInt32(txtLawDocID.Text); List <string> imagePaths = SplitStr(txtImagePaths.Text, "\r\n".ToCharArray()); IEVLawAdapter adapter = EVLawAdapterFactory.NewEVLawAdapter(lawIniFile, "law_user", "law32sql"); var lawDoc = new LawDocumentBEO() { LawDocId = lawDocID, ImagePaths = imagePaths }; adapter.UpdateLawImagePaths(lawDoc); ltlResult.Text = "Update image paths complete"; } catch (Exception ex) { ltlResult.Text = string.Format("Error Code: {0}\r\nUser Message: {1}\r\n{2}", ex.GetErrorCode(), ex.ToUserString(), ex.ToString()); } }
private void UpdateDocumentsMetadatasInLaw(LawSyncDocumentCollection lawDocumentsList) { try { var lawEvAdapter = LawBO.GetLawAdapter(_jobParameter.LawCaseId); var lawDocumentUpdateList = new List<LawDocumentBEO>(); var metadatNameList = new List<string>(); if (_jobParameter.MappingFields != null && _jobParameter.MappingFields.Any()) { metadatNameList.AddRange(_jobParameter.MappingFields.Select(fields => fields.Name).ToList()); } if (_jobParameter.MappingTags != null && _jobParameter.MappingTags.Any()) { metadatNameList.AddRange(_jobParameter.MappingTags.Select(tags => tags.Name).ToList()); } metadatNameList.Add(_jobParameter.LawSyncTagName); foreach (var document in lawDocumentsList.Documents.Where(d=>!d.IsErrorOnGetMetadata)) { var lawDocumentUpdate = new LawDocumentBEO { LawDocId = document.LawDocumentId, LawMetadatas = document.MetadataList }; lawDocumentUpdateList.Add(lawDocumentUpdate); } if (lawDocumentUpdateList.Any()) { lawEvAdapter.UpdateLawMetadata(lawDocumentUpdateList, metadatNameList); foreach (var document in lawDocumentsList.Documents.Where(d => !d.IsErrorOnGetMetadata)) { _documentProcessStateList.Add(GetDocumentProcessStateInformation(document, (int)LawSyncProcessState.Completed)); } } } catch (Exception ex) { //Construct Log foreach (var document in lawDocumentsList.Documents) { ConstructLog(document.LawDocumentId, document.CorrelationId, document.DocumentControlNumber, Constants.LawSyncFailureinSyncMetadataMessage); _documentProcessStateList.Add(GetDocumentProcessStateInformation(document, (int)LawSyncProcessState.Failed)); document.IsErrorOnSyncMetadata = true; } ex.Trace().Swallow(); ReportToDirector(ex); } }
protected void btnSyncMetadata_Click(object sender, EventArgs e) { try { string lawIniFile = txtLawIniFile.Text; List<string> fieldNames = SplitStr(txtFieldNames.Text); List<string> fieldTypes = SplitStr(txtFieldTypes.Text); List<string> fieldValues = SplitStr(txtFieldValues.Text); List<string> tagNames = SplitStr(txtTagNames.Text); List<string> tagValues = SplitStr(txtTagValues.Text); IEVLawAdapter adapter = EVLawAdapterFactory.NewEVLawAdapter(lawIniFile, "law_user", "law32sql"); string[] range = txtLawDocIDRange.Text.Split(" -".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); int lawDocIdBegin = Convert.ToInt32(range[0]); int lawDocIdEnd = Convert.ToInt32(range[1]); int fieldCount = fieldNames.Count; int tagCount = tagNames.Count; int i; List<LawMetadataBEO> metadatas = new List<LawMetadataBEO>(); for (i = 0; i < fieldCount; i++) { string inputFieldValue = fieldValues[i]; LawFieldTypeBEO lawFieldType; Object fieldValue; bool isFieldValueNull = "null".Equals(inputFieldValue, StringComparison.InvariantCultureIgnoreCase); switch (fieldTypes[i]) { case "string": lawFieldType = LawFieldTypeBEO.String; fieldValue = isFieldValueNull ? null : inputFieldValue; break; case "int": lawFieldType = LawFieldTypeBEO.Numeric; fieldValue = isFieldValueNull ? null : (Object) Convert.ToInt32(inputFieldValue); break; case "date": lawFieldType = LawFieldTypeBEO.DateTime; fieldValue = isFieldValueNull ? null : (Object) DateTime.ParseExact(inputFieldValue, "yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture); break; default: throw new Exception("Invalid fieldType: " + fieldTypes[i]); } var metadata = new LawMetadataBEO { IsTag = false, Name = fieldNames[i], Type = lawFieldType, Value = fieldValue }; metadatas.Add(metadata); adapter.CreateField(fieldNames[i], lawFieldType); } for (i = 0; i < tagCount; i++) { var metadata = new LawMetadataBEO { IsTag = true, Name = tagNames[i], Value = tagValues[i].Equals("true", StringComparison.OrdinalIgnoreCase) ? true : false }; metadatas.Add(metadata); adapter.CreateTag(tagNames[i]); } var lawDocs = new List<LawDocumentBEO>(); for (int docId = lawDocIdBegin; docId <= lawDocIdEnd; docId++) { var lawDoc = new LawDocumentBEO() { LawDocId = docId, LawMetadatas = CloneLawMetadataList(metadatas) }; lawDocs.Add(lawDoc); } List<string> metadataNames = new List<string>(); metadataNames.AddRange(fieldNames); metadataNames.AddRange(tagNames); // fieldNames.SafeForEach(o => adapter.CreateField(o, LawFieldTypeBEO.Numeric)); // tagNames.SafeForEach(o => adapter.CreateTag(o)); adapter.UpdateLawMetadata(lawDocs, metadataNames); ltlResult.Text = "Law Sync Success"; } catch (Exception ex) { ltlResult.Text = string.Format("Error Code: {0}\r\nUser Message: {1}\r\nDebug Message: {2}\r\n{3}", ex.GetErrorCode(), ex.ToUserString(), ex.ToDebugString(), ex.ToString()); } }
protected void btnSyncImagePaths_Click(object sender, EventArgs e) { try { string lawIniFile = txtLawIniFile.Text; int lawDocID = Convert.ToInt32(txtLawDocID.Text); List<string> imagePaths = SplitStr(txtImagePaths.Text, "\r\n".ToCharArray()); IEVLawAdapter adapter = EVLawAdapterFactory.NewEVLawAdapter(lawIniFile, "law_user", "law32sql"); var lawDoc = new LawDocumentBEO() { LawDocId = lawDocID, ImagePaths = imagePaths }; adapter.UpdateLawImagePaths(lawDoc); ltlResult.Text = "Update image paths complete"; } catch (Exception ex) { ltlResult.Text = string.Format("Error Code: {0}\r\nUser Message: {1}\r\n{2}", ex.GetErrorCode(), ex.ToUserString(), ex.ToString()); } }
/// <summary> /// Update Images in Law /// </summary> /// <param name="document"></param> private void UpdateDocumentImageInLaw(LawSyncDocumentDetail document) { var lawDocumentUpdate = new LawDocumentBEO { LawDocId = document.LawDocumentId, ImagePaths = document.ProducedImages }; _lawEvAdapter.UpdateLawImagePaths(lawDocumentUpdate); _documentProcessStateList.Add(GetDocumentProcessStateInformationForImageSync(document, (int) LawSyncProcessState.Completed)); }
protected void btnSyncMetadata_Click(object sender, EventArgs e) { try { string lawIniFile = txtLawIniFile.Text; List <string> fieldNames = SplitStr(txtFieldNames.Text); List <string> fieldTypes = SplitStr(txtFieldTypes.Text); List <string> fieldValues = SplitStr(txtFieldValues.Text); List <string> tagNames = SplitStr(txtTagNames.Text); List <string> tagValues = SplitStr(txtTagValues.Text); IEVLawAdapter adapter = EVLawAdapterFactory.NewEVLawAdapter(lawIniFile, "law_user", "law32sql"); string[] range = txtLawDocIDRange.Text.Split(" -".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); int lawDocIdBegin = Convert.ToInt32(range[0]); int lawDocIdEnd = Convert.ToInt32(range[1]); int fieldCount = fieldNames.Count; int tagCount = tagNames.Count; int i; List <LawMetadataBEO> metadatas = new List <LawMetadataBEO>(); for (i = 0; i < fieldCount; i++) { string inputFieldValue = fieldValues[i]; LawFieldTypeBEO lawFieldType; Object fieldValue; bool isFieldValueNull = "null".Equals(inputFieldValue, StringComparison.InvariantCultureIgnoreCase); switch (fieldTypes[i]) { case "string": lawFieldType = LawFieldTypeBEO.String; fieldValue = isFieldValueNull ? null : inputFieldValue; break; case "int": lawFieldType = LawFieldTypeBEO.Numeric; fieldValue = isFieldValueNull ? null : (Object)Convert.ToInt32(inputFieldValue); break; case "date": lawFieldType = LawFieldTypeBEO.DateTime; fieldValue = isFieldValueNull ? null : (Object)DateTime.ParseExact(inputFieldValue, "yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture); break; default: throw new Exception("Invalid fieldType: " + fieldTypes[i]); } var metadata = new LawMetadataBEO { IsTag = false, Name = fieldNames[i], Type = lawFieldType, Value = fieldValue }; metadatas.Add(metadata); adapter.CreateField(fieldNames[i], lawFieldType); } for (i = 0; i < tagCount; i++) { var metadata = new LawMetadataBEO { IsTag = true, Name = tagNames[i], Value = tagValues[i].Equals("true", StringComparison.OrdinalIgnoreCase) ? true : false }; metadatas.Add(metadata); adapter.CreateTag(tagNames[i]); } var lawDocs = new List <LawDocumentBEO>(); for (int docId = lawDocIdBegin; docId <= lawDocIdEnd; docId++) { var lawDoc = new LawDocumentBEO() { LawDocId = docId, LawMetadatas = CloneLawMetadataList(metadatas) }; lawDocs.Add(lawDoc); } List <string> metadataNames = new List <string>(); metadataNames.AddRange(fieldNames); metadataNames.AddRange(tagNames); // fieldNames.SafeForEach(o => adapter.CreateField(o, LawFieldTypeBEO.Numeric)); // tagNames.SafeForEach(o => adapter.CreateTag(o)); adapter.UpdateLawMetadata(lawDocs, metadataNames); ltlResult.Text = "Law Sync Success"; } catch (Exception ex) { ltlResult.Text = string.Format("Error Code: {0}\r\nUser Message: {1}\r\nDebug Message: {2}\r\n{3}", ex.GetErrorCode(), ex.ToUserString(), ex.ToDebugString(), ex.ToString()); } }