/// <summary>
 /// Add a converter for a type.
 /// </summary>
 /// <param name="type">Type.</param>
 /// <param name="converter">Converter.</param>
 public static void AddConverter(CustomDataType type, TypeConverter converter)
 {
     if (type == CustomDataType.Other)
         throw new InvalidOperationException("Not support Other type.");
     if (converter == null)
         throw new ArgumentNullException("converter");
     if (_DefaultItems.ContainsKey(type))
         _DefaultItems[type] = converter;
     else
         _DefaultItems.Add(type, converter);
 }
        public static async Task<ContentResult> AddOrUpdate(
            SocialGamificationAssetContext db,
            IList<CustomDataBase> sourceData,
            Guid objectId,
            CustomDataType objectType)
        {
            // Build the filter by CustomData
            if (sourceData != null && sourceData.Count > 0)
            {
                foreach (var data in sourceData)
                {
                    var customData =
                        await
                        db.CustomData.Where(c => c.Key.Equals(data.Key))
                          .Where(c => c.ObjectId.Equals(objectId))
                          .Where(c => c.ObjectType == objectType)
                          .FirstOrDefaultAsync();

                    if (customData != null)
                    {
                        db.Entry(customData).State = EntityState.Modified;
                        customData.Value = data.Value;
                    }
                    else
                    {
                        customData = new CustomData
                        {
                            Key = data.Key,
                            Value = data.Value,
                            ObjectId = objectId,
                            ObjectType = objectType
                        };

                        db.CustomData.Add(customData);
                    }
                }
            }

            return await SaveChanges(db, true);
        }
        public static async Task <ContentResult> AddOrUpdate(
            SocialGamificationAssetContext db,
            IList <CustomDataBase> sourceData,
            Guid objectId,
            CustomDataType objectType)
        {
            // Build the filter by CustomData
            if (sourceData != null && sourceData.Count > 0)
            {
                foreach (var data in sourceData)
                {
                    var customData =
                        await
                        db.CustomData.Where(c => c.Key.Equals(data.Key))
                        .Where(c => c.ObjectId.Equals(objectId))
                        .Where(c => c.ObjectType == objectType)
                        .FirstOrDefaultAsync();

                    if (customData != null)
                    {
                        db.Entry(customData).State = EntityState.Modified;
                        customData.Value           = data.Value;
                    }
                    else
                    {
                        customData = new CustomData
                        {
                            Key        = data.Key,
                            Value      = data.Value,
                            ObjectId   = objectId,
                            ObjectType = objectType
                        };

                        db.CustomData.Add(customData);
                    }
                }
            }

            return(await SaveChanges(db, true));
        }
        public static IQueryable <CustomData> ConditionBuilder(
            SocialGamificationAssetContext db,
            IList <CustomDataBase> sourceData,
            CustomDataType objectType)
        {
            var query = db.CustomData.Where(c => c.ObjectType == objectType);

            if (sourceData == null || sourceData.Count <= 0)
            {
                return(null);
            }

            foreach (var data in sourceData)
            {
                query = query.Where(c => c.Key.Equals(data.Key));

                if (!AllowedOperators.Contains(data.Operator))
                {
                    continue;
                }

                switch (data.Operator)
                {
                case "=":
                    query = query.Where(c => c.Value.Equals(data.Value));
                    break;

                case "!":
                    query = query.Where(c => c.Value != data.Value);
                    break;

                case "%":
                    query = query.Where(c => c.Value.Contains(data.Value));
                    break;
                }
            }

            return(query);
        }
 public virtual GvError Calculate(int calculation, CustomDataType src1, CustomDataType src2, CustomDataType dst, double parm1) {
   GvError ret = (GvError)C4dApiPINVOKE.CustomDataTypeClass_Calculate(swigCPtr, calculation, CustomDataType.getCPtr(src1), CustomDataType.getCPtr(src2), CustomDataType.getCPtr(dst), parm1);
   return ret;
 }
Exemple #6
0
 /// <summary>
 /// A simple 1D kernel that references types which in turn reference internal
 /// custom types of the current assembly.
 /// </summary>
 /// <param name="index">The current thread index.</param>
 /// <param name="dataView">The view pointing to our memory buffer.</param>
 static void MyKernel(
     Index1D index,
     ArrayView <CustomDataType> dataView)
 {
     dataView[index] = new CustomDataType(index);
 }
Exemple #7
0
 public GeData(int type, CustomDataType data) : this(C4dApiPINVOKE.new_GeData__SWIG_15(type, CustomDataType.getCPtr(data)), true) {
   if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
 }
        public List <CustomDataType> GetProviderDate(string attributeName, int year, int month)
        {
            int      i;
            int      machineID;
            int      startTimeStamp;
            int      endTimeStamp;
            string   databaseName;
            string   tableName;
            string   commandText;
            DateTime start;
            DateTime end;

            string[,] tableArray;
            List <CustomDataType> repaired   = null;
            List <CustomDataType> scheduled  = null;
            List <CustomDataType> maintained = null;
            List <CustomDataType> customData = new List <CustomDataType>();

            machineID = selectedMachine + 1;
            //  machineID = 8;
            commandText  = null;
            databaseName = gVariable.DBHeadString + machineID.ToString().PadLeft(3, '0');
            tableName    = gVariable.machineWorkingPlanTableName;

            //start of the month
            start          = new DateTime(year, month, 1);
            startTimeStamp = toolClass.ConvertDateTimeInt(start);

            //get the end of month 2018-04-30 23:59:59
            end          = start.AddMonths(1).AddSeconds(-1);
            endTimeStamp = toolClass.ConvertDateTimeInt(end);

            //get possible position for a plan(including repaired/scheduled/aintained)
            if (attributeName == "Repaired")
            {
                repaired    = new List <CustomDataType>();
                commandText = "select * from `" + tableName + "` where ((timeStamp1 < " + startTimeStamp + " and timeStamp2 > " + startTimeStamp + ") or (timeStamp1 >= " +
                              startTimeStamp + " and timeStamp1 < " + endTimeStamp + ")) and typeID = 0";
            }
            else if (attributeName == "Scheduled")
            {
                scheduled   = new List <CustomDataType>();
                commandText = "select * from `" + tableName + "` where ((timeStamp1 < " + startTimeStamp + " and timeStamp2 > " + startTimeStamp + ") or (timeStamp1 >= " +
                              startTimeStamp + " and timeStamp1 < " + endTimeStamp + ")) and typeID = 1";
            }
            else if (attributeName == "Maintained")
            {
                maintained  = new List <CustomDataType>();
                commandText = "select * from `" + tableName + "` where ((timeStamp1 < " + startTimeStamp + " and timeStamp2 > " + startTimeStamp + ") or (timeStamp1 >= " +
                              startTimeStamp + " and timeStamp1 < " + endTimeStamp + ")) and typeID > 1";
            }
            tableArray = mySQLClass.databaseCommonReading(databaseName, commandText);
            if (tableArray != null)
            {
                for (i = 0; i < tableArray.GetLength(0); i++)
                {
                    CustomDataType customDate = new CustomDataType();
                    customDate.id   = Convert.ToInt32(tableArray[i, 1]);
                    customDate.attr = attributeName;

                    if (Convert.ToInt32(tableArray[i, 5]) < startTimeStamp)  //start from prevous month
                    {
                        customDate.startTime = start.ToString();
                    }
                    else
                    {
                        customDate.startTime = tableArray[i, 4];
                    }

                    if (Convert.ToInt32(tableArray[i, 8]) > endTimeStamp)  //end in next month
                    {
                        customDate.endTime = end.ToString();
                    }
                    else
                    {
                        customDate.endTime = tableArray[i, 7];
                    }

                    if (attributeName == "Repaired")
                    {
                        repaired.Add(customDate);
                    }
                    else if (attributeName == "Scheduled")
                    {
                        scheduled.Add(customDate);
                    }
                    else if (attributeName == "Maintained")
                    {
                        maintained.Add(customDate);
                    }
                }
            }

            if (attributeName == "Repaired")
            {
                return(repaired);
            }
            else if (attributeName == "Scheduled")
            {
                return(scheduled);
            }
            else if (attributeName == "Maintained")
            {
                return(maintained);
            }
            else
            {
                return(null);
            }
        }
Exemple #9
0
 public virtual void WriteData(FastBinaryWriter writer, Object additionalInfo)
 {
     writer.Write(CustomDataType.GetHashCode());
     writer.Write(Level);
 }
 /// <summary>
 /// Get converter for a type.
 /// </summary>
 /// <param name="type">Defined type.</param>
 /// <returns></returns>
 public static TypeConverter GetConverter(CustomDataType type)
 {
     TypeConverter converter;
     _DefaultItems.TryGetValue(type, out converter);
     return converter;
 }
        public virtual bool WriteData(CustomDataType d, HyperFile hf)
        {
            bool ret = C4dApiPINVOKE.CustomDataTypeClass_WriteData(swigCPtr, CustomDataType.getCPtr(d), HyperFile.getCPtr(hf));

            return(ret);
        }
        public virtual bool CopyData(CustomDataType src, CustomDataType dest, AliasTrans aliastrans)
        {
            bool ret = C4dApiPINVOKE.CustomDataTypeClass_CopyData(swigCPtr, CustomDataType.getCPtr(src), CustomDataType.getCPtr(dest), AliasTrans.getCPtr(aliastrans));

            return(ret);
        }
        public virtual GvError Calculate(int calculation, CustomDataType src1, CustomDataType src2, CustomDataType dst, double parm1)
        {
            GvError ret = (GvError)C4dApiPINVOKE.CustomDataTypeClass_Calculate(swigCPtr, calculation, CustomDataType.getCPtr(src1), CustomDataType.getCPtr(src2), CustomDataType.getCPtr(dst), parm1);

            return(ret);
        }
 public virtual GvError ConvertToGeData(int dst_type, CustomDataType src, GeData dst) {
   GvError ret = (GvError)C4dApiPINVOKE.CustomDataTypeClass_ConvertToGeData(swigCPtr, dst_type, CustomDataType.getCPtr(src), GeData.getCPtr(dst));
   if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public virtual GvError ConvertToGv(int dst_type, CustomDataType src, SWIGTYPE_p_void dst, int cpu_id) {
   GvError ret = (GvError)C4dApiPINVOKE.CustomDataTypeClass_ConvertToGv(swigCPtr, dst_type, CustomDataType.getCPtr(src), SWIGTYPE_p_void.getCPtr(dst), cpu_id);
   return ret;
 }
 public virtual GvError ConvertFromGv(int src_type, SWIGTYPE_p_void src, int cpu_id, CustomDataType dst) {
   GvError ret = (GvError)C4dApiPINVOKE.CustomDataTypeClass_ConvertFromGv(swigCPtr, src_type, SWIGTYPE_p_void.getCPtr(src), cpu_id, CustomDataType.getCPtr(dst));
   return ret;
 }
 /// <summary>
 /// Initialize attribute.
 /// </summary>
 /// <param name="type">Type of property.</param>
 public CustomDataTypeAttribute(CustomDataType type)
 {
     Type = type;
     if (type == CustomDataType.File || type == CustomDataType.Image)
         IsFileUpload = true;
 }
Exemple #18
0
        protected virtual EditorItem GetEditorItem(CustomDataType type, string custom, PropertyInfo property)
        {
            RequiredAttribute required = property.GetCustomAttributes(typeof(RequiredAttribute), true).FirstOrDefault() as RequiredAttribute;
            EditorItem        item;

            switch (type)
            {
            case CustomDataType.Boolean:
                item = new BoolEditor(Frame);
                break;

            case CustomDataType.Currency:
                item = new CurrencyEditor(Frame);
                break;

            case CustomDataType.Date:
                item = new DateEditor(Frame);
                break;

            case CustomDataType.DateTime:
                item = new DateTimeEditor(Frame);
                break;

            case CustomDataType.Default:
                item = new DefaultEditor(Frame);
                if (required != null)
                {
                    ((DefaultEditor)item).IsAllowdEmpty = required.AllowEmptyStrings;
                }
                break;

            case CustomDataType.EmailAddress:
                item = new EmailAddressEditor(Frame);
                break;

            case CustomDataType.Html:
                item = new HtmlEditor(Frame);
                break;

            case CustomDataType.ImageUrl:
                item = new ImageUrlEditor(Frame);
                break;

            case CustomDataType.Image:
                item = new ImageEditor(Frame);
                break;

            case CustomDataType.Integer:
                item = new IntegerEditor(Frame);
                break;

            case CustomDataType.MultilineText:
                item = new MultilineTextEditor(Frame);
                if (required != null)
                {
                    ((MultilineTextEditor)item).IsAllowdEmpty = required.AllowEmptyStrings;
                }
                break;

            case CustomDataType.Number:
                item = new NumberEditor(Frame);
                break;

            case CustomDataType.Password:
                item = new PasswordEditor(Frame);
                break;

            case CustomDataType.PhoneNumber:
                item = new PhoneNumberEditor(Frame);
                break;

            case CustomDataType.Sex:
                item = new SexEditor(Frame);
                break;

            case CustomDataType.Text:
                item = new DefaultEditor(Frame);
                break;

            case CustomDataType.Time:
                item = new TimeEditor(Frame);
                break;

            case CustomDataType.Url:
                item = new UrlEditor(Frame);
                break;

            default:
                switch (custom)
                {
                case "Enum":
                    item = GetEnumEditorItem(property.PropertyType);
                    break;

                case "Entity":
                    item = new EntityEditor(Frame, property.PropertyType);
                    break;

                case "Collection":
                    item = new CollectionEditor(Frame, property.PropertyType.GetGenericArguments()[0]);
                    break;

                default:
                    throw new NotSupportedException("不支持自定义类型编辑器。");
                }
                break;
            }
            if (required != null)
            {
                item.IsRequired = true;
            }
            return(item);
        }
Exemple #19
0
 public GeData(int type, CustomDataType data) : this(C4dApiPINVOKE.new_GeData__SWIG_17(type, CustomDataType.getCPtr(data)), true)
 {
     if (C4dApiPINVOKE.SWIGPendingException.Pending)
     {
         throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 /// <summary>
 /// Initialize attribute.
 /// </summary>
 /// <param name="type">Type of property.</param>
 public CustomDataTypeAttribute(CustomDataType type)
 {
     Type = type;
 }
 public virtual bool SetDParameter(CustomDataType data, DescID id, GeData t_data, SWIGTYPE_p_DESCFLAGS_SET flags) {
   bool ret = C4dApiPINVOKE.CustomDataTypeClass_SetDParameter(swigCPtr, CustomDataType.getCPtr(data), DescID.getCPtr(id), GeData.getCPtr(t_data), SWIGTYPE_p_DESCFLAGS_SET.getCPtr(flags));
   if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public virtual void FreeData(CustomDataType data)
 {
     C4dApiPINVOKE.CustomDataTypeClass_FreeData(swigCPtr, CustomDataType.getCPtr(data));
 }
 public virtual bool GetEnabling(CustomDataType data, DescID id, GeData t_data, SWIGTYPE_p_DESCFLAGS_ENABLE flags, BaseContainer itemdesc) {
   bool ret = C4dApiPINVOKE.CustomDataTypeClass_GetEnabling(swigCPtr, CustomDataType.getCPtr(data), DescID.getCPtr(id), GeData.getCPtr(t_data), SWIGTYPE_p_DESCFLAGS_ENABLE.getCPtr(flags), BaseContainer.getCPtr(itemdesc));
   if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
        public virtual int Compare(CustomDataType d1, CustomDataType d2)
        {
            int ret = C4dApiPINVOKE.CustomDataTypeClass_Compare(swigCPtr, CustomDataType.getCPtr(d1), CustomDataType.getCPtr(d2));

            return(ret);
        }
 public virtual void FreeData(CustomDataType data) {
   C4dApiPINVOKE.CustomDataTypeClass_FreeData(swigCPtr, CustomDataType.getCPtr(data));
 }
 protected virtual EditorItem GetEditorItem(CustomDataType type, string custom, PropertyInfo property)
 {
     RequiredAttribute required = property.GetCustomAttributes(typeof(RequiredAttribute), true).FirstOrDefault() as RequiredAttribute;
     EditorItem item;
     switch (type)
     {
         case CustomDataType.Boolean:
             item = new BoolEditor(Frame);
             break;
         case CustomDataType.Currency:
             item = new CurrencyEditor(Frame);
             break;
         case CustomDataType.Date:
             item = new DateEditor(Frame);
             break;
         case CustomDataType.DateTime:
             item = new DateTimeEditor(Frame);
             break;
         case CustomDataType.Default:
             item = new DefaultEditor(Frame);
             if (required != null)
                 ((DefaultEditor)item).IsAllowdEmpty = required.AllowEmptyStrings;
             break;
         case CustomDataType.EmailAddress:
             item = new EmailAddressEditor(Frame);
             break;
         case CustomDataType.Html:
             item = new HtmlEditor(Frame);
             break;
         case CustomDataType.ImageUrl:
             item = new ImageUrlEditor(Frame);
             break;
         case CustomDataType.Image:
             item = new ImageEditor(Frame);
             break;
         case CustomDataType.Integer:
             item = new IntegerEditor(Frame);
             break;
         case CustomDataType.MultilineText:
             item = new MultilineTextEditor(Frame);
             if (required != null)
                 ((MultilineTextEditor)item).IsAllowdEmpty = required.AllowEmptyStrings;
             break;
         case CustomDataType.Number:
             item = new NumberEditor(Frame);
             break;
         case CustomDataType.Password:
             item = new PasswordEditor(Frame);
             break;
         case CustomDataType.PhoneNumber:
             item = new PhoneNumberEditor(Frame);
             break;
         case CustomDataType.Sex:
             item = new SexEditor(Frame);
             break;
         case CustomDataType.Text:
             item = new DefaultEditor(Frame);
             break;
         case CustomDataType.Time:
             item = new TimeEditor(Frame);
             break;
         case CustomDataType.Url:
             item = new UrlEditor(Frame);
             break;
         default:
             switch (custom)
             {
                 case "Enum":
                     item = GetEnumEditorItem(property.PropertyType);
                     break;
                 case "Entity":
                     item = new EntityEditor(Frame, property.PropertyType);
                     break;
                 case "Collection":
                     item = new CollectionEditor(Frame, property.PropertyType.GetGenericArguments()[0]);
                     break;
                 default:
                     throw new NotSupportedException("不支持自定义类型编辑器。");
             }
             break;
     }
     if (required != null)
         item.IsRequired = true;
     return item;
 }
 public virtual bool CopyData(CustomDataType src, CustomDataType dest, AliasTrans aliastrans) {
   bool ret = C4dApiPINVOKE.CustomDataTypeClass_CopyData(swigCPtr, CustomDataType.getCPtr(src), CustomDataType.getCPtr(dest), AliasTrans.getCPtr(aliastrans));
   return ret;
 }
 /// <summary>
 /// Remove converter for a type.
 /// </summary>
 /// <param name="type">Defined type.</param>
 public static void RemoveConverter(CustomDataType type)
 {
     if (_DefaultItems.ContainsKey(type))
         _DefaultItems.Remove(type);
 }
 public virtual int Compare(CustomDataType d1, CustomDataType d2) {
   int ret = C4dApiPINVOKE.CustomDataTypeClass_Compare(swigCPtr, CustomDataType.getCPtr(d1), CustomDataType.getCPtr(d2));
   return ret;
 }
Exemple #30
0
        /// <summary>
        /// Get the custom type from property info.
        /// </summary>
        /// <param name="propertyInfo">Property info.</param>
        /// <param name="customType">Custom type if exists.</param>
        /// <param name="isFileUpload">Is property used to upload.</param>
        /// <returns>Custom data type.</returns>
        public static CustomDataType GetCustomDataType(this PropertyInfo propertyInfo, out string customType, out bool isFileUpload)
        {
            CustomDataType type = CustomDataType.Default;

            customType   = null;
            isFileUpload = false;
            var customDataType = propertyInfo.GetCustomAttribute <CustomDataTypeAttribute>();

            if (customDataType != null)
            {
                type         = customDataType.Type;
                customType   = customDataType.Custom;
                isFileUpload = customDataType.IsFileUpload;
            }
            else
            {
                Type propertyType = propertyInfo.PropertyType;
                //ValueFilterAttribute filter = propertyInfo.GetCustomAttribute<ValueFilterAttribute>();
                //if (filter != null)
                //{
                //    type = CustomDataType.Other;
                //    customType = "ValueFilter";
                //}
                if (propertyType.GetTypeInfo().IsGenericType&& propertyType.GetGenericTypeDefinition() == typeof(Nullable <>))
                {
                    propertyType = propertyType.GetGenericArguments()[0];
                }
                else if (propertyType == typeof(DateTime))
                {
                    type = CustomDataType.Date;
                }
                else if (propertyType == typeof(TimeSpan))
                {
                    type = CustomDataType.Time;
                }
                else if (propertyType == typeof(bool))
                {
                    type = CustomDataType.Boolean;
                }
                else if (propertyType == typeof(short) || propertyType == typeof(int) || propertyType == typeof(long))
                {
                    type = CustomDataType.Integer;
                }
                else if (propertyType == typeof(float) || propertyType == typeof(double))
                {
                    type = CustomDataType.Number;
                }
                else if (propertyType == typeof(decimal))
                {
                    type = CustomDataType.Currency;
                }
                else if (propertyType == typeof(byte[]))
                {
                    type         = CustomDataType.File;
                    isFileUpload = true;
                }
                else if (propertyType.GetTypeInfo().IsEnum)
                {
                    type       = CustomDataType.Other;
                    customType = "Enum";
                }
                else if (propertyType.GetTypeInfo().IsGenericType)
                {
                    type       = CustomDataType.Other;
                    customType = "Collection";
                }
                else if (typeof(IEntity).IsAssignableFrom(propertyType))
                {
                    type       = CustomDataType.Other;
                    customType = "Entity";
                }
                else
                {
                    type = CustomDataType.Default;
                }
            }
            return(type);
        }
 public virtual bool WriteData(CustomDataType d, SWIGTYPE_p_HyperFile hf) {
   bool ret = C4dApiPINVOKE.CustomDataTypeClass_WriteData(swigCPtr, CustomDataType.getCPtr(d), SWIGTYPE_p_HyperFile.getCPtr(hf));
   return ret;
 }
Exemple #32
0
 public void SetCustomDataType(int datatype, CustomDataType v) {
   C4dApiPINVOKE.GeData_SetCustomDataType(swigCPtr, datatype, CustomDataType.getCPtr(v));
   if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
 }
 public virtual bool ReadData(CustomDataType d, SWIGTYPE_p_HyperFile hf, int level) {
   bool ret = C4dApiPINVOKE.CustomDataTypeClass_ReadData(swigCPtr, CustomDataType.getCPtr(d), SWIGTYPE_p_HyperFile.getCPtr(hf), level);
   return ret;
 }
 public virtual bool GetDescription(CustomDataType data, Description res, SWIGTYPE_p_DESCFLAGS_DESC flags, BaseContainer parentdescription, DescID singledescid) {
   bool ret = C4dApiPINVOKE.ResourceDataTypeClass_GetDescription(swigCPtr, CustomDataType.getCPtr(data), Description.getCPtr(res), SWIGTYPE_p_DESCFLAGS_DESC.getCPtr(flags), BaseContainer.getCPtr(parentdescription), DescID.getCPtr(singledescid));
   if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
        public virtual bool ReadData(CustomDataType d, HyperFile hf, int level)
        {
            bool ret = C4dApiPINVOKE.CustomDataTypeClass_ReadData(swigCPtr, CustomDataType.getCPtr(d), HyperFile.getCPtr(hf), level);

            return(ret);
        }
 /// <summary>
 /// Initialize attribute.
 /// </summary>
 /// <param name="type">Type of property.</param>
 public CustomDataTypeAttribute(CustomDataType type)
 {
     Type = type;
 }
        public virtual GvError ConvertFromGv(int src_type, SWIGTYPE_p_void src, int cpu_id, CustomDataType dst)
        {
            GvError ret = (GvError)C4dApiPINVOKE.CustomDataTypeClass_ConvertFromGv(swigCPtr, src_type, SWIGTYPE_p_void.getCPtr(src), cpu_id, CustomDataType.getCPtr(dst));

            return(ret);
        }
        public static IQueryable<CustomData> ConditionBuilder(
            SocialGamificationAssetContext db,
            IList<CustomDataBase> sourceData,
            CustomDataType objectType)
        {
            var query = db.CustomData.Where(c => c.ObjectType == objectType);

            if (sourceData == null || sourceData.Count <= 0)
            {
                return null;
            }

            foreach (var data in sourceData)
            {
                query = query.Where(c => c.Key.Equals(data.Key));

                if (!AllowedOperators.Contains(data.Operator))
                {
                    continue;
                }

                switch (data.Operator)
                {
                    case "=":
                        query = query.Where(c => c.Value.Equals(data.Value));
                        break;
                    case "!":
                        query = query.Where(c => c.Value != data.Value);
                        break;
                    case "%":
                        query = query.Where(c => c.Value.Contains(data.Value));
                        break;
                }
            }

            return query;
        }
        public virtual GvError ConvertToGv(int dst_type, CustomDataType src, SWIGTYPE_p_void dst, int cpu_id)
        {
            GvError ret = (GvError)C4dApiPINVOKE.CustomDataTypeClass_ConvertToGv(swigCPtr, dst_type, CustomDataType.getCPtr(src), SWIGTYPE_p_void.getCPtr(dst), cpu_id);

            return(ret);
        }
        public virtual GvError ConvertToGeData(int dst_type, CustomDataType src, GeData dst)
        {
            GvError ret = (GvError)C4dApiPINVOKE.CustomDataTypeClass_ConvertToGeData(swigCPtr, dst_type, CustomDataType.getCPtr(src), GeData.getCPtr(dst));

            if (C4dApiPINVOKE.SWIGPendingException.Pending)
            {
                throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CustomDataType obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }