Exemplo n.º 1
0
    //update functions
    void Update()

    {
        //create an instance of the supplier
        MyClassLibrary.clsSupplierCollection SupplierBook = new MyClassLibrary.clsSupplierCollection();
        //validate the data on the web form
        string Error = SupplierBook.ThisSupplier.Valid(txtSupplier_Address.Text, txtSupplier_Email.Text, txtSupplier_Name.Text, txtSupplier_Phone_No.Text);

        //if the data is ok then add it to the object
        if (Error == "")
        {
            //find the record to update
            SupplierBook.ThisSupplier.Find(Supplier_Id);
            //get the data entered by the user
            SupplierBook.ThisSupplier.Supplier_Address  = txtSupplier_Address.Text;
            SupplierBook.ThisSupplier.Supplier_Email    = txtSupplier_Email.Text;
            SupplierBook.ThisSupplier.Supplier_Name     = txtSupplier_Name.Text;
            SupplierBook.ThisSupplier.Supplier_Phone_No = txtSupplier_Phone_No.Text;
            SupplierBook.ThisSupplier.Active            = chkActive.Checked;
            SupplierBook.ThisSupplier.CountyNo          = Convert.ToInt32(ddlCounty.SelectedValue);
            //add the record
            SupplierBook.Add();
            //all done so redirect back to he main page
            Response.Redirect("SDefault.aspx");
        }
        else
        {
            //report an error
            lblError.Text = "There were problem with the data entered" + Error;
        }
    }
Exemplo n.º 2
0
 void DisplaySuppliers()
 {
     //create an instance of the County collection
     MyClassLibrary.clsSupplierCollection Suppliers = new MyClassLibrary.clsSupplierCollection();
     //set the data source to the list of counties in collection
     lstSuppliers.DataSource = Suppliers.SupplierList;
     //set the name of the primary key
     lstSuppliers.DataValueField = "Supplier_Id";
     //set the data field to display
     lstSuppliers.DataTextField = "Supplier_Name";
     //bind the data to the list
     lstSuppliers.DataBind();
 }
 void DisplaySuppliers()
 {
     //Create and instance of the supplier collection
     MyClassLibrary.clsSupplierCollection Suppliers = new MyClassLibrary.clsSupplierCollection();
     //set the data source to the list of suppliers in the collection
     lstBoxListSupplier.DataSource = Suppliers.SupplierList;
     //set the name of the primary key
     lstBoxListSupplier.DataValueField = "SupplierID";
     //set the data.filed to display
     lstBoxListSupplier.DataTextField = "SupplierName";
     //bind the data to list
     lstBoxListSupplier.DataBind();
 }