Below is a PART of INVOICE class from our Project :
public abstract class Invoice
{
public int InvoiceId { get; set; }
public int Status { get; set; }
public virtual ObservableCollection<OrderRequestStatus> OrderRequestStatuses { get; set; }
public EnumType.Follow Follow {get; set;
public string FicheNo { get; set; }
public DateTime Date_ { get; set; }
public DateTime? DueDate_ { get; set; }
public DateTime? ShipmentDateEstimated { get; set; }
public DateTime? ShipmentDate { get; set; }
public string DoCode { get; set; }
public int AccountId{ get; set; }
public virtual AccountLayer.Account Account { get; set; }
public int? SourceIndex{ get; set; }
public int CurrencyTypeId { get; set; }
public virtual CommonLayer.CurrencyType CurrencyType { get; set; }
public double CurrencyRate { get; set; }
public CommonLayer.InvoicePricing Price { get; set; }
public string GenExp1 { get; set; }
public string GenExp2 { get; set; }
public string GenExp3 { get; set; }
public string GenExp4 { get; set; }
public int? LogoInvoiceLogicalRef { get; set; }
public CommonLayer.TableLog Added { get; set; }
public CommonLayer.TableLog Edited { get; set; }
public CommonLayer.TableLog Cancelled { get; set; }
public virtual ObservableCollection<StoredProcedures.sp_OtherSalesandOffers> sp_OtherSalesandOffers { get; set; }
public Invoice()
{
OrderRequestStatuses = new ObservableCollection<OrderRequestStatus>();
sp_OtherSalesandOffers = new ObservableCollection<StoredProcedures.sp_OtherSalesandOffers>();
Price = new CommonLayer.InvoicePricing();
Added = new CommonLayer.TableLog();
Edited = new CommonLayer.TableLog();
Cancelled = new CommonLayer.TableLog();
}
Related Context code is :
public TaksimGroupContext()
: base("Name=TaksimGroupContext")
{
this.Configuration.LazyLoadingEnabled = true;
this.Configuration.ValidateOnSaveEnabled = true;
this.Configuration.AutoDetectChangesEnabled = true;
this.Configuration.ProxyCreationEnabled = true;
}
We have two forms : 1- INVOICE 2- INVOICE DETAILS
Form 1 INVOICE form related code
private void DataBind_grdInvoices()
{
(from a in base._Context.Invoices
orderby a.Date_
where a.Date_ > DateTime.Today.AddDays(-3650);
select a
).Load();
grdInvoicess.DataSource = base._Context.Invoices.Local.ToBindingList();
}
Form 2 INVOICE DETAILS :
The data is loaded with same logic as above
The problem is :
We load the INVOICE from.Then we select one invoice and open INVOICE DETAULS form , which contains the Invoice header (From Invoice class) and Invoice Details ( from Stline class)
When we make any changes to Invoice ( NOT THE DETAILS ) , for example we change the Account, and then we save the changes, these changes are not detected by the INVOICE form.
EDIT : More precisely these changes are nor detected ( which we also don't try ) neither reflected to the grid .
Where are we making the mistake, or which other method should we follow ?
Thanks in advance.