partial void DeleteT_LeadImportantDate(T_LeadImportantDate instance);
partial void UpdateT_LeadImportantDate(T_LeadImportantDate instance);
partial void InsertT_LeadImportantDate(T_LeadImportantDate instance);
private void detach_T_LeadImportantDates(T_LeadImportantDate entity) { this.SendPropertyChanging(); entity.T_Lead = null; }
private void attach_T_LeadImportantDates(T_LeadImportantDate entity) { this.SendPropertyChanging(); entity.T_ImportantDate = this; }
public int SaveImportantDate(ImportantDate entity, int leadID) { using (var dc = new EngageCCTDataClassesDataContext()) { T_ImportantDate tDate; T_LeadImportantDate tLeadDate; if (!entity.DateID.HasValue) { tDate = new T_ImportantDate(); tLeadDate = new T_LeadImportantDate(); } else { tDate = dc.T_ImportantDates.SingleOrDefault(d => d.DateID == entity.DateID); tLeadDate = dc.T_LeadImportantDates.SingleOrDefault(d => d.DateID == entity.DateID); if (tDate == null || tLeadDate == null) { throw new ApplicationException("Date not found"); } } tDate.idtNote = entity.Note; tDate.idtReason = entity.Reason; tDate.idtDate = entity.Date; dc.T_ImportantDates.InsertOnSubmit(tDate); if (!entity.DateID.HasValue) dc.SubmitChanges(); tLeadDate.LeadID = leadID; tLeadDate.DateID = tDate.DateID; dc.T_LeadImportantDates.InsertOnSubmit(tLeadDate); dc.SubmitChanges(); return tDate.DateID; } }