Product-related objects


List of examples:

Public statuses

Creating a public status



// Creates a new public status object
PublicStatusInfo newStatus = new PublicStatusInfo();

// Sets the public status properties
newStatus.PublicStatusDisplayName = "New status";
newStatus.PublicStatusName = "NewStatus";
newStatus.PublicStatusEnabled = true;
newStatus.PublicStatusSiteID = SiteContext.CurrentSiteID;

// Saves the public status to the database
PublicStatusInfo.Provider.Set(newStatus);

> Back to list of examples

Updating a public status



// Gets the public status
PublicStatusInfo updateStatus = PublicStatusInfo.Provider.Get("NewStatus", SiteContext.CurrentSiteID);
if (updateStatus != null)
{
    // Updates the public status properties
    updateStatus.PublicStatusDisplayName = updateStatus.PublicStatusDisplayName.ToLowerCSafe();

    // Saves the changes to the database
    PublicStatusInfo.Provider.Set(updateStatus);
}

> Back to list of examples

Updating multiple public statuses



// Gets all public statuses on the current site whose name starts with 'New'
var statuses = PublicStatusInfo.Provider.Get()
                                       .OnSite(SiteContext.CurrentSiteID)
                                       .WhereStartsWith("PublicStatusName", "New");

// Loops through the public statuses
foreach (PublicStatusInfo modifyStatus in statuses)
{
    // Updates the public status properties
    modifyStatus.PublicStatusDisplayName = modifyStatus.PublicStatusDisplayName.ToUpperCSafe();

    // Saves the changes to the database
    PublicStatusInfo.Provider.Set(modifyStatus);
}

> Back to list of examples

Deleting a public status



// Gets the public status
PublicStatusInfo deleteStatus = PublicStatusInfo.Provider.Get("NewStatus", SiteContext.CurrentSiteID);

if (deleteStatus != null)
{
    // Deletes the public status
    PublicStatusInfo.Provider.Delete(deleteStatus);
}

> Back to list of examples

Internal statuses

Creating an internal status



// Creates a new internal status object
InternalStatusInfo newStatus = new InternalStatusInfo();

// Sets the internal status properties
newStatus.InternalStatusDisplayName = "New internal status";
newStatus.InternalStatusName = "NewInternalStatus";
newStatus.InternalStatusEnabled = true;
newStatus.InternalStatusSiteID = SiteContext.CurrentSiteID;

// Saves the internal status to the database
InternalStatusInfo.Provider.Set(newStatus);

> Back to list of examples

Updating an internal status



// Gets the internal status
InternalStatusInfo updateStatus = InternalStatusInfo.Provider.Get("NewInternalStatus", SiteContext.CurrentSiteID);
if (updateStatus != null)
{
    // Updates the internal status properties
    updateStatus.InternalStatusDisplayName = updateStatus.InternalStatusDisplayName.ToLowerCSafe();

    // Saves the changes to the database
    InternalStatusInfo.Provider.Set(updateStatus);
}

> Back to list of examples

Updating multiple internal statuses



// Gets all internal statuses on the current site whose name starts with 'New'
var statuses = InternalStatusInfo.Provider.Get()
                                           .OnSite(SiteContext.CurrentSiteID)
                                           .WhereStartsWith("InternalStatusName", "New");

// Loops through the internal statuses
foreach (InternalStatusInfo modifyStatus in statuses)
{
    // Updates the internal status properties
    modifyStatus.InternalStatusDisplayName = modifyStatus.InternalStatusDisplayName.ToUpperCSafe();

    // Saves the changes to the database
    InternalStatusInfo.Provider.Set(modifyStatus);
}

> Back to list of examples

Deleting an internal status



// Gets the internal status
InternalStatusInfo deleteStatus = InternalStatusInfo.Provider.Get("NewInternalStatus", SiteContext.CurrentSiteID);

if (deleteStatus != null)
{
    // Deletes the internal status
    InternalStatusInfo.Provider.Delete(deleteStatus);
}

> Back to list of examples

Manufacturers

Creating a manufacturer



// Creates a new manufacturer object
ManufacturerInfo newManufacturer = new ManufacturerInfo();

// Sets the manufacturer properties
newManufacturer.ManufacturerDisplayName = "New manufacturer";
newManufacturer.ManufacturerName = "NewManufacturer";
newManufacturer.ManufacturerHomepage = "www.newmanufacturer.com";
newManufacturer.ManufacturerSiteID = SiteContext.CurrentSiteID;
newManufacturer.ManufacturerEnabled = true;

// Saves the manufacturer to the database
ManufacturerInfo.Provider.Set(newManufacturer);

> Back to list of examples

Updating a manufacturer



// Gets the manufacturer
ManufacturerInfo updateManufacturer = ManufacturerInfo.Provider.Get("NewManufacturer", SiteContext.CurrentSiteID);
if (updateManufacturer != null)
{
    // Updates the manufacturer properties
    updateManufacturer.ManufacturerDisplayName = updateManufacturer.ManufacturerDisplayName.ToLowerCSafe();

    // Saves the changes to the database
    ManufacturerInfo.Provider.Set(updateManufacturer);
}

> Back to list of examples

Updating multiple manufacturers



// Gets all manufacturers on the current site whose name starts with 'New'
var manufacturers = ManufacturerInfo.Provider.Get()
                                             .OnSite(SiteContext.CurrentSiteID)
                                             .WhereStartsWith("ManufacturerName", "New");

// Loops through the manufacturers
foreach (ManufacturerInfo modifyManufacturer in manufacturers)
{
    // Updates the manufacturer properties
    modifyManufacturer.ManufacturerDisplayName = modifyManufacturer.ManufacturerDisplayName.ToUpperCSafe();

    // Saves the changes to the database
    ManufacturerInfo.Provider.Set(modifyManufacturer);
}

> Back to list of examples

Deleting a manufacturer



// Gets the manufacturer
ManufacturerInfo deleteManufacturer = ManufacturerInfo.Provider.Get("NewManufacturer", SiteContext.CurrentSiteID);

if (deleteManufacturer != null)
{
    // Deletes the manufacturer
    ManufacturerInfo.Provider.Delete(deleteManufacturer);
}

> Back to list of examples

Suppliers

Creating a supplier



// Creates a new supplier object
SupplierInfo newSupplier = new SupplierInfo();

// Sets the supplier properties
newSupplier.SupplierDisplayName = "New supplier";
newSupplier.SupplierName = "NewSupplier";
newSupplier.SupplierEmail = "newsupplier@supplier.com";
newSupplier.SupplierSiteID = SiteContext.CurrentSiteID;
newSupplier.SupplierPhone = "123456789";
newSupplier.SupplierFax = "987654321";
newSupplier.SupplierEnabled = true;

// Saves the supplier to the database
SupplierInfo.Provider.Set(newSupplier);

> Back to list of examples

Updating a supplier



// Gets the supplier
SupplierInfo updateSupplier = SupplierInfoProvider.GetSupplierInfo("NewSupplier", SiteContext.CurrentSiteName);
if (updateSupplier != null)
{
    // Updates the supplier properties
    updateSupplier.SupplierDisplayName = updateSupplier.SupplierDisplayName.ToLowerCSafe();

    // Saves the changes to the database
    SupplierInfo.Provider.Set(updateSupplier);
}

> Back to list of examples

Updating multiple suppliers



// Gets all suppliers on the current site whose name starts with 'New'
var suppliers = SupplierInfo.Provider.Get()
                                    .OnSite(SiteContext.CurrentSiteID)
                                    .WhereStartsWith("SupplierName", "New");

// Loops through the suppliers
foreach (SupplierInfo modifySupplier in suppliers)
{
    // Updates the supplier properties
    modifySupplier.SupplierDisplayName = modifySupplier.SupplierDisplayName.ToUpperCSafe();

    // Saves the changes to the database
    SupplierInfo.Provider.Set(modifySupplier);
}

> Back to list of examples

Deleting a supplier



// Gets the supplier
SupplierInfo deleteSupplier = SupplierInfoProvider.GetSupplierInfo("NewSupplier", SiteContext.CurrentSiteName);

if (deleteSupplier != null)
{
    // Deletes the supplier
    SupplierInfo.Provider.Delete(deleteSupplier);
}

> Back to list of examples