示例#1
0
        /// <summary>
        /// This constructor contains all fields of Measure <see cref="Measure"/>.
        /// </summary>
        /// <param name="id">Id of measure.</param>
        /// <param name="name">Name of measure.</param>
        /// <param name="status">Status of register.</param>
        /// <param name="creationDate">Date of create.</param>
        /// <param name="updateDate">Date of Update.</param>
        /// <param name="measureId">Measure Id.</param>
        /// <param name="stock">Quantity in stock.</param>
        /// <param name="colorId">Id of color.</param>
        /// <param name="tenantId">Cliente Id.</param>
        /// <returns>Returns new instance of Measure <see cref="Feedstock"/></returns>
        public static Feedstock New(
            FeedstockId feedstockId,
            string name,
            Status status,
            DateTime creationDate,
            DateTime?updateDate,
            MeasureId measureId,
            int stock,
            ColorId colorId,
            TenantId tenantId)
        {
            //Ensure.That(feedstockId, ResourcesReader.Field(nameof(feedstockId))).ArgumentIsNotNull();
            //Ensure.That(colorId, ResourcesReader.Field(nameof(colorId))).ArgumentIsNotNull();
            //Ensure.That(tenantId, ResourcesReader.Field(nameof(tenantId))).ArgumentIsNotNull();
            //Ensure.That(measureId, ResourcesReader.Field(nameof(measureId))).ArgumentIsNotNull();

            var feedstock = new Feedstock
            {
                FeedstockId  = feedstockId,
                Name         = name,
                Status       = status,
                CreationDate = creationDate,
                UpdateDate   = updateDate,
                MeasureId    = measureId,
                Stock        = stock,
                ColorId      = colorId,
                TenantId     = tenantId
            };

            feedstock.Isvalid();

            return(feedstock);
        }
示例#2
0
        /// <summary>
        /// This constructor contains some fields of Measure <see cref="Feedstock"/>.
        /// </summary>
        /// <param name="name">Name of measure.</param>
        /// <param name="status">Status of register.</param>
        /// <param name="measureId">Measure Id.</param>
        /// <param name="stock">Quantity in stock.</param>
        /// <param name="colorId">Id of color.</param>
        /// <param name="tenantId">Cliente Id.</param>
        /// <returns>Returns new instance of Measure <see cref="Feedstock"/></returns>
        public static Feedstock New(
            string name,
            Status status,
            MeasureId measureId,
            int stock,
            ColorId colorId,
            TenantId tenantId)
        {
            var feedstock = new Feedstock
            {
                Name         = name,
                Status       = status,
                CreationDate = DateTime.Now,
                UpdateDate   = null,
                MeasureId    = measureId,
                Stock        = stock,
                ColorId      = colorId,
                TenantId     = tenantId,
                FeedstockId  = FeedstockId.New()
            };

            feedstock.Isvalid();

            return(feedstock);
        }