Hi,
I have a DataForm that i am binding to ObservableCollection that IEditableObject implemented in it. everything is working as expected except it is not pushing the changes/additions to the database.
my collection class look like this: ("tbl_Suppliers" is the table from the database, "Supplier" is the IEditableObject, AppdataclassDataContext is the LinqToSQL datacontext):
I have a DataForm that i am binding to ObservableCollection that IEditableObject implemented in it. everything is working as expected except it is not pushing the changes/additions to the database.
my collection class look like this: ("tbl_Suppliers" is the table from the database, "Supplier" is the IEditableObject, AppdataclassDataContext is the LinqToSQL datacontext):
class
suppliersdatacontext
{
public
AppdataclassDataContext dataDC =
new
AppdataclassDataContext();
private
ICollectionView suppliersQur =
null
;
public
ICollectionView Suppliers
{
get
{
if
(
this
.suppliersQur ==
null
)
{
ObservableCollection<Supplier> newSuppliers =
new
ObservableCollection<Supplier>();
foreach
(tbl_Supplier thisSupplier
in
dataDC.tbl_Suppliers)
{
newSuppliers.Add(
new
Supplier ((
int
)(thisSupplier.SupplierID), thisSupplier.name, thisSupplier.country, thisSupplier.contactperson, thisSupplier.contactemail, (
decimal
)(thisSupplier.discount)));
}
this
.suppliersQur =
new
QueryableCollectionView(newSuppliers);
}
return
this
.suppliersQur;
}
}
}