Esempio n. 1
0
        public void TimeProp()
        {
            CheckDisposed();
            long valNew = m_ISilDataAccess.get_TimeProp(1116, 2226);

            Assert.AreEqual(0, valNew);
            Assert.IsFalse(m_ISilDataAccess.IsDirty());

            m_ISilDataAccess.SetTime(1116, 2226, DateTime.MaxValue.Ticks);
            valNew = m_ISilDataAccess.get_TimeProp(1116, 2226);
            Assert.AreEqual(DateTime.MaxValue.Ticks, valNew);
            Assert.IsTrue(m_ISilDataAccess.IsDirty());

            m_ISilDataAccess.SetTime(1116, 2226, DateTime.MinValue.Ticks);
            valNew = m_ISilDataAccess.get_TimeProp(1116, 2226);
            Assert.AreEqual(DateTime.MinValue.Ticks, valNew);
            Assert.IsTrue(m_ISilDataAccess.IsDirty());

            CheckProp(1116, 2226, DateTime.MinValue.Ticks, CellarModuleDefns.kcptTime);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="hvo"></param>
 /// <param name="tag"></param>
 /// <param name="lln"></param>
 public void SetTime(int hvo, int tag, long lln)
 {
     VerifyUpdate(hvo, tag);
     m_sda.SetTime(hvo, tag, lln);
 }
Esempio n. 3
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));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Set a Time property to a given DateTime value.
        /// </summary>
        public static void SetTimeProperty(ISilDataAccess sda, int hvo, int flid, DateTime dt)
        {
            long silTime = ConvertToSilTime(dt);

            sda.SetTime(hvo, flid, silTime);
        }
Esempio n. 5
0
		/// <summary>
		/// Set a Time property to a given DateTime value.
		/// </summary>
		public static void SetTimeProperty(ISilDataAccess sda, int hvo, int flid, DateTime dt)
		{
			long silTime = ConvertToSilTime(dt);
			sda.SetTime(hvo, flid, silTime);
		}
Esempio n. 6
0
 /// <summary>
 /// Change a time 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='lln'> </param>
 public virtual void SetTime(int hvo, int tag, long lln)
 {
     m_baseSda.SetTime(hvo, tag, lln);
 }