Пример #1
0
        /// <summary>
        /// Получение типа.
        /// </summary>
        public static void PutMxValue(ref MxValue valueObj, MxDataType type, string value)
        {
            switch (type)
            {
            case MxDataType.MxBoolean:  valueObj.PutBoolean(bool.Parse(value)); break;

            case MxDataType.MxInteger:  valueObj.PutInteger(int.Parse(value)); break;

            case MxDataType.MxFloat:    valueObj.PutFloat(float.Parse(value)); break;

            case MxDataType.MxDouble:   valueObj.PutDouble(double.Parse(value)); break;

            case MxDataType.MxString:   valueObj.PutString(value); break;

            //case MxDataType.MxTime:     valueObj.PutTime(DateTime.Parse(value)); break;
            default:                    valueObj.PutString(value); break;
            }
        }
Пример #2
0
        // Создаем значение типа MX
        public static MxValue CreateMxValue(MxDataType type, object value)
        {
            MxValue val = new MxValue();

            switch (type)
            {
            case MxDataType.MxDataTypeUnknown:
                break;

            case MxDataType.MxNoData:
                break;

            case MxDataType.MxBoolean:
                val.PutBoolean(bool.Parse(value?.ToString() ?? "false"));
                break;

            case MxDataType.MxInteger:
                val.PutInteger(int.Parse(value?.ToString() ?? "0"));
                break;

            case MxDataType.MxFloat:
                val.PutFloat(float.Parse(value?.ToString() ?? "0"));
                break;

            case MxDataType.MxDouble:
                val.PutDouble(double.Parse(value?.ToString() ?? "0"));
                break;

            case MxDataType.MxString:
                val.PutInternationalString(1049, value?.ToString() ?? "");
                break;

            case MxDataType.MxTime:
                break;

            case MxDataType.MxElapsedTime:
                break;

            case MxDataType.MxReferenceType:
                break;

            case MxDataType.MxStatusType:
                MxStatus stat = new MxStatus();
                stat.success = 1;
                val.PutMxStatus(stat);
                break;

            case MxDataType.MxDataTypeEnum:
                break;

            case MxDataType.MxSecurityClassificationEnum:
                break;

            case MxDataType.MxDataQualityType:
                break;

            case MxDataType.MxQualifiedEnum:
                break;

            case MxDataType.MxQualifiedStruct:
                break;

            case MxDataType.MxInternationalizedString:
                val.PutInternationalString(1049, value?.ToString() ?? "");
                break;

            case MxDataType.MxBigString:
                val.PutInternationalString(1049, value?.ToString() ?? "");
                break;

            case MxDataType.MxDataTypeEND:
                break;

            default:
                break;
            }
            return(val);
        }