Пример #1
0
    private void UpdateAllSupplierAddresses()
    {
        // Create an instance of the SuppliersBLL class
        SuppliersBLL suppliersAPI = new SuppliersBLL();

        // Iterate through the DataList's items
        foreach (DataListItem item in Suppliers.Items)
        {
            // Get the supplierID from the DataKeys collection
            int supplierID = Convert.ToInt32(Suppliers.DataKeys[item.ItemIndex]);

            // Read in the user-entered values
            TextBox address = (TextBox)item.FindControl("Address");
            TextBox city = (TextBox)item.FindControl("City");
            TextBox country = (TextBox)item.FindControl("Country");

            string addressValue = null, cityValue = null, countryValue = null;
            if (address.Text.Trim().Length > 0)
                addressValue = address.Text.Trim();
            if (city.Text.Trim().Length > 0)
                cityValue = city.Text.Trim();
            if (country.Text.Trim().Length > 0)
                countryValue = country.Text.Trim();

            // Call the SuppliersBLL class's UpdateSupplierAddress method
            suppliersAPI.UpdateSupplierAddress(supplierID, addressValue, cityValue, countryValue);
        }
    }
Пример #2
0
    public static void LoadStaticCache()
    {
        // Get suppliers - cache using application state
        SuppliersBLL suppliersBLL = new SuppliersBLL();

        HttpContext.Current.Application["key"] = suppliersBLL.GetSuppliers();
    }
Пример #3
0
    public static void LoadStaticCache()
    {
        // Get suppliers - cache using a static member variable
        SuppliersBLL suppliersBLL = new SuppliersBLL();

        suppliers = suppliersBLL.GetSuppliers();
    }
Пример #4
0
    public static void LoadStaticCache()
    {
        // Get suppliers - cache using the data cache
        SuppliersBLL suppliersBLL = new SuppliersBLL();

        HttpRuntime.Cache.Insert(
            /* key */ "key",
            /* value */ suppliers,
            /* dependencies */ null,
            /* absoluteExpiration */ Cache.NoAbsoluteExpiration,
            /* slidingExpiration */ Cache.NoSlidingExpiration,
            /* priority */ CacheItemPriority.NotRemovable,
            /* onRemoveCallback */ null);
    }