DocumentField
using kCura.EDDS.WebAPI.BulkImportManagerBase;
using kCura.EDDS.WebAPI.DocumentManagerBase;
using Microsoft.VisualBasic.CompilerServices;
using Relativity.DataExchange;
using Relativity.DataExchange.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
namespace kCura.WinEDDS
{
[Serializable]
public class DocumentField : ISerializable
{
private string _fieldName;
private int _fieldID;
private int _fieldTypeID;
private string _value;
private int _fieldCategoryID;
private int? _codeTypeID;
private int _fileColumnIndex;
private int? _fieldLength;
[NonSerialized]
private int? _associatedObjectTypeID;
[NonSerialized]
private bool _useUnicode;
[NonSerialized]
private kCura.EDDS.WebAPI.DocumentManagerBase.ImportBehaviorChoice? _importBehavior;
[NonSerialized]
private bool _enableDataGrid;
[CompilerGenerated]
private List<Guid> _Guids;
public int? AssociatedObjectTypeID {
get {
return _associatedObjectTypeID;
}
set {
_associatedObjectTypeID = value;
}
}
public bool UseUnicode {
get {
return _useUnicode;
}
set {
_useUnicode = value;
}
}
public kCura.EDDS.WebAPI.DocumentManagerBase.ImportBehaviorChoice? ImportBehavior {
get {
return _importBehavior;
}
set {
_importBehavior = value;
}
}
public bool EnableDataGrid {
get {
return _enableDataGrid;
}
set {
_enableDataGrid = value;
}
}
public string FieldName {
get {
return _fieldName;
}
set {
_fieldName = value;
}
}
public int FieldID {
get {
return _fieldID;
}
set {
_fieldID = value;
}
}
public int FieldTypeID {
get {
return _fieldTypeID;
}
set {
_fieldTypeID = value;
}
}
public int FieldCategoryID {
get {
return _fieldCategoryID;
}
set {
_fieldCategoryID = value;
}
}
public global::Relativity.DataExchange.Service.FieldCategory FieldCategory {
get {
return (global::Relativity.DataExchange.Service.FieldCategory)_fieldCategoryID;
}
set {
_fieldCategoryID = (int)value;
}
}
public string Value {
get {
return _value;
}
set {
_value = value;
}
}
public int? CodeTypeID {
get {
return _codeTypeID;
}
set {
_codeTypeID = value;
}
}
public int FileColumnIndex {
get {
return _fileColumnIndex;
}
set {
_fileColumnIndex = value;
}
}
public int? FieldLength {
get {
return _fieldLength;
}
set {
_fieldLength = value;
}
}
public List<Guid> Guids { get; set; }
private DocumentField(SerializationInfo info, StreamingContext Context)
{
FieldName = info.GetString("_fieldName");
FieldID = info.GetInt32("_fieldID");
FieldTypeID = info.GetInt32("_fieldTypeID");
Value = info.GetString("_value");
FieldCategoryID = info.GetInt32("_fieldCategoryID");
FileColumnIndex = info.GetInt32("_fileColumnIndex");
Guids = new List<Guid>();
}
public DocumentField(string fieldName, int fieldID, int fieldTypeID, int fieldCategoryID, int? codeTypeID, int? fieldLength, int? associatedObjectTypeID, bool useUnicode, kCura.EDDS.WebAPI.DocumentManagerBase.ImportBehaviorChoice? importBehavior, bool enableDataGrid)
: this(fieldName, fieldID, fieldTypeID, fieldCategoryID, codeTypeID, fieldLength, associatedObjectTypeID, useUnicode, importBehavior, new List<Guid>(), enableDataGrid)
{
}
public DocumentField(string fieldName, int fieldID, int fieldTypeID, int fieldCategoryID, int? codeTypeID, int? fieldLength, int? associatedObjectTypeID, bool useUnicode, kCura.EDDS.WebAPI.DocumentManagerBase.ImportBehaviorChoice? importBehavior, IEnumerable<Guid> guids, bool enableDataGrid)
{
_fieldName = fieldName;
_fieldID = fieldID;
_fieldTypeID = fieldTypeID;
_fieldCategoryID = fieldCategoryID;
_codeTypeID = codeTypeID;
_fieldLength = fieldLength;
_associatedObjectTypeID = associatedObjectTypeID;
_useUnicode = useUnicode;
_importBehavior = importBehavior;
_enableDataGrid = enableDataGrid;
if (guids != null)
Guids = guids.ToList();
else
Guids = new List<Guid>();
}
public DocumentField(DocumentField docField)
: this(docField.FieldName, docField.FieldID, docField.FieldTypeID, docField.FieldCategoryID, docField.CodeTypeID, docField.FieldLength, docField.AssociatedObjectTypeID, docField.UseUnicode, docField.ImportBehavior, docField.EnableDataGrid)
{
}
public string ToDisplayString()
{
return $"""{FieldCategoryID}""{FieldID}""{FieldName}""{FieldTypeID}""{NullableTypesHelper.ToEmptyStringOrValue(CodeTypeID)}""";
}
public override string ToString()
{
return FieldName;
}
public FieldInfo ToFieldInfo()
{
FieldInfo fieldInfo = new FieldInfo();
fieldInfo.ArtifactID = FieldID;
fieldInfo.Category = (kCura.EDDS.WebAPI.BulkImportManagerBase.FieldCategory)FieldCategoryID;
if (CodeTypeID.HasValue)
fieldInfo.CodeTypeID = CodeTypeID.Value;
fieldInfo.DisplayName = FieldName;
if (FieldLength.HasValue)
fieldInfo.TextLength = FieldLength.Value;
fieldInfo.Type = ConvertFieldTypeEnum();
fieldInfo.IsUnicodeEnabled = UseUnicode;
fieldInfo.ImportBehavior = ConvertImportBehaviorEnum();
fieldInfo.EnableDataGrid = EnableDataGrid;
return fieldInfo;
}
private kCura.EDDS.WebAPI.BulkImportManagerBase.FieldType ConvertFieldTypeEnum()
{
global::Relativity.DataExchange.Service.FieldType fieldTypeID = (global::Relativity.DataExchange.Service.FieldType)FieldTypeID;
return (kCura.EDDS.WebAPI.BulkImportManagerBase.FieldType)Conversions.ToInteger(Enum.Parse(typeof(kCura.EDDS.WebAPI.BulkImportManagerBase.FieldType), fieldTypeID.ToString()));
}
private kCura.EDDS.WebAPI.BulkImportManagerBase.ImportBehaviorChoice? ConvertImportBehaviorEnum()
{
kCura.EDDS.WebAPI.BulkImportManagerBase.ImportBehaviorChoice? result;
if (!ImportBehavior.HasValue)
result = null;
else {
kCura.EDDS.WebAPI.DocumentManagerBase.ImportBehaviorChoice value = ImportBehavior.Value;
result = ((value == kCura.EDDS.WebAPI.DocumentManagerBase.ImportBehaviorChoice.ReplaceBlankValuesWithIdentifier) ? new kCura.EDDS.WebAPI.BulkImportManagerBase.ImportBehaviorChoice?(kCura.EDDS.WebAPI.BulkImportManagerBase.ImportBehaviorChoice.ReplaceBlankValuesWithIdentifier) : new kCura.EDDS.WebAPI.BulkImportManagerBase.ImportBehaviorChoice?(kCura.EDDS.WebAPI.BulkImportManagerBase.ImportBehaviorChoice.LeaveBlankValuesUnchanged));
}
return result;
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("_fieldName", FieldName, typeof(string));
info.AddValue("_fieldID", FieldID, typeof(int));
info.AddValue("_fieldTypeID", FieldTypeID, typeof(int));
info.AddValue("_value", Value, typeof(string));
info.AddValue("_fieldCategoryID", FieldCategoryID, typeof(int));
info.AddValue("_fileColumnIndex", FileColumnIndex, typeof(int));
}
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
this.GetObjectData(info, context);
}
public static bool op_Equality(DocumentField df1, DocumentField df2)
{
bool flag = (!df1.CodeTypeID.HasValue) ? ((!df2.CodeTypeID.HasValue) ? true : false) : (!df2.CodeTypeID.HasValue || df1.CodeTypeID.Value == df2.CodeTypeID.Value);
flag &= (df1.FieldCategoryID == df2.FieldCategoryID);
flag &= (Operators.CompareString(df1.FieldName, df2.FieldName, false) == 0);
flag &= (df1.FieldTypeID == df2.FieldTypeID);
return flag & (Operators.CompareString(df1.Value, df2.Value, false) == 0);
}
}
}