partial void DeleteT_ActivityLead(T_ActivityLead instance);
		private void detach_T_ActivityLeads(T_ActivityLead entity)
		{
			this.SendPropertyChanging();
			entity.T_Lead = null;
		}
 partial void UpdateT_ActivityLead(T_ActivityLead instance);
 partial void InsertT_ActivityLead(T_ActivityLead instance);
		private void attach_T_ActivityLeads(T_ActivityLead entity)
		{
			this.SendPropertyChanging();
			entity.T_Activity = this;
		}
Esempio n. 6
0
		/// <summary>
		/// This version support only 
		/// </summary>
		public int GetLeadIdByActivityId(int id)
		{
			var activityLead = new T_ActivityLead();
			var lead = new T_Lead();
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				activityLead = dc.T_ActivityLeads.Where(a => a.ActivityID == id).FirstOrDefault();
				try
				{
					lead = dc.T_Leads.Where(l => l.LeadID == activityLead.LeadID).FirstOrDefault();
				}
				catch (NullReferenceException e)
				{
					var exc = new Exception("No such activity in DB", e);
					throw exc;
				}
			}
			if (lead == null)
			{
				var exc = new Exception("No such lead in DB");
				throw exc;
			}
			else
			{
				return lead.LeadID;
			}
			//return _dataLeadProvider.GetLeadSalutation(lead.SalutationID) + " " + lead.ldFirstName + " " + lead.ldLastName + "(Id: " + lead.LeadID + ")";
		}
Esempio n. 7
0
		public void SaveRecipients(List<Recipient> usersRecipients, List<Recipient> leadsRecipients, int activityID)
		{
			_dataLeadProvider = new CCTLeadProvider();
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				//T_ActivityUserInformation tActivityUserInformation;
				//T_ActivityLead tActivityLead;
				//tActivityUserInformation = dc.T_ActivityUserInformations.SingleOrDefault(a => a.ActivityID == activityID);
				//tActivityLead = dc.T_ActivityLeads.SingleOrDefault(l => l.ActivityID == activityID);

				//if (tActivityUserInformation == null)
				//{
				//  tActivityUserInformation = new T_ActivityUserInformation();
				//}
				//if (tActivityLead == null)
				//{
				//  tActivityLead = new T_ActivityLead();
				//}

				if (usersRecipients.Count > 0)
				{

					foreach (var user in usersRecipients)
					{
						string login = GetUserLoginByFullName(user);
						T_ActivityUserInformation tActivityUserInformation = new T_ActivityUserInformation();
						tActivityUserInformation.ActivityID = activityID;
						tActivityUserInformation.Login = login;
						tActivityUserInformation.IsBcc = user.IsBcc;
						dc.T_ActivityUserInformations.InsertOnSubmit(tActivityUserInformation);
						dc.SubmitChanges();
					}
				}

				if (leadsRecipients.Count > 0)
				{
					foreach (var lead in leadsRecipients)
					{
						int id = _dataLeadProvider.GetLeadIDByFullName(lead);
						T_ActivityLead tActivityLead = new T_ActivityLead();
						tActivityLead.ActivityID = activityID;
						tActivityLead.LeadID = id;
						tActivityLead.IsBcc = lead.IsBcc;
						dc.T_ActivityLeads.InsertOnSubmit(tActivityLead);
						dc.SubmitChanges();
					}
				}

			}
		}