ПеречислениеСсылка (EnumRef)
Inheritance: BaseSessionObject, IObjectRef
        internal bool TryParseValueFromV8Xml(Session session, string strValue, out object value)
        {
            value = null;

            switch (Type)
            {
                case TypeEnum.Boolean:
                    {
                        bool bv;
                        if (bool.TryParse(strValue, out bv))
                        {
                            value = bv;
                            return true;
                        }
                    }
                    break;
                case TypeEnum.Date:
                    {
                        DateTime dt;
                        if (DateTime.TryParse(strValue, out dt))
                        {
                            value = dt;
                            return true;
                        }
                    }
                    break;
                case TypeEnum.String:
                    value = strValue;
                    return true;

                case TypeEnum.Decimal:
                    {
                        decimal dc;
                        if (decimal.TryParse(strValue, NumberStyles.Number, CultureInfo.InvariantCulture, out dc))
                        {
                            value = dc;
                            return true;
                        }
                    }
                    break;

                case TypeEnum.CatalogRef:
                    {
                        if (string.IsNullOrEmpty(strValue))
                        {
                            value = null;
                            return true;
                        }

                        value = new CatalogRef(session, ReferenceTypeName, strValue);
                    }
                    return true;
                case TypeEnum.DocumentRef:
                    {
                        if (string.IsNullOrEmpty(strValue))
                        {
                            value = null;
                            return true;
                        }

                        value = new DocumentRef(session, ReferenceTypeName, strValue);
                    }
                    return true;
                case TypeEnum.EnumRef:
                    {
                        if (string.IsNullOrEmpty(strValue))
                        {
                            value = null;
                            return true;
                        }

                        value = new EnumRef(session, ReferenceTypeName, strValue);
                    }
                    return true;
            }
            
            return false;
        }
 /// <summary>
 /// Индекс (IndexOf)
 /// </summary>
 /// <param name="enumRef"></param>
 /// <returns></returns>
 public int IndexOf(EnumRef enumRef)
 {
     return (int)Session.InvokeV8Method("IndexOf", enumRef.Ptr);
 }
Exemple #3
0
        internal bool TryParseValueFromV8Xml(Session session, string strValue, out object value)
        {
            value = null;

            switch (Type)
            {
            case TypeEnum.Boolean:
            {
                bool bv;
                if (bool.TryParse(strValue, out bv))
                {
                    value = bv;
                    return(true);
                }
            }
            break;

            case TypeEnum.Date:
            {
                DateTime dt;
                if (DateTime.TryParse(strValue, out dt))
                {
                    value = dt;
                    return(true);
                }
            }
            break;

            case TypeEnum.String:
                value = strValue;
                return(true);

            case TypeEnum.Decimal:
            {
                decimal dc;
                if (decimal.TryParse(strValue, NumberStyles.Number, CultureInfo.InvariantCulture, out dc))
                {
                    value = dc;
                    return(true);
                }
            }
            break;

            case TypeEnum.CatalogRef:
            {
                if (string.IsNullOrEmpty(strValue))
                {
                    value = null;
                    return(true);
                }

                value = new CatalogRef(session, ReferenceTypeName, strValue);
            }
                return(true);

            case TypeEnum.DocumentRef:
            {
                if (string.IsNullOrEmpty(strValue))
                {
                    value = null;
                    return(true);
                }

                value = new DocumentRef(session, ReferenceTypeName, strValue);
            }
                return(true);

            case TypeEnum.EnumRef:
            {
                if (string.IsNullOrEmpty(strValue))
                {
                    value = null;
                    return(true);
                }

                value = new EnumRef(session, ReferenceTypeName, strValue);
            }
                return(true);
            }

            return(false);
        }
Exemple #4
0
 /// <summary>
 /// Индекс (IndexOf)
 /// </summary>
 /// <param name="enumRef"></param>
 /// <returns></returns>
 public int IndexOf(EnumRef enumRef)
 {
     return((int)Session.InvokeV8Method("IndexOf", enumRef.Ptr));
 }