Inheritance: System.Web.UI.Page
Example #1
0
        public bool UpdateProductListPriceHistory(ProductListPriceHistory productListPriceHistory)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(6);
                dbm.AddParameters(0, "@ID", productListPriceHistory.ID);
                dbm.AddParameters(1, "@ProductID", productListPriceHistory.ProductID);
                dbm.AddParameters(2, "@StartDate", productListPriceHistory.StartDate);
                dbm.AddParameters(3, "@EndDate", productListPriceHistory.EndDate);
                dbm.AddParameters(4, "@ListPrice", productListPriceHistory.ListPrice);
                dbm.AddParameters(5, "@ModifiedDate", DateTime.Now);

                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "UpdateProductListPriceHistory");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "UpdateProductListPriceHistory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
Example #2
0
        public ProductListPriceHistory GetProductListPriceHistory(int id)
        {
            IDBManager dbm = new DBManager();
            ProductListPriceHistory productListPriceHistory = new ProductListPriceHistory();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@ID", id);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductListPriceHistory");
                while (reader.Read())
                {
                    productListPriceHistory.ID           = Int32.Parse(reader["ID"].ToString());
                    productListPriceHistory.ProductID    = Int32.Parse(reader["ProductID"].ToString());
                    productListPriceHistory.StartDate    = DateTime.Parse(reader["StartDate"].ToString());
                    productListPriceHistory.EndDate      = DateTime.Parse(reader["EndDate"].ToString());
                    productListPriceHistory.ListPrice    = Decimal.Parse(reader["ListPrice"].ToString());
                    productListPriceHistory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetProductListPriceHistory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(productListPriceHistory);
        }
Example #3
0
        public int AddProductListPriceHistory(ProductListPriceHistory productListPriceHistory)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(6);
                dbm.AddParameters(0, "@ID", productListPriceHistory.ID);
                dbm.AddParameters(1, "@ProductID", productListPriceHistory.ProductID);
                dbm.AddParameters(2, "@StartDate", productListPriceHistory.StartDate);
                dbm.AddParameters(3, "@EndDate", productListPriceHistory.EndDate);
                dbm.AddParameters(4, "@ListPrice", productListPriceHistory.ListPrice);
                dbm.AddParameters(5, "@ModifiedDate", DateTime.Now);
                dbm.Parameters[0].Direction = ParameterDirection.Output;
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "InsertProductListPriceHistory");
                productListPriceHistory.ID = Int32.Parse(dbm.Parameters[0].Value.ToString());
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "AddProductListPriceHistory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(productListPriceHistory.ID);
        }
Example #4
0
        public ProductListPriceHistoryCollection GetAllProductListPriceHistorysDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            ProductListPriceHistoryCollection cols = new ProductListPriceHistoryCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductListPriceHistoriesDynamic");
                while (reader.Read())
                {
                    ProductListPriceHistory productListPriceHistory = new ProductListPriceHistory();
                    productListPriceHistory.ID           = Int32.Parse(reader["ID"].ToString());
                    productListPriceHistory.ProductID    = Int32.Parse(reader["ProductID"].ToString());
                    productListPriceHistory.StartDate    = DateTime.Parse(reader["StartDate"].ToString());
                    productListPriceHistory.EndDate      = DateTime.Parse(reader["EndDate"].ToString());
                    productListPriceHistory.ListPrice    = Decimal.Parse(reader["ListPrice"].ToString());
                    productListPriceHistory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(productListPriceHistory);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductListPriceHistorysDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                ProductListPriceHistory mock = CreateMockInstance(tm);
                bool result = DataRepository.ProductListPriceHistoryProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                ProductListPriceHistoryQuery query = new ProductListPriceHistoryQuery();

                query.AppendEquals(ProductListPriceHistoryColumn.ProductId, mock.ProductId.ToString());
                query.AppendEquals(ProductListPriceHistoryColumn.StartDate, mock.StartDate.ToString());
                if (mock.EndDate != null)
                {
                    query.AppendEquals(ProductListPriceHistoryColumn.EndDate, mock.EndDate.ToString());
                }
                query.AppendEquals(ProductListPriceHistoryColumn.ListPrice, mock.ListPrice.ToString());
                query.AppendEquals(ProductListPriceHistoryColumn.ModifiedDate, mock.ModifiedDate.ToString());

                TList <ProductListPriceHistory> results = DataRepository.ProductListPriceHistoryProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }
        /// <summary>
        /// Deep load all ProductListPriceHistory children.
        /// </summary>
        private void Step_03_DeepLoad_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                int count = -1;
                mock           = CreateMockInstance(tm);
                mockCollection = DataRepository.ProductListPriceHistoryProvider.GetPaged(tm, 0, 10, out count);

                DataRepository.ProductListPriceHistoryProvider.DeepLoading += new EntityProviderBaseCore <ProductListPriceHistory, ProductListPriceHistoryKey> .DeepLoadingEventHandler(
                    delegate(object sender, DeepSessionEventArgs e)
                {
                    if (e.DeepSession.Count > 3)
                    {
                        e.Cancel = true;
                    }
                }
                    );

                if (mockCollection.Count > 0)
                {
                    DataRepository.ProductListPriceHistoryProvider.DeepLoad(tm, mockCollection[0]);
                    System.Console.WriteLine("ProductListPriceHistory instance correctly deep loaded at 1 level.");

                    mockCollection.Add(mock);
                    // DataRepository.ProductListPriceHistoryProvider.DeepSave(tm, mockCollection);
                }

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
Example #7
0
        public ProductListPriceHistoryCollection GetAllProductListPriceHistoryCollection()
        {
            IDBManager dbm = new DBManager();
            ProductListPriceHistoryCollection cols = new ProductListPriceHistoryCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductListPriceHistoriesAll");
                while (reader.Read())
                {
                    ProductListPriceHistory productListPriceHistory = new ProductListPriceHistory();
                    productListPriceHistory.ID           = Int32.Parse(reader["ID"].ToString());
                    productListPriceHistory.ProductID    = Int32.Parse(reader["ProductID"].ToString());
                    productListPriceHistory.StartDate    = DateTime.Parse(reader["StartDate"].ToString());
                    productListPriceHistory.EndDate      = DateTime.Parse(reader["EndDate"].ToString());
                    productListPriceHistory.ListPrice    = Decimal.Parse(reader["ListPrice"].ToString());
                    productListPriceHistory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(productListPriceHistory);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductListPriceHistoryCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Example #8
0
        ///<summary>
        ///  Update the Typed ProductListPriceHistory Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, ProductListPriceHistory mock)
        {
            ProductListPriceHistoryTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
 public ActionResult Edit([Bind(Include = "ProductID,StartDate,EndDate,ListPrice,ModifiedDate,isDeleted")] ProductListPriceHistory productListPriceHistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productListPriceHistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductID = new SelectList(db.Products, "ProductID", "Name", productListPriceHistory.ProductID);
     return(View(productListPriceHistory));
 }
        /// <summary>
        /// Test methods exposed by the EntityHelper class.
        /// </summary>
        private void Step_20_TestEntityHelper_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);

                ProductListPriceHistory entity = mock.Copy() as ProductListPriceHistory;
                entity = (ProductListPriceHistory)mock.Clone();
                Assert.IsTrue(ProductListPriceHistory.ValueEquals(entity, mock), "Clone is not working");
            }
        }
        // PUT api/awbuildversion/5
        public void Put(ProductListPriceHistory value)
        {
            var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault();

            if (GetActionType.Key != null)
            {
                if (GetActionType.Value.ToList()[0].Equals("DELETE"))
                    adventureWorks_BC.ProductListPriceHistoryDelete(value);
                if (GetActionType.Value.ToList()[0].Equals("UPDATE"))
                    adventureWorks_BC.ProductListPriceHistoryUpdate(value);
            }
        }
Example #12
0
        ///<summary>
        ///  Returns a Typed ProductListPriceHistory Entity with mock values.
        ///</summary>
        static public ProductListPriceHistory CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            ProductListPriceHistory mock = ProductListPriceHistoryTest.CreateMockInstance_Generated(tm);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);

            // return the modified object
            return(mock);
        }
        /// <summary>
        /// Check the foreign key dal methods.
        /// </summary>
        private void Step_10_FK_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                ProductListPriceHistory entity = CreateMockInstance(tm);
                bool result = DataRepository.ProductListPriceHistoryProvider.Insert(tm, entity);

                Assert.IsTrue(result, "Could Not Test FK, Insert Failed");

                TList <ProductListPriceHistory> t0 = DataRepository.ProductListPriceHistoryProvider.GetByProductId(tm, entity.ProductId, 0, 10);
            }
        }
        ///<summary>
        ///  Update the Typed ProductListPriceHistory Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, ProductListPriceHistory mock)
        {
            mock.EndDate      = TestUtility.Instance.RandomDateTime();
            mock.ListPrice    = TestUtility.Instance.RandomShort();
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Product mockProductByProductId = ProductTest.CreateMockInstance(tm);

            DataRepository.ProductProvider.Insert(tm, mockProductByProductId);
            mock.ProductId = mockProductByProductId.ProductId;
        }
        public virtual ProductListPriceHistory MapBOToEF(
            BOProductListPriceHistory bo)
        {
            ProductListPriceHistory efProductListPriceHistory = new ProductListPriceHistory();

            efProductListPriceHistory.SetProperties(
                bo.EndDate,
                bo.ListPrice,
                bo.ModifiedDate,
                bo.ProductID,
                bo.StartDate);
            return(efProductListPriceHistory);
        }
        public virtual BOProductListPriceHistory MapEFToBO(
            ProductListPriceHistory ef)
        {
            var bo = new BOProductListPriceHistory();

            bo.SetProperties(
                ef.ProductID,
                ef.EndDate,
                ef.ListPrice,
                ef.ModifiedDate,
                ef.StartDate);
            return(bo);
        }
        /// <summary>
        /// Check the indexes dal methods.
        /// </summary>
        private void Step_11_IX_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                ProductListPriceHistory entity = CreateMockInstance(tm);
                bool result = DataRepository.ProductListPriceHistoryProvider.Insert(tm, entity);

                Assert.IsTrue(result, "Could Not Test IX, Insert Failed");


                ProductListPriceHistory t0 = DataRepository.ProductListPriceHistoryProvider.GetByProductIdStartDate(tm, entity.ProductId, entity.StartDate);
            }
        }
        /// <summary>
        /// Serialize the mock ProductListPriceHistory entity into a temporary file.
        /// </summary>
        private void Step_06_SerializeEntity_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_ProductListPriceHistory.xml");

                EntityHelper.SerializeXml(mock, fileName);
                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found");

                System.Console.WriteLine("mock correctly serialized to a temporary file.");
            }
        }
        public void MapEFToBOList()
        {
            var mapper = new DALProductListPriceHistoryMapper();
            ProductListPriceHistory entity = new ProductListPriceHistory();

            entity.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, DateTime.Parse("1/1/1987 12:00:00 AM"));

            List <BOProductListPriceHistory> response = mapper.MapEFToBO(new List <ProductListPriceHistory>()
            {
                entity
            });

            response.Count.Should().Be(1);
        }
        // GET: ProductListPriceHistories/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductListPriceHistory productListPriceHistory = db.ProductListPriceHistories.Find(id);

            if (productListPriceHistory == null)
            {
                return(HttpNotFound());
            }
            return(View(productListPriceHistory));
        }
 public bool ProductListPriceHistoryDelete(ProductListPriceHistory productlistpricehistory)
 {
     return(Execute <bool>(dal =>
     {
         ProductListPriceHistory productlistpricehistoryDelete = dal.ProductListPriceHistory.Where(x => x.ProductID == productlistpricehistory.ProductID).FirstOrDefault();
         if (productlistpricehistoryDelete != null)
         {
             dal.ProductListPriceHistory.DeleteOnSubmit(productlistpricehistoryDelete);
             dal.SubmitChanges();
             return true;
         }
         return false;
     }));
 }
        public void MapBOToEF()
        {
            var mapper = new DALProductListPriceHistoryMapper();
            var bo     = new BOProductListPriceHistory();

            bo.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"));

            ProductListPriceHistory response = mapper.MapBOToEF(bo);

            response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ListPrice.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ProductID.Should().Be(1);
            response.StartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
        }
        public void MapEFToBO()
        {
            var mapper = new DALProductListPriceHistoryMapper();
            ProductListPriceHistory entity = new ProductListPriceHistory();

            entity.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, DateTime.Parse("1/1/1987 12:00:00 AM"));

            BOProductListPriceHistory response = mapper.MapEFToBO(entity);

            response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ListPrice.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ProductID.Should().Be(1);
            response.StartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
        }
        /// <summary>
        /// Inserts a mock ProductListPriceHistory entity into the database.
        /// </summary>
        private void Step_01_Insert_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                Assert.IsTrue(DataRepository.ProductListPriceHistoryProvider.Insert(tm, mock), "Insert failed");

                System.Console.WriteLine("DataRepository.ProductListPriceHistoryProvider.Insert(mock):");
                System.Console.WriteLine(mock);

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
        // GET: ProductListPriceHistories/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductListPriceHistory productListPriceHistory = db.ProductListPriceHistories.Find(id);

            if (productListPriceHistory == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ProductID = new SelectList(db.Products, "ProductID", "Name", productListPriceHistory.ProductID);
            return(View(productListPriceHistory));
        }
		/// <summary>
		/// Inserts a mock ProductListPriceHistory entity into the database.
		/// </summary>
		private void Step_01_Insert_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				mock = CreateMockInstance(tm);
				Assert.IsTrue(DataRepository.ProductListPriceHistoryProvider.Insert(tm, mock), "Insert failed");
										
				System.Console.WriteLine("DataRepository.ProductListPriceHistoryProvider.Insert(mock):");			
				System.Console.WriteLine(mock);			
				
				//normally one would commit here
				//tm.Commit();
				//IDisposable will Rollback Transaction since it's left uncommitted
			}
		}
        /// <summary>
        /// Serialize a ProductListPriceHistory collection into a temporary file.
        /// </summary>
        private void Step_08_SerializeCollection_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_ProductListPriceHistoryCollection.xml");

                mock = CreateMockInstance(tm);
                TList <ProductListPriceHistory> mockCollection = new TList <ProductListPriceHistory>();
                mockCollection.Add(mock);

                EntityHelper.SerializeXml(mockCollection, fileName);

                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
                System.Console.WriteLine("TList<ProductListPriceHistory> correctly serialized to a temporary file.");
            }
        }
        // PUT api/awbuildversion/5
        public void Put(ProductListPriceHistory value)
        {
            var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault();

            if (GetActionType.Key != null)
            {
                if (GetActionType.Value.ToList()[0].Equals("DELETE"))
                {
                    adventureWorks_BC.ProductListPriceHistoryDelete(value);
                }
                if (GetActionType.Value.ToList()[0].Equals("UPDATE"))
                {
                    adventureWorks_BC.ProductListPriceHistoryUpdate(value);
                }
            }
        }
Example #29
0
        public async void Get()
        {
            var mock   = new ServiceMockFacade <IProductListPriceHistoryRepository>();
            var record = new ProductListPriceHistory();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record));
            var service = new ProductListPriceHistoryService(mock.LoggerMock.Object,
                                                             mock.RepositoryMock.Object,
                                                             mock.ModelValidatorMockFactory.ProductListPriceHistoryModelValidatorMock.Object,
                                                             mock.BOLMapperMockFactory.BOLProductListPriceHistoryMapperMock,
                                                             mock.DALMapperMockFactory.DALProductListPriceHistoryMapperMock);

            ApiProductListPriceHistoryResponseModel response = await service.Get(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
        public bool ProductListPriceHistoryUpdate(ProductListPriceHistory productlistpricehistory)
        {
            return(Execute <bool>(dal =>
            {
                ProductListPriceHistory productlistpricehistoryUpdate = dal.ProductListPriceHistory.Where(x => x.ProductID == productlistpricehistory.ProductID).FirstOrDefault();
                if (productlistpricehistoryUpdate != null)
                {
                    productlistpricehistoryUpdate.ProductID = productlistpricehistory.ProductID;
                    productlistpricehistoryUpdate.StartDate = productlistpricehistory.StartDate;
                    productlistpricehistoryUpdate.EndDate = productlistpricehistory.EndDate;
                    productlistpricehistoryUpdate.ListPrice = productlistpricehistory.ListPrice;
                    productlistpricehistoryUpdate.ModifiedDate = productlistpricehistory.ModifiedDate;

                    dal.SubmitChanges();
                    return true;
                }
                return false;
            }));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            var res = (from c in db.ProductListPriceHistories
                       where c.ProductID == id
                       select c).FirstOrDefault();

            if (res != null)
            {
                res.isDeleted = true;
                db.SaveChanges();
                ViewBag.Message = string.Format("Congrats! Delete success");
            }

            ProductListPriceHistory productCategory = db.ProductListPriceHistories.Find(id);



            return(View(productCategory));
        }
        ///<summary>
        ///  Returns a Typed ProductListPriceHistory Entity with mock values.
        ///</summary>
        static public ProductListPriceHistory CreateMockInstance_Generated(TransactionManager tm)
        {
            ProductListPriceHistory mock = new ProductListPriceHistory();

            mock.StartDate    = TestUtility.Instance.RandomDateTime();
            mock.EndDate      = TestUtility.Instance.RandomDateTime();
            mock.ListPrice    = TestUtility.Instance.RandomShort();
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Product mockProductByProductId = ProductTest.CreateMockInstance(tm);

            DataRepository.ProductProvider.Insert(tm, mockProductByProductId);
            mock.ProductId = mockProductByProductId.ProductId;

            // create a temporary collection and add the item to it
            TList <ProductListPriceHistory> tempMockCollection = new TList <ProductListPriceHistory>();

            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);


            return((ProductListPriceHistory)mock);
        }
 /// <summary>
 /// Create a new ProductListPriceHistory object.
 /// </summary>
 /// <param name="productID">Initial value of ProductID.</param>
 /// <param name="startDate">Initial value of StartDate.</param>
 /// <param name="listPrice">Initial value of ListPrice.</param>
 /// <param name="modifiedDate">Initial value of ModifiedDate.</param>
 public static ProductListPriceHistory CreateProductListPriceHistory(int productID, global::System.DateTime startDate, decimal listPrice, global::System.DateTime modifiedDate)
 {
     ProductListPriceHistory productListPriceHistory = new ProductListPriceHistory();
     productListPriceHistory.ProductID = productID;
     productListPriceHistory.StartDate = startDate;
     productListPriceHistory.ListPrice = listPrice;
     productListPriceHistory.ModifiedDate = modifiedDate;
     return productListPriceHistory;
 }
		///<summary>
		///  Returns a Typed ProductListPriceHistory Entity with mock values.
		///</summary>
		static public ProductListPriceHistory CreateMockInstance_Generated(TransactionManager tm)
		{		
			ProductListPriceHistory mock = new ProductListPriceHistory();
						
			mock.StartDate = TestUtility.Instance.RandomDateTime();
			mock.EndDate = TestUtility.Instance.RandomDateTime();
			mock.ListPrice = TestUtility.Instance.RandomShort();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			//OneToOneRelationship
			Product mockProductByProductId = ProductTest.CreateMockInstance(tm);
			DataRepository.ProductProvider.Insert(tm, mockProductByProductId);
			mock.ProductId = mockProductByProductId.ProductId;
		
			// create a temporary collection and add the item to it
			TList<ProductListPriceHistory> tempMockCollection = new TList<ProductListPriceHistory>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (ProductListPriceHistory)mock;
		}
 // POST api/awbuildversion
 public void Post(ProductListPriceHistory value)
 {
     adventureWorks_BC.ProductListPriceHistoryAdd(value);
 }
		/// <summary>
		/// Test methods exposed by the EntityHelper class.
		/// </summary>
		private void Step_20_TestEntityHelper_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				mock = CreateMockInstance(tm);
				
				ProductListPriceHistory entity = mock.Copy() as ProductListPriceHistory;
				entity = (ProductListPriceHistory)mock.Clone();
				Assert.IsTrue(ProductListPriceHistory.ValueEquals(entity, mock), "Clone is not working");
			}
		}
		/// <summary>
		/// Serialize a ProductListPriceHistory collection into a temporary file.
		/// </summary>
		private void Step_08_SerializeCollection_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_ProductListPriceHistoryCollection.xml");
				
				mock = CreateMockInstance(tm);
				TList<ProductListPriceHistory> mockCollection = new TList<ProductListPriceHistory>();
				mockCollection.Add(mock);
			
				EntityHelper.SerializeXml(mockCollection, fileName);
				
				Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
				System.Console.WriteLine("TList<ProductListPriceHistory> correctly serialized to a temporary file.");					
			}
		}
		/// <summary>
		/// Serialize the mock ProductListPriceHistory entity into a temporary file.
		/// </summary>
		private void Step_06_SerializeEntity_Generated()
		{	
			using (TransactionManager tm = CreateTransaction())
			{
				mock =  CreateMockInstance(tm);
				string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_ProductListPriceHistory.xml");
			
				EntityHelper.SerializeXml(mock, fileName);
				Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found");
					
				System.Console.WriteLine("mock correctly serialized to a temporary file.");			
			}
		}
		/// <summary>
		/// Deep load all ProductListPriceHistory children.
		/// </summary>
		private void Step_03_DeepLoad_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				int count = -1;
				mock =  CreateMockInstance(tm);
				mockCollection = DataRepository.ProductListPriceHistoryProvider.GetPaged(tm, 0, 10, out count);
			
				DataRepository.ProductListPriceHistoryProvider.DeepLoading += new EntityProviderBaseCore<ProductListPriceHistory, ProductListPriceHistoryKey>.DeepLoadingEventHandler(
						delegate(object sender, DeepSessionEventArgs e)
						{
							if (e.DeepSession.Count > 3)
								e.Cancel = true;
						}
					);

				if (mockCollection.Count > 0)
				{
					
					DataRepository.ProductListPriceHistoryProvider.DeepLoad(tm, mockCollection[0]);
					System.Console.WriteLine("ProductListPriceHistory instance correctly deep loaded at 1 level.");
									
					mockCollection.Add(mock);
					// DataRepository.ProductListPriceHistoryProvider.DeepSave(tm, mockCollection);
				}
				
				//normally one would commit here
				//tm.Commit();
				//IDisposable will Rollback Transaction since it's left uncommitted
			}
		}
 /// <summary>
 /// There are no comments for ProductListPriceHistory in the schema.
 /// </summary>
 public void AddToProductListPriceHistory(ProductListPriceHistory productListPriceHistory)
 {
     base.AddObject("ProductListPriceHistory", productListPriceHistory);
 }
		///<summary>
		///  Update the Typed ProductListPriceHistory Entity with modified mock values.
		///</summary>
		static public void UpdateMockInstance_Generated(TransactionManager tm, ProductListPriceHistory mock)
		{
			mock.EndDate = TestUtility.Instance.RandomDateTime();
			mock.ListPrice = TestUtility.Instance.RandomShort();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			//OneToOneRelationship
			Product mockProductByProductId = ProductTest.CreateMockInstance(tm);
			DataRepository.ProductProvider.Insert(tm, mockProductByProductId);
			mock.ProductId = mockProductByProductId.ProductId;
					
		}
		/// <summary>
        /// Make any alterations necessary (i.e. for DB check constraints, special test cases, etc.)
        /// </summary>
        /// <param name="mock">Object to be modified</param>
        static private void SetSpecialTestData(ProductListPriceHistory mock)
        {
            //Code your changes to the data object here.
            mock.EndDate = mock.StartDate.AddDays(1);
        }
        ///<summary>
        ///  Update the Typed ProductListPriceHistory Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, ProductListPriceHistory mock)
        {
            ProductListPriceHistoryTest.UpdateMockInstance_Generated(tm, mock);
            
			// make any alterations necessary 
            // (i.e. for DB check constraints, special test cases, etc.)
			SetSpecialTestData(mock);
        }