Exemplo n.º 1
0
        /// <summary>
        /// Populates the view ViewModel.
        /// </summary>
        /// <returns>
        /// </returns>
        public override void HandleViewDataLoadEvent()
        {
            BaseCL.RoutineEntry("DateDetailViewModel");

            HLinkDateModelSpan HLinkObject = CommonRoutines.GetHLinkParameter <HLinkDateModelSpan>(BaseParamsHLink);

            BaseTitle = HLinkObject.Title;

            DateObject = HLinkObject.DeRef;

            if (DateObject.Valid)
            {
                BaseModelBase = DateObject;

                /*
                 * General Details
                 */

                // Get the Base Date Details
                BaseDetail.Add(DateObject.AsCardListLineBaseDate());
                BaseDetail.Add(DateObject.AsCardListLineBaseDateDetail());
                BaseDetail.Add(DateObject.AsCardListLineBaseDateInternal());

                BaseDetail.Add((DateObject as IDateObjectModelSpan).AsCardListLine());
            }

            return;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the date.
        /// </summary>
        /// <param name="currentElement">
        /// The current element.
        /// </param>
        /// <returns>
        /// Date object ViewModel.
        /// </returns>
        public DateObjectModel SetDate(XElement currentElement)
        {
            XElement tempElement;

            // check for date range
            try
            {
                tempElement = currentElement.Element(ns + "daterange");
                if (tempElement != null)
                {
                    return(SetDateRange(tempElement));
                }

                // check for date span
                tempElement = currentElement.Element(ns + "datespan");
                if (tempElement != null)
                {
                    return(SetDateSpan(tempElement));
                }

                // check for date val
                tempElement = currentElement.Element(ns + "dateval");
                if (tempElement != null)
                {
                    return(SetDateVal(tempElement));
                }

                // check for datestr
                tempElement = currentElement.Element(ns + "datestr");
                if (tempElement != null)
                {
                    DateObjectModel t = SetDateStr(tempElement);

                    return(t);
                }
            }
            catch (Exception e)
            {
                // TODO
                DataStore.CN.NotifyException("Error in SetDate", e);

                throw;
            }

            // TODO fix this if (tempDate is typeof( DateObjectModel) ) { // no date found tempDate =
            // null; }
            return(new DateObjectModel());
        }
        /// <summary>
        /// Sets the date overall.
        /// </summary>
        /// <param name="argXElement">
        /// The argument x element.
        /// </param>
        /// <param name="argDateObject">
        /// The argument date object.
        /// </param>
        //[Theory]
        //[InlineData("NotADate", null)]
        public void TestDateOverall(string argXElement, DateObjectModel argDateObject)
        {
            //DateObjectModel t = test.SetDate(new XElement(argXElement));

            //Assert.True(t == argDateObject);
        }