public int DeleteDataBL(StoreInventoryBL oStoreInventoryBL) { StoreDataAccessLayer oStoreDataAccessLayer = new StoreDataAccessLayer(); StoreInventoryDL oStoreInventoryDL = new StoreInventoryDL(); oStoreInventoryDL.Id = oStoreInventoryBL.Id; int rowCount = oStoreDataAccessLayer.DeleteDataDL(oStoreInventoryDL); return(rowCount); }
/// <summary> /// Method to Insert Data /// </summary> /// <param name="oStoreInventoryBL"></param> /// <returns></returns> public int InsertDataDL(StoreInventoryBL oStoreInventoryBL) { StoreDataAccessLayer oStoreDataAccessLayer = new StoreDataAccessLayer(); StoreInventoryDL oStoreInventoryDL = new StoreInventoryDL(); oStoreInventoryDL.ContentName = oStoreInventoryBL.ContentName; oStoreInventoryDL.ContentQuantity = oStoreInventoryBL.ContentQuantity; int rowCount = oStoreDataAccessLayer.InsertDataDL(oStoreInventoryDL); return(rowCount); }
/// <summary> /// Read Data From DataBase /// </summary> public void ReadData() { StoreBusinessLayer.StoreBusinessLayer oStoreBusinessLayer = new StoreBusinessLayer.StoreBusinessLayer(); StoreInventoryBL oStoreInventoryBL = new StoreInventoryBL(); IList <StoreInventoryBL> iStoreInventoryBL = new List <StoreInventoryBL>(); iStoreInventoryBL = oStoreBusinessLayer.ReadDataBL(); gridViewStoreInventory.DataSource = iStoreInventoryBL; gridViewStoreInventory.DataBind(); }
public void InsertData_Test() { StoreBusinessLayer.StoreBusinessLayer oStoreBusinessLayer = new StoreBusinessLayer.StoreBusinessLayer(); StoreInventoryBL oStoreInventoryBL = new StoreInventoryBL(); //Data Values oStoreInventoryBL.ContentName = "Test Data"; oStoreInventoryBL.ContentQuantity = 10; int rowCount = oStoreBusinessLayer.InsertDataDL(oStoreInventoryBL); Assert.GreaterOrEqual(rowCount, 1); }
public void UpdateData_Test() { StoreBusinessLayer.StoreBusinessLayer oStoreBusinessLayer = new StoreBusinessLayer.StoreBusinessLayer(); StoreInventoryBL oStoreInventoryBL = new StoreInventoryBL(); //Data Values oStoreInventoryBL.ContentName = "Test123"; oStoreInventoryBL.ContentQuantity = 50; oStoreInventoryBL.Id = 1007; int rowCount = oStoreBusinessLayer.UpdateDataBL(oStoreInventoryBL); Assert.GreaterOrEqual(rowCount, 1); }
protected void buttonDeleteData_Click(object sender, EventArgs e) { int contentID = Convert.ToInt32(textBoxContentID.Text); StoreBusinessLayer.StoreBusinessLayer oStoreBusinessLayer = new StoreBusinessLayer.StoreBusinessLayer(); StoreInventoryBL oStoreInventoryBL = new StoreInventoryBL(); oStoreInventoryBL.Id = contentID; int rowCount = oStoreBusinessLayer.DeleteDataBL(oStoreInventoryBL); if (rowCount >= 1) { ReadData(); } }
/// <summary> /// Insert Data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void buttonInsertData_Click(object sender, EventArgs e) { string contentName = textBoxContentName.Text; int contentQuantity = Convert.ToInt32(textBoxContentQuantity.Text); StoreBusinessLayer.StoreBusinessLayer oStoreBusinessLayer = new StoreBusinessLayer.StoreBusinessLayer(); StoreInventoryBL oStoreInventoryBL = new StoreInventoryBL(); oStoreInventoryBL.ContentName = contentName; oStoreInventoryBL.ContentQuantity = contentQuantity; int rowCount = oStoreBusinessLayer.InsertDataDL(oStoreInventoryBL); if (rowCount >= 1) { ReadData(); } }
public void ReadData_Test() { bool flag = false; StoreBusinessLayer.StoreBusinessLayer oStoreBusinessLayer = new StoreBusinessLayer.StoreBusinessLayer(); StoreInventoryBL oStoreInventoryBL = new StoreInventoryBL(); IList <StoreInventoryBL> iStoreInventoryBL = new List <StoreInventoryBL>(); iStoreInventoryBL = oStoreBusinessLayer.ReadDataBL(); if (iStoreInventoryBL.Count != 0 || iStoreInventoryBL != null) { flag = true; } Assert.AreEqual(flag, true); }
/// <summary> /// Method to read data from DataAccessLayer /// </summary> /// <returns></returns> public IList <StoreInventoryBL> ReadDataBL() { //Create list for business model IList <StoreInventoryBL> iStoreInventoryBL = new List <StoreInventoryBL>(); //Create list for data model IList <StoreInventoryDL> iStoreInventoryDL = new List <StoreInventoryDL>(); iStoreInventoryDL = oStoreDataAccess.ReadDataDL(); foreach (var item in iStoreInventoryDL) { oStoreInventoryBL = new StoreInventoryBL(); oStoreInventoryBL.Id = item.Id; oStoreInventoryBL.ContentName = item.ContentName; oStoreInventoryBL.ContentQuantity = item.ContentQuantity; iStoreInventoryBL.Add(oStoreInventoryBL); } //returning business data model object to view. return(iStoreInventoryBL); }