public
ProductItem CreateProduct()
{
return
this
.Provider.CreateProduct();
}
public
ProductItem CreateProduct(Guid id)
{
return
this
.Provider.CreateProduct(id);
}
public
virtual
ProductItem CheckOut(ProductItem productItem)
{
return
(ProductItem)
this
.Lifecycle.CheckOut(productItem);
}
public
Telerik.Sitefinity.GenericContent.Model.Content CheckOut(Telerik.Sitefinity.GenericContent.Model.Content item)
{
var product = item
as
ProductItem;
if
(product !=
null
)
return
this
.CheckOut(product);
throw
new
NotSupportedException();
}
public
virtual
ProductItem CheckIn(ProductItem productItem)
{
return
(ProductItem)
this
.Lifecycle.CheckIn(productItem);
}
public
Telerik.Sitefinity.GenericContent.Model.Content CheckIn(Telerik.Sitefinity.GenericContent.Model.Content item)
{
var product = item
as
ProductItem;
if
(product !=
null
)
return
this
.CheckIn(product);
throw
new
NotSupportedException();
}
public
ProductItem GetProduct(Guid id)
{
return
this
.Provider.GetProduct(id);
}
public
IQueryable<ProductItem> GetProducts()
{
return
this
.Provider.GetProducts();
}
public
void
DeleteProduct(ProductItem product)
{
this
.Provider.DeleteProduct(product);
}
public
ILifecycleDecorator Lifecycle
{
get
{
return
LifecycleFactory.CreateLifecycle<ProductItem>(
this
,
this
.Copy);
}
}
public
void
Copy(ProductItem source, ProductItem destination)
{
destination.Urls.ClearDestinationUrls(source.Urls,
this
.Delete);
source.Urls.CopyTo(destination.Urls, destination);
ContentLinksExtensions.CopyContentLink(
"ProductImage"
, source, destination);
destination.Price = source.Price;
destination.QuantityInStock = source.QuantityInStock;
}
public
void
Copy(Telerik.Sitefinity.GenericContent.Model.Content source, Telerik.Sitefinity.GenericContent.Model.Content destination)
{
if
(source ==
null
)
{
throw
new
ArgumentNullException(
"source"
);
}
if
(destination ==
null
)
{
throw
new
ArgumentNullException(
"destination"
);
}
var productSource = source
as
ProductItem;
var productDestination = destination
as
ProductItem;
if
(productSource ==
null
|| productDestination ==
null
)
{
throw
new
ArgumentException(
"Source and destination must be of the same type"
);
}
this
.Copy(productSource, productDestination);
}
public
ProductItem Edit(ProductItem item)
{
return
(ProductItem)
this
.Lifecycle.Edit(item);
}
public
Telerik.Sitefinity.GenericContent.Model.Content Edit(Telerik.Sitefinity.GenericContent.Model.Content item)
{
var product = item
as
ProductItem;
if
(product !=
null
)
return
this
.Edit(product);
throw
new
NotSupportedException();
}
public
Guid GetCheckedOutBy(ProductItem item)
{
return
this
.Lifecycle.GetCheckedOutBy(item);
}
public
Guid GetCheckedOutBy(Telerik.Sitefinity.GenericContent.Model.Content item)
{
var product = item
as
ProductItem;
if
(product !=
null
)
return
this
.GetCheckedOutBy(product);
throw
new
NotSupportedException();
}
public
ProductItem GetLive(ProductItem cnt)
{
return
(ProductItem)(
this
.Lifecycle).GetLive(cnt);
}
public
Telerik.Sitefinity.GenericContent.Model.Content GetLive(Telerik.Sitefinity.GenericContent.Model.Content cnt)
{
var product = cnt
as
ProductItem;
if
(product !=
null
)
return
this
.GetLive(product);
throw
new
NotSupportedException();
}
public
ProductItem GetMaster(ProductItem cnt)
{
return
(ProductItem)(
this
.Lifecycle).GetMaster(cnt);
}
public
Telerik.Sitefinity.GenericContent.Model.Content GetMaster(Telerik.Sitefinity.GenericContent.Model.Content cnt)
{
var product = cnt
as
ProductItem;
if
(product !=
null
)
return
this
.GetMaster(product);
throw
new
NotSupportedException();
}
public
ProductItem GetTemp(ProductItem cnt)
{
return
(ProductItem)(
this
.Lifecycle).GetTemp(cnt);
}
public
Telerik.Sitefinity.GenericContent.Model.Content GetTemp(Telerik.Sitefinity.GenericContent.Model.Content cnt)
{
var product = cnt
as
ProductItem;
if
(product !=
null
)
return
this
.GetTemp(product);
throw
new
NotSupportedException();
}
public
bool
IsCheckedOut(ProductItem item)
{
return
this
.Lifecycle.IsCheckedOut(item);
}
public
bool
IsCheckedOut(Telerik.Sitefinity.GenericContent.Model.Content item)
{
var product = item
as
ProductItem;
if
(product !=
null
)
return
this
.IsCheckedOut(product);
throw
new
NotSupportedException();
}
public
bool
IsCheckedOutBy(ProductItem item, Guid userId)
{
return
this
.Lifecycle.IsCheckedOutBy(item, userId);
}
public
bool
IsCheckedOutBy(Telerik.Sitefinity.GenericContent.Model.Content item, Guid userId)
{
var product = item
as
ProductItem;
if
(product !=
null
)
return
this
.IsCheckedOutBy(product, userId);
throw
new
NotSupportedException();
}
public
ProductItem Publish(ProductItem item)
{
return
(ProductItem)
this
.Lifecycle.Publish(item);
}
public
Telerik.Sitefinity.GenericContent.Model.Content Publish(Telerik.Sitefinity.GenericContent.Model.Content item)
{
var product = item
as
ProductItem;
if
(product !=
null
)
return
this
.Publish(product);
throw
new
NotSupportedException();
}
public
ProductItem Schedule(ProductItem item, DateTime publicationDate, DateTime? expirationDate)
{
return
this
.Provider.Schedule(item, publicationDate, expirationDate,
this
.Copy,
this
.GetProducts());
}
public
Telerik.Sitefinity.GenericContent.Model.Content Schedule(Telerik.Sitefinity.GenericContent.Model.Content item, DateTime publicationDate, DateTime? expirationDate)
{
var product = item
as
ProductItem;
if
(product !=
null
)
return
this
.Schedule(product, publicationDate, expirationDate);
throw
new
NotSupportedException();
}
public
ProductItem Unpublish(ProductItem item)
{
return
(ProductItem)
this
.Lifecycle.Unpublish(item);
}
public
Telerik.Sitefinity.GenericContent.Model.Content Unpublish(Telerik.Sitefinity.GenericContent.Model.Content item)
{
var product = item
as
ProductItem;
if
(product !=
null
)
return
this
.Unpublish(product);
throw
new
NotSupportedException();
}