partial void DeleteT_ImportantDate(T_ImportantDate instance);
 partial void UpdateT_ImportantDate(T_ImportantDate instance);
Example #3
0
		internal ImportantDate GetImportantDateEntity(T_ImportantDate tDate)
		{
			ImportantDate imDate = new ImportantDate();

			imDate.DateID = tDate.DateID;
			imDate.Date = tDate.idtDate;
			imDate.Note = tDate.idtNote;
			imDate.Reason = tDate.idtReason;

			return imDate;
		}
 partial void InsertT_ImportantDate(T_ImportantDate instance);
Example #5
0
		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;
			}
		}