Inheritance: ParameterValue
Example #1
0
        /// <summary>
        /// An amendment is like a variable value that is added to a data tuple. The difference is that the amendment does not need to be defined in the dataset's structure 
        /// and also not all the data tuples need to have the same amendments.
        /// This method creates and amendment object, attaches it to the data tuple but does <b>NOT</b> persist it.
        /// </summary>
        /// <param name="value"><see cref="DataValue"/></param>
        /// <param name="note"><see cref="DataValue"/></param>
        /// <param name="samplingTime"><see cref="DataValue"/></param>
        /// <param name="resultTime"><see cref="DataValue"/></param>
        /// <param name="obtainingMethod"><see cref="DataValue"/></param>
        /// <param name="parameterId">The identifier of the parameter that the amendment will be linked to. needs more clarification</param>
        /// <param name="tuple">The data tuple receiving the amendment.ku</param>
        /// <returns></returns>
        public Amendment CreateAmendment(string value, string note, DateTime samplingTime, DateTime resultTime, ObtainingMethod obtainingMethod, Int64 parameterId, DataTuple tuple)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(value));
            Contract.Requires(parameterId > 0);
            Contract.Requires(tuple != null);
            Contract.Ensures(Contract.Result<Amendment>() != null);

            Amendment e = new Amendment()
            {
                Value = value,
                Note = note,
                SamplingTime = samplingTime,
                ResultTime = resultTime,
                ObtainingMethod = obtainingMethod,
                ParameterId = parameterId,
                Tuple = tuple,
            };

            //using (IUnitOfWork uow = this.GetUnitOfWork())
            //{
            //    IRepository<Amendment> repo = uow.GetRepository<Amendment>();
            //    repo.Put(e);
            //    uow.Commit();
            //}
            return (e);
        }