/// <summary> /// Set the given boolean to either a boolean or integer model property. /// </summary> public static void SetValueFromBoolean(ISilDataAccess sda, int hvo, int tag, bool newValue) { if (sda == null) throw new ArgumentNullException("sda"); if ((CellarPropertyType)sda.MetaDataCache.GetFieldType(tag) == CellarPropertyType.Boolean) sda.SetBoolean(hvo, tag, newValue); else sda.SetInt(hvo, tag, newValue ? 1 : 0); }
/// <summary> /// Set the given boolean to either a boolean or integer model property. /// </summary> public static void SetValueFromBoolean(ISilDataAccess sda, int hvo, int tag, bool newValue) { if (sda == null) { throw new ArgumentNullException("sda"); } if ((CellarPropertyType)sda.MetaDataCache.GetFieldType(tag) == CellarPropertyType.Boolean) { sda.SetBoolean(hvo, tag, newValue); } else { sda.SetInt(hvo, tag, newValue ? 1 : 0); } }
internal override void SetValueOfField(ISilDataAccess sda, int hvoField, int val) { sda.SetBoolean(hvoField, m_flidSub, val == 1); }
protected virtual void SetBasicPropertyValue(ISilDataAccess sda, int newVal, int hvoOwner) { int type = m_sda.MetaDataCache.GetFieldType(m_flid); if (type == (int)CellarPropertyType.Boolean) sda.SetBoolean(hvoOwner, m_flid, newVal != 0); else sda.SetInt(hvoOwner, m_flid, newVal); }
/// <summary> /// /// </summary> /// <param name="hvo"></param> /// <param name="tag"></param> /// <param name="n"></param> public void SetBoolean(int hvo, int tag, bool n) { VerifyUpdate(hvo, tag); m_sda.SetBoolean(hvo, tag, n); }
/// ------------------------------------------------------------------------------------ /// <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)); } }
protected override void SetBasicPropertyValue(ISilDataAccess sda, int newVal, int hvoOwner) { Debug.Assert(newVal == 0 || newVal == 1, String.Format("Expected value {0} to be boolean.", newVal.ToString())); sda.SetBoolean(hvoOwner, m_flid, Convert.ToBoolean(newVal)); }
/// <summary> /// Change a boolean property of an object. /// The caller should also call PropChanged to notify interested parties, /// except where the change is being made to a newly created object. ///</summary> /// <param name='hvo'> </param> /// <param name='tag'> </param> /// <param name='n'> </param> public virtual void SetBoolean(int hvo, int tag, bool n) { m_baseSda.SetBoolean(hvo, tag, n); }