void Update() { //create an instance of the manufacturer log Class_Library.clsManufacturerCollection ManufacturerLog = new Class_Library.clsManufacturerCollection(); //validate the data on the web form String Error = ManufacturerLog.ThisManufacturer.Valid(txtCarModel.Text, txtChairMan.Text, txtEmail.Text, txtYearMade.Text); // if the data us ok then add it to the object if (Error == "") { ManufacturerLog.ThisManufacturer.Find(ManufacturerID); //get the data entered by the user ManufacturerLog.ThisManufacturer.CarModel = txtCarModel.Text; ManufacturerLog.ThisManufacturer.ChairMan = txtChairMan.Text; ManufacturerLog.ThisManufacturer.Email = txtEmail.Text; ManufacturerLog.ThisManufacturer.PhoneNo = Convert.ToInt32(txtPhoneNo.Text); ManufacturerLog.ThisManufacturer.YearMade = Convert.ToDateTime(txtYearMade.Text); ManufacturerLog.ThisManufacturer.Available = ChkAvailable.Checked; ManufacturerLog.ThisManufacturer.BatchProductionNo = Convert.ToInt32(ddlBatchProduction.SelectedValue); //update the record ManufacturerLog.Update(); // all done Response.Redirect("DefaultManufacturer.aspx"); } else { //report error lblError.Text = "There were problems with the data entered " + Error; } }
void DisplayManufacturers() { // create an instance of collection Class_Library.clsManufacturerCollection ManufacturerLog = new Class_Library.clsManufacturerCollection(); //set the data source to the list of addresses in the collection lstManufacturers.DataSource = ManufacturerLog.ManufacturerList; //set the name of the primary ey lstManufacturers.DataValueField = "ManufacturerID"; //set the data filed to display lstManufacturers.DataTextField = "CarModel"; //bind the data to the list lstManufacturers.DataBind(); }