void DisplayStock() { PartClasses.clsStockCollection Stock = new PartClasses.clsStockCollection(); lstStock.DataSource = Stock.StockList; lstStock.DataValueField = "StockNo"; lstStock.DataTextField = "StorageType"; lstStock.DataBind(); }
void Add() { PartClasses.clsStockCollection StockBook = new PartClasses.clsStockCollection(); String Error = StockBook.ThisStock.Valid(txtPCName.Text, txtGPU.Text, txtRAM.Text, txtStockAvailable.Text, txtStorageType.Text); if (Error == "") { StockBook.ThisStock.PCName = txtPCName.Text; StockBook.ThisStock.GPU = txtGPU.Text; StockBook.ThisStock.RAM = Convert.ToInt32(txtRAM.Text); StockBook.ThisStock.StockAvaliable = Convert.ToInt32(txtStockAvailable.Text); StockBook.ThisStock.StorageType = Convert.ToInt32(txtStorageType.Text); StockBook.Add(); Response.Redirect("AnStock.aspx"); } else { lblError.Text = "There were prblems with the data entered" + Error; } }
void Update() { PartClasses.clsStockCollection StockBook = new PartClasses.clsStockCollection(); String Error = StockBook.ThisStock.Valid(txtPCName.Text, txtRAM.Text, txtGPU.Text, txtStockAvailable.Text, txtStorageType.Text); if (Error == "") { StockBook.ThisStock.Find(PCIDNo); StockBook.ThisStock.PCName = txtPCName.Text; StockBook.ThisStock.RAM = Convert.ToInt32(txtRAM.Text); StockBook.ThisStock.CPU = txtCPU.Text; StockBook.ThisStock.GPU = txtGPU.Text; StockBook.ThisStock.Builddate = Convert.ToDateTime(txtBuildDate.Text); StockBook.ThisStock.StockAvaliable = Convert.ToInt32(txtStockAvailable.Text); StockBook.ThisStock.StorageType = Convert.ToInt32(txtStorageType.Text); StockBook.Update(); Response.Redirect("AnStock"); } else { lblError.Text = "There were problems with the data entered" + Error; } }
void DisplayPCIDNo() { clsStockCollection StockBook = new clsStockCollection(); StockBook.ThisStock.Find(PCIDNo); }