private bool ValidateLeadEmail(string email) { var leadRepository = new LeadRepository(); var currentLead = leadRepository.Query().FirstOrDefault(x => x.Email == email); return(currentLead == null); }
public BaseResponse CreateUser(string subscription_id, string customer_id, string customer_reference) { var response = new BaseResponse(); try { var leadRepository = new LeadRepository(); var currentLead = leadRepository.Query().FirstOrDefault(x => x.IntakeToken == customer_reference); //// Create Chargify Suscription SubscriptionService chargifyService = new SubscriptionService(); int serviceSuscriptionId = chargifyService.AddTrialServiceSubscription(subscription_id, customer_id, currentLead.idLead); string urlToValidateUser = ConfigurationManager.AppSettings["SmartSocialWeb"]; //Create new System User UserService _userService = new UserService(); _userService.TrialCreateUser(currentLead.Email, 1, urlToValidateUser, int.Parse(subscription_id), int.Parse(customer_id), serviceSuscriptionId); // Send Lead Confirmation string token = WebSecurity.GeneratePasswordResetToken(currentLead.Email); SendTrialIntakeConfirmationEmail(currentLead.Email, currentLead.FirstName, urlToValidateUser + token); response.Acknowledgment = true; response.Message = "Success"; } catch (Exception ex) { response.Acknowledgment = false; response.Message = "Error Updating a Lead: " + ex.Message; } return(response); }
public LeadResponse ChargifySuscription(string subscription_id, string customer_id) { var response = new LeadResponse(); SubscriptionService chargifyService = new SubscriptionService(); ISubscription subscription = chargifyService.GetSubscription(int.Parse(subscription_id)); ICustomer customerResult = subscription.Customer; try { var leadRepository = new LeadRepository(); var newLead = new Lead() { Aliases = "", CountryCode = "USA(+1)", DateCreated = DateTime.Now, DateUpdated = DateTime.Now, Email = customerResult.Email, FirstName = customerResult.FirstName, LastName = customerResult.LastName, Keywords = "", PhoneNumber = customerResult.Phone, MarketSegments = "", OtherMarketSegments = "", IntakeEmailSentDate = DateTime.Now, IntakeToken = subscription_id, IntakeUrl = "", IsActive = true, IsIntakeAnswered = false }; leadRepository.Add(newLead); leadRepository.SaveChanges(); var currentLead = newLead; if (currentLead != null) { response.Lead = new LeadDto() { idLead = currentLead.idLead, FirstName = currentLead.FirstName, LastName = currentLead.LastName, CountryCode = currentLead.CountryCode, PhoneNumber = currentLead.PhoneNumber, Email = currentLead.Email }; response.Acknowledgment = true; response.Message = "Success"; } else { response.Acknowledgment = false; response.Message = "Unable to Find a lead with that token"; } } catch (Exception ex) { response.Acknowledgment = false; response.Message = "Error Updating a Lead: " + ex.Message; } return(response); }
public LeadResponse GetLeadByToken(string token) { var response = new LeadResponse(); try { var leadRepository = new LeadRepository(); var currentLead = leadRepository.Query().FirstOrDefault(x => x.IntakeToken == token); if (currentLead != null) { response.Lead = new LeadDto() { idLead = currentLead.idLead, FirstName = currentLead.FirstName, LastName = currentLead.LastName, CountryCode = currentLead.CountryCode, PhoneNumber = currentLead.PhoneNumber, Email = currentLead.Email }; response.Acknowledgment = true; response.Message = "Success"; } else { response.Acknowledgment = false; response.Message = "Unable to Find a lead with that token"; } } catch (Exception ex) { response.Acknowledgment = false; response.Message = "Error Updating a Lead: " + ex.Message; } return(response); }
public LeadsController(IUnitOfWork unitOfWork) { _uow = unitOfWork; _leadRepo = unitOfWork.LeadRepository; _partnerRepo = unitOfWork.PartnerRepository; _actionRepo = unitOfWork.ActionRepository; }
public HookController(IUnitOfWork unitOfWork, MessageController messageController) { _uow = unitOfWork; _leadRepo = unitOfWork.LeadRepository; _cusRepo = unitOfWork.CustomerRepository; _messageController = messageController; }
public LeadResponse CreateLead(LeadDto leadDto, bool sendMail) { var response = new LeadResponse(); try { UserService _userService = new UserService(); // _userService.GetUserInformation if (ValidateLeadEmail(leadDto.Email)) { var leadRepository = new LeadRepository(); var newLead = new Lead() { Aliases = leadDto.Aliases, CountryCode = leadDto.CountryCode, DateCreated = leadDto.DateCreated, DateUpdated = leadDto.DateUpdated, Email = leadDto.Email, FirstName = leadDto.FirstName, LastName = leadDto.LastName, Keywords = leadDto.Keywords, PhoneNumber = leadDto.PhoneNumber, MarketSegments = leadDto.MarketSegments, OtherMarketSegments = leadDto.OtherMarketSegments, IntakeEmailSentDate = DateTime.Now, IntakeToken = leadDto.IntakeToken, IntakeUrl = leadDto.IntakeUrl, IsActive = true, IsIntakeAnswered = false }; leadRepository.Add(newLead); leadRepository.SaveChanges(); leadDto.idLead = newLead.idLead; response.Acknowledgment = true; response.Message = "Success"; if (sendMail) { SendLeadConfirmationEmail(leadDto.Email, leadDto.FirstName, leadDto.IntakeUrl); } response.Lead = leadDto; } else { //response.Acknowledgment = false; //response.Message = "Error Adding a Lead: Email already exist"; //response.Lead = null; throw new System.ArgumentException("The email is already registered as a user. Please choose another one."); } } catch (Exception ex) { response.Acknowledgment = false; response.Message = ex.Message; response.Lead = null; } return(response); }
public LeadNotifcationBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; companyRepository = new CompanyRepository(unitOfWork); leadRepository = new LeadRepository(unitOfWork); leadEmailRepository = new LeadEmailNotificationRepository(unitOfWork); leadAuditBusiness = new LeadAuditBusiness(unitOfWork); leadAuditRepository = new LeadAuditRepository(unitOfWork); }
public virtual Task <IAppLead> Create() { var crmService = StartupHelper.CreateCrmService(); ILeadRepository leadrepository = new LeadRepository(); ILeadService leadservice = new LeadService(crmService, leadrepository); IAppLead app = new AppLead(leadservice); return(Task.FromResult(app));; }
public TaskItemBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; taskRepository = new TaskItemRepository(unitOfWork); taskStatusRepository = new TaskStatusRepository(unitOfWork); contactRepository = new ContactRepository(unitOfWork); leadRepository = new LeadRepository(unitOfWork); accountRepository = new AccountRespository(unitOfWork); }
public LeadsController( LeadRepository leadRepo, LeadTypeRepository leadTypeRepository, MobileProductRepository mobileProductRepository ) { _leadRepo = leadRepo; _leadTypeRepository = leadTypeRepository; _mobileProductRepository = mobileProductRepository; }
public static Lead GetLead(string recordLocator, string vendorNumber) { Lead lead; using (CustomClearviewEntities ctx = new CustomClearviewEntities()) { LeadRepository repo = new LeadRepository(ctx); lead = repo.Find(x => x.RecordLocator == recordLocator && x.VendorNumber == vendorNumber); } return(lead); }
public LeadEvaluator( MobileMessageService messageSvc, ScoringAndVerificationService scoringSvc, ProductRecommendationService productRecommendationSvc, LeadRepository leadRepo ) { _interestConfirmationEval = new InterestConfirmationEvaluator(messageSvc); _applicationEval = new ApplicationEvaluator(messageSvc, scoringSvc, productRecommendationSvc); _leadRepo = leadRepo; }
public UnitOfWork(ApplicationDbContext ctx) { _ctx = ctx; Blog = new BlogRepository(_ctx); Product = new ProductRepository(_ctx); ProductImage = new ProductImagesRepository(_ctx); GlobalSettings = new GlobalValuesRepository(_ctx); BlogTypes = new BlogTypeRepository(_ctx); ClientReviews = new ClientReviewsRepository(_ctx); Lead = new LeadRepository(_ctx); WebsiteContent = new WebsiteContentRepository(_ctx); }
public EvalLeadJobController( MobileMessageService messageSvc, ScoringAndVerificationService scoringSvc, ProductRecommendationService productRecommendationSvc, LeadRepository leadRepo, LeadTypeRepository leadTypeRepo ) { _messageSvc = messageSvc; _scoringSvc = scoringSvc; _productRecommendationSvc = productRecommendationSvc; _leadRepo = leadRepo; _leadTypeRepo = leadTypeRepo; }
public LeadAssignmentsController(IUnitOfWork unitOfWork, IEmailSender emailSender , MessageController messageController, LeadsController leadsController , UserManager <ApplicationUser> userManager, RoleManager <ApplicationRole> roleManager, SignInManager <ApplicationUser> signInManager) { _uow = unitOfWork; _leadAssRepo = unitOfWork.LeadAssignmentRepository; _leadRepo = unitOfWork.LeadRepository; _salesRepo = unitOfWork.SalesPersonRepository; _actionPermissionRepo = unitOfWork.ActionRepository; _emailSender = emailSender; _messageController = messageController; _leadsController = leadsController; _accountManager = new AccountManager(userManager, roleManager, signInManager, emailSender); }
public LeadBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; leadRepository = new LeadRepository(unitOfWork); taskItemRepository = new TaskItemRepository(unitOfWork); stageRepository = new StageRepository(unitOfWork); leadAuditBusiness = new LeadAuditBusiness(unitOfWork); accountRepository = new AccountRespository(_unitOfWork); contactRepository = new ContactRepository(_unitOfWork); moduleRepository = new ModuleRepository(_unitOfWork); leadStatusRepository = new LeadStatusRepository(_unitOfWork); fileAttachmentrepository = new FileAttachmentRepository(_unitOfWork); stageBusiness = new StageBusiness(_unitOfWork); ratingBusiness = new RatingBusiness(_unitOfWork); leadContactRepository = new LeadContactRepository(_unitOfWork); accountcontactRepository = new AccountContactRepository(_unitOfWork); salesOrderRepository = new SalesOrderRepository(_unitOfWork); tagRepository = new TagRepository(_unitOfWork); leadTagRepository = new LeadTagRepository(_unitOfWork); }
public LeadController(LeadDataContext context) { this.context = context; this.leadRepo = new LeadRepository(context); this.serviceRepo = new ServiceRepository(context); }
public TAndCsController(LeadRepository leadRepo) { _leadRepo = leadRepo; }
public ReportBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; leadRepository = new LeadRepository(unitOfWork); }
public BaseResponse UpdateLead(LeadDto leadDto, string urlToValidateUser) { var response = new BaseResponse(); try { var leadRepository = new LeadRepository(); var currentLead = leadRepository.Query().FirstOrDefault(x => x.idLead == leadDto.idLead); if (currentLead != null) { currentLead.FirstName = (leadDto.FirstName != null && !leadDto.FirstName.Equals("")) ? leadDto.FirstName : currentLead.FirstName; currentLead.LastName = (leadDto.LastName != null && !leadDto.LastName.Equals("")) ? leadDto.LastName : currentLead.LastName; currentLead.CountryCode = (leadDto.CountryCode != null && !leadDto.CountryCode.Equals("")) ? leadDto.CountryCode : currentLead.CountryCode; currentLead.PhoneNumber = (leadDto.PhoneNumber != null && !leadDto.PhoneNumber.Equals("")) ? leadDto.PhoneNumber : currentLead.PhoneNumber; currentLead.Email = (leadDto.Email != null && !leadDto.Email.Equals("")) ? leadDto.Email : currentLead.Email; currentLead.ProductName = (leadDto.ProductName != null && !leadDto.ProductName.Equals("")) ? leadDto.ProductName : currentLead.ProductName; currentLead.ProductURL = (leadDto.ProductURL != null && !leadDto.ProductURL.Equals("")) ? leadDto.ProductURL : currentLead.ProductURL; currentLead.Aliases = (leadDto.Aliases != null && !leadDto.Aliases.Equals("")) ? leadDto.Aliases : currentLead.Aliases; currentLead.Keywords = (leadDto.Keywords != null && !leadDto.Keywords.Equals("")) ? leadDto.Keywords : currentLead.Keywords; currentLead.Competitors = (leadDto.Competitors != null && !leadDto.Competitors.Equals("")) ? leadDto.Competitors : currentLead.Competitors; currentLead.Notes = (leadDto.Notes != null && !leadDto.Notes.Equals("")) ? leadDto.Notes : currentLead.Notes; currentLead.MarketSegments = (leadDto.MarketSegments != null && !leadDto.MarketSegments.Equals("")) ? leadDto.MarketSegments : currentLead.MarketSegments; currentLead.OtherMarketSegments = (leadDto.OtherMarketSegments != null && !leadDto.OtherMarketSegments.Equals("")) ? leadDto.OtherMarketSegments : currentLead.OtherMarketSegments; currentLead.DateUpdated = DateTime.Now; currentLead.IsIntakeAnswered = true; currentLead.IsActive = leadDto.IsActive; } leadRepository.SaveChanges(); // Create Chargify Suscription SubscriptionService chargifyService = new SubscriptionService(); ISubscription subscription = null; if (currentLead.IntakeUrl == "") { subscription = chargifyService.GetSubscription(int.Parse(currentLead.IntakeToken)); } int serviceSuscriptionId = 0; if (subscription == null) { subscription = chargifyService.SubscribeChargifyTrial(currentLead); // Create System Suscription if (subscription != null) { // Create Trial Suscription serviceSuscriptionId = chargifyService.AddTrialServiceSubscription(subscription.SubscriptionID.ToString(), subscription.Customer.ChargifyID.ToString(), currentLead.idLead); } else { response.Acknowledgment = false; response.Message = "Invalid Charify Suscription"; return(response); } } //Create new System User UserService _userService = new UserService(); _userService.TrialCreateUser(currentLead.Email, 1, urlToValidateUser, subscription.SubscriptionID, subscription.Customer.ChargifyID, serviceSuscriptionId); // Send Lead Confirmation string token = WebSecurity.GeneratePasswordResetToken(currentLead.Email); SendTrialIntakeConfirmationEmail(currentLead.Email, currentLead.FirstName, urlToValidateUser + token); response.Acknowledgment = true; response.Message = "Success"; } catch (Exception ex) { response.Acknowledgment = false; response.Message = "Error Updating a Lead: " + ex.Message; } return(response); }
public HomeController(IUnitOfWork unitOfWork) { _leadRepo = unitOfWork.LeadRepository; }