protected void btnClickUpdate(object sender, EventArgs e)
		{
			hfSelectedTab.Value = _tabAddressValidation;
			Country country = new Country();
			int validationID = GetValidationID();
			CCTLeadProvider provider = new CCTLeadProvider();
			AddressValidationRezult avRezult = new AddressValidationRezult();
			Address address = new Address();
			avRezult = LeadValidationManager.GetAddressValidationInformation(validationID);
			var viAddress = LeadValidationManager.GetValidationInformation(validationID);
			address.AddressID = viAddress.Lead.SubjectPropertyAddress.AddressID;
			address.City = avRezult.CorrectAddress.City;
			country.Name = viAddress.Lead.SubjectPropertyAddress.Country.Name;
			address.Country = country;
			address.State = avRezult.CorrectAddress.State;
			address.Street = avRezult.CorrectAddress.Address;
			address.ZipCode = avRezult.CorrectAddress.ZipCode;
			provider.SaveAddress(address);
			LeadValidationManager.ChangeStatus(validationID, (int)TypeValidation.AddressValidation, (int)StatusValidation.Passed);
			lvAddrVal.DataBind();
			DataManager.LeadModified(viAddress.Lead.LeadID.Value);
		}
Esempio n. 2
0
		public static bool CheckNotificationID(Guid userID, int notificationID)
		{
			CCTLeadProvider provider = new CCTLeadProvider();
			return provider.CheckNotificationID(userID, notificationID);
		}
Esempio n. 3
0
		public static string GetEmailTemplate(int id)
		{
			CCTLeadProvider provider = new CCTLeadProvider();
			return provider.GetEmailTemplate(id);
		}
Esempio n. 4
0
		public static List<NotificationType> GetNotificatonsTypes()
		{
			CCTLeadProvider provider = new CCTLeadProvider();
			return provider.GetNotificatonsTypes();
		}
Esempio n. 5
0
		public static void AddDeleteNotificationToUser(Guid userID, int notificationID, bool flagAdd)
		{
			CCTLeadProvider provider = new CCTLeadProvider();
			provider.AddDeleteNotificationToUser(userID, notificationID, flagAdd);
		}
Esempio n. 6
0
		public ValidationLead GetValidationInformation(int validationID)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				ValidationLead vlead = new ValidationLead();
				var tValidation = dc.T_Validations.Where(v => v.ValidationID == validationID).FirstOrDefault();
				if (tValidation != null)
				{
					List<ValidationResult> results = new List<ValidationResult>();
					var tResults = dc.T_ValidationResults
							.Where(res => res.ValidationID == tValidation.ValidationID);

					foreach (T_ValidationResult res in tResults)
					{
						results.Add(GetValidationResultEntity(res));
					}

					vlead.Results = results;
					DateTime dt = tValidation.vldDate;
					int year = dt.Year;
					int month = dt.Month;
					int day = dt.Day;
					vlead.Date = string.Format("{0}/{1}/{2}", month, day, year);

					CCTLeadProvider leadProvider = new CCTLeadProvider();
					vlead.ValidationID = tValidation.ValidationID;
					vlead.Lead = leadProvider.GetLeadEntity(tValidation.T_Lead);
					vlead.User = leadProvider.GetUserInformationEntity(tValidation.T_UserInformation);
				}

				return vlead;
			}
		}
Esempio n. 7
0
		static DataManager()
		{
			_dataProvider = new CCTLeadProvider();
			_dataActivityProvider = new CCTActivityProvider();
		}
Esempio n. 8
0
		public AddressValidationRezult GetAddressValidationInformation(int validationID)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				CCTLeadProvider leadProvider = new CCTLeadProvider();
				T_Lead tLead;
				T_ValidationAddress tValAddress;
				T_ValidationResult tRezult;
				T_Validation tValidation;
				T_ValidationStatus tStatus;
				T_ValidationAddressError tError;
				AddressValidationRezult avRezult = new AddressValidationRezult();
				tValidation = dc.T_Validations.Where(v => v.ValidationID == validationID).SingleOrDefault();
				tLead = dc.T_Leads.Where(l => l.LeadID == tValidation.LeadID).SingleOrDefault();
				tRezult = dc.T_ValidationResults.Where(r => r.ValidationID == validationID).FirstOrDefault();
				tValAddress = dc.T_ValidationAddresses.Where(va => va.AddressID == tRezult.AddressID).SingleOrDefault();
				tStatus = dc.T_ValidationStatus.Where(s => s.StatusID == tRezult.StatusID).SingleOrDefault();
				if (tValAddress != null)
				{
					if (tValAddress.ErrorID.HasValue)
					{
						tError = dc.T_ValidationAddressErrors.Where(e => e.ErrorID == tValAddress.ErrorID).FirstOrDefault();
						ValidationAddressError vaError = new ValidationAddressError();
						ValidationAddress vAddress = new ValidationAddress();
						vaError = GetValidationAddressErrorEntity(tError);
						vAddress.Error = vaError;
						avRezult.CorrectAddress = vAddress;
					}
					else
					{
						avRezult.CorrectAddress = GetValidationAddressEntity(tValAddress);
					}
				}
				if (tLead != null)
				{
					avRezult.Lead = leadProvider.GetLeadEntity(tLead);
				}
				if (tStatus != null)
				{
					avRezult.Status = GetValidationStatusEntity(tStatus);
				}

				return avRezult;
			}
		}
Esempio n. 9
0
		public List<ValidationLead> GetValidationsPage(int leadID, int rowIndex, int pageSize)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				int pageIndex = rowIndex / pageSize;

				var list = new List<ValidationLead>();
				var validPage = dc.T_Validations.Where(v => v.T_Lead.LeadID == leadID).OrderByDescending(o => o.vldDate).Skip(pageIndex * pageSize).Take(pageSize);

				foreach (var item in validPage)
				{
					List<ValidationResult> results = new List<ValidationResult>();
					var tResults = dc.T_ValidationResults
						.Where(res => res.ValidationID == item.ValidationID)
						.OrderBy(ob => ob.TypeID);

					foreach (T_ValidationResult res in tResults)
					{
						//if (item.)
						results.Add(GetValidationResultEntity(res));
					}
					ValidationLead validation = new ValidationLead();

					DateTime dt = item.vldDate;
					int year = dt.Year;
					int month = dt.Month;
					int day = dt.Day;
					validation.Date = string.Format("{0}/{1}/{2}", month, day, year);

					validation.Results = results;

					CCTLeadProvider leadProvider = new CCTLeadProvider();
					validation.ValidationID = item.ValidationID;
					validation.Lead = leadProvider.GetLeadEntity(item.T_Lead);
					validation.User = leadProvider.GetUserInformationEntity(item.T_UserInformation);
					list.Add(validation);
				}

				return list;
			}
		}
Esempio n. 10
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();
					}
				}

			}
		}
Esempio n. 11
0
		private static Activity GetActivityEntity(T_Activity tActivity)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				UserInformation createdBy = new UserInformation { FirstName = tActivity.T_UserInformation.usrFirstName, LastName = tActivity.T_UserInformation.usrLastName, Login = tActivity.T_UserInformation.Login };
				UserInformation owner = new UserInformation { FirstName = tActivity.T_UserInformation1.usrFirstName, LastName = tActivity.T_UserInformation1.usrLastName, Login = tActivity.T_UserInformation1.Login };
				UserInformation sender = new UserInformation { FirstName = tActivity.T_UserInformation2.usrFirstName, LastName = tActivity.T_UserInformation2.usrLastName, Login = tActivity.T_UserInformation2.Login };

				var tActivityLeads = dc.T_ActivityLeads.Where(al => al.ActivityID == tActivity.ActivityID);
				var tLeads = dc.T_Leads.Where(l => tActivityLeads.Any(ac => ac.LeadID == l.LeadID));
				CCTLeadProvider leadProvider = new CCTLeadProvider();
				List<Lead> recipients = new List<Lead>();
				foreach (var lead in tLeads)
				{
					var recipient = leadProvider.GetLeadEntity(lead);
					recipients.Add(recipient);
				}

				Priority priority = new Priority { PriorityID = tActivity.T_Priority.PriorityID, Type = tActivity.T_Priority.prType };
				ActivityType activityType = new ActivityType { Type = tActivity.T_ActivityType.atType, TypeID = tActivity.T_ActivityType.TypeID };

				DateTime createdDate = tActivity.actCreationDate;
				DateTime? dueDate = tActivity.actDue;

				List<Note> notes = new List<Note>();
				var tActivityNotes = dc.T_ActivityNotes.Where(e => e.ActivityID == tActivity.ActivityID);
				foreach (var tActivityNote in tActivityNotes)
				{
					notes.Add(leadProvider.GetNoteEntity(tActivityNote.T_Note));
				}


				//Activity activity = new Activity()
				//{
				//  ActivityID = tActivity.ActivityID,
				//  CreatedBy = createdBy,
				//  ActivityType = activityType,
				//  CreatedOn = createdDate,
				//  Due = dueDate,
				//  Notes = notes,
				//  Owner = owner,
				//  Post = tActivity.actPost,
				//  Priority = priority,
				//  Recipient = recipient,
				//  Sender = sender,
				//  Subject = tActivity.actSubject
				//};

				ActivityStatus status = new ActivityStatus();
				status.StatusID = tActivity.StatusID;
				var stat = dc.T_ActivityStatus.Where(st => st.StatusID == status.StatusID).Select(s => s.asStatus).First();
				status.Status = stat;
				Activity activity = new Activity();
				activity.ActivityID = tActivity.ActivityID;
				activity.CreatedBy = createdBy;
				activity.ActivityType = activityType;
				activity.CreatedOn = createdDate;
				activity.Due = dueDate;
				activity.Notes = notes;
				activity.Owner = owner;
				activity.Post = tActivity.actPost;
				activity.Priority = priority;
				activity.Recipient = recipients;
				activity.Sender = sender;
				activity.Subject = tActivity.actSubject;
				activity.Status = status;

				if (tActivity.actPhone != null)
				{
					activity.Phone = tActivity.actPhone;
				}
				if (tActivity.actAddress != null)
				{
					activity.Address = tActivity.actAddress;
				}

				return activity;
			}
		}
Esempio n. 12
0
		public CCTActivityProvider()
		{
			_dataLeadProvider = new CCTLeadProvider();
		}