/// <summary>
		/// Get the boolean or integer model property as a boolean.
		/// </summary>
		/// <returns>
		/// The regular boolean value for boolean properties.
		/// For int model properties: 'false' for a '0' int value,
		/// or 'true' for all other int values.
		/// </returns>
		public static bool GetBoolean(ISilDataAccess sda, int hvo, int tag)
		{
			if (sda == null) throw new ArgumentNullException("sda");

			return (CellarPropertyType)sda.MetaDataCache.GetFieldType(tag) == CellarPropertyType.Boolean
					? sda.get_BooleanProp(hvo, tag)
					: sda.get_IntProp(hvo, tag) != 0;
		}
示例#2
0
        /// <summary>
        /// Get the boolean or integer model property as a boolean.
        /// </summary>
        /// <returns>
        /// The regular boolean value for boolean properties.
        /// For int model properties: 'false' for a '0' int value,
        /// or 'true' for all other int values.
        /// </returns>
        public static bool GetBoolean(ISilDataAccess sda, int hvo, int tag)
        {
            if (sda == null)
            {
                throw new ArgumentNullException("sda");
            }

            return((CellarPropertyType)sda.MetaDataCache.GetFieldType(tag) == CellarPropertyType.Boolean
                                        ? sda.get_BooleanProp(hvo, tag)
                                        : sda.get_IntProp(hvo, tag) != 0);
        }
示例#3
0
		internal override int GetValueOfField(ISilDataAccess sda, int hvoField)
		{
			return sda.get_BooleanProp(hvoField, m_flidSub) ? 1 : 0;
		}
示例#4
0
		protected virtual int GetBasicPropertyValue(ISilDataAccess sda, int hvoOwner)
		{
			int type = m_sda.MetaDataCache.GetFieldType(m_flid);
			if (type == (int)CellarPropertyType.Boolean)
				return sda.get_BooleanProp(hvoOwner, m_flid) ? 1 : 0;
			else
				return sda.get_IntProp(hvoOwner, m_flid);
		}
 /// <summary>
 ///
 /// </summary>
 /// <param name="hvo"></param>
 /// <param name="tag"></param>
 /// <returns></returns>
 public bool get_BooleanProp(int hvo, int tag)
 {
     return(m_sda.get_BooleanProp(hvo, tag));
 }
示例#6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Handles the flids for basic data (bool, string, int, etc.)
        /// </summary>
        /// <param name="thisFlid">The object type flid.</param>
        /// <param name="flidType">The owning flid type.</param>
        /// <param name="hvoSrc">The hvo of the source object.</param>
        /// <param name="hvoNew">The hvo of the new object.</param>
        /// ------------------------------------------------------------------------------------
        private void HandleBasicOrStringFlid(int thisFlid, int flidType, int hvoSrc, int hvoNew)
        {
            // Basic and String properties are copied
            switch (flidType)
            {
            // Basic Properties follow

            case (int)CellarPropertyType.Binary:
                string flidName = m_mdc.GetFieldName(thisFlid);
                if (flidName == "Rules" || flidName == "StyleRules")
                {
                    CopyBinaryAsTextProps(thisFlid, hvoSrc, hvoNew);
                }
                else
                {
                    CopyBinaryAsBinary(thisFlid, hvoSrc, hvoNew);
                }
                break;

            case (int)CellarPropertyType.Boolean:
                // Copy boolean value
                m_sda.SetBoolean(hvoNew, thisFlid, m_sda.get_BooleanProp(hvoSrc, thisFlid));
                break;

            case (int)CellarPropertyType.Guid:
                // Copy guid value
                // These are currently used as the ID for an application, or a version number, or a Scripture Check ID)
                m_sda.SetGuid(hvoNew, thisFlid, m_sda.get_GuidProp(hvoSrc, thisFlid));
                break;

            case (int)CellarPropertyType.GenDate:                     // Fall through, since a GenDate is an int.
            case (int)CellarPropertyType.Integer:
                // Copy integer value
                m_sda.SetInt(hvoNew, thisFlid, m_sda.get_IntProp(hvoSrc, thisFlid));
                break;

            case (int)CellarPropertyType.Time:
                // Copy time value
                m_sda.SetTime(hvoNew, thisFlid, m_sda.get_TimeProp(hvoSrc, thisFlid));
                break;

            // String Properties follow

            case (int)CellarPropertyType.String:
                // Copy string value
                // Review: Please check these next three!
                m_sda.SetString(hvoNew, thisFlid, m_sda.get_StringProp(hvoSrc, thisFlid));
                break;

            case (int)CellarPropertyType.Unicode:
                // Copy Unicode string
                m_sda.set_UnicodeProp(hvoNew, thisFlid, m_sda.get_UnicodeProp(hvoSrc, thisFlid));
                break;

            case (int)CellarPropertyType.MultiString:                     // Fall through
            case (int)CellarPropertyType.MultiUnicode:
                ITsMultiString sMulti = m_sda.get_MultiStringProp(hvoSrc, thisFlid);
                for (int i = 0; i < sMulti.StringCount; i++)
                {
                    int       ws;
                    ITsString tss = sMulti.GetStringFromIndex(i, out ws);
                    m_sda.SetMultiStringAlt(hvoNew, thisFlid, ws, tss);
                }
                break;

            default:
                throw new FDOInvalidFieldTypeException(String.Format("CopyObject: Unsupported field type {0}.", flidType));
            }
        }
示例#7
0
		protected override int GetBasicPropertyValue(ISilDataAccess sda, int hvoOwner)
		{
			return Convert.ToInt32(sda.get_BooleanProp(hvoOwner, m_flid));
		}
示例#8
0
 /// <summary>
 /// Get the value of a boolean property.
 /// false if no value known for this property.
 ///</summary>
 /// <param name='hvo'> </param>
 /// <param name='tag'> </param>
 /// <returns></returns>
 public virtual bool get_BooleanProp(int hvo, int tag)
 {
     return(m_baseSda.get_BooleanProp(hvo, tag));
 }