Example #1
0
        protected void btnGo_Click(object sender, EventArgs e)
        {
            var country = _Countries[ddlCountry.SelectedValue];
            var role    = _Roles[ddlRole.SelectedValue];

            var prospect = new Prospect
            {
                CompanyName  = txtCompanyName.Text,
                EmailAddress = txtEmail.Text,
                FirstName    = txtFirstName.Text,
                LastName     = txtLastName.Text,
                Country      = country,
                Role         = role
            };

            var eventMessage = new ProspectSignedUpEvent
            {
                Prospect   = prospect,
                SignedUpAt = DateTime.UtcNow
            };

            MessageQueue.Publish(eventMessage);

            Server.Transfer("ThankYou.aspx");
        }
Example #2
0
        public void Insert()
        {
            using (var context = new ProductLaunchContext())
            {
                var country = new Country
                {
                    CountryCode = "GBR",
                    CountryName = "United Kingdom"
                };
                context.Countries.Add(country);

                var role = new Role
                {
                    RoleCode = "DM",
                    RoleName = "Decision Maker"
                };
                context.Roles.Add(role);

                var prospect = new Prospect
                {
                    FirstName    = "A",
                    LastName     = "Prospect",
                    CompanyName  = "Docker, Inc.",
                    EmailAddress = "*****@*****.**",
                    Country      = country,
                    Role         = role
                };
                context.Prospects.Add(prospect);
                context.SaveChanges();
            }
        }
Example #3
0
        protected void btnGo_Click(object sender, EventArgs e)
        {
            var country = _Countries[ddlCountry.SelectedValue];
            var role    = _Roles[ddlRole.SelectedValue];

            var prospect = new Prospect
            {
                CompanyName  = txtCompanyName.Text,
                EmailAddress = txtEmail.Text,
                FirstName    = txtFirstName.Text,
                LastName     = txtLastName.Text,
                Country      = country,
                Role         = role
            };

            Log.Info("Processing new prospect, email address: {0}", prospect.EmailAddress);

            //v1:
            //SaveProspect(prospect);

            //v2:
            PublishProspectSignedUpEvent(prospect);

            Server.Transfer("ThankYou.aspx");
        }
Example #4
0
        public static Prospect CreateProspect(int prospectId)
        {
            Prospect prospect = new Prospect();

            prospect.ProspectId = prospectId;
            return(prospect);
        }
Example #5
0
        public override async Task SetOverdueNotificationsAsync(List <string> overdueNotifications)
        {
            CriteriaBuilder criteriaBuilder = new CriteriaBuilder();

            _overdueNotifications = overdueNotifications;
            _followUps            = await _followUpsController.GetManyByCriteria
                                    (
                criteriaBuilder
                .Add("Id", _overdueNotifications.ToArray(), ConjunctionsEnum.And, Operators.In)
                                    );

            List <Guid> followUpsToRemove = new List <Guid>();

            for (int i = 0; i < _followUps.Count; i++)
            {
                if ((await ProspectWasConverted(_followUps[i])))
                {
                    followUpsToRemove.Add(_followUps[i].Id);
                }
            }
            if (followUpsToRemove.Count > 0)
            {
                _followUps = Enumerable.ToList(Enumerable.Where(_followUps, followup => !followUpsToRemove.Contains(followup.Id)));
            }

            if (_followUps.Count == 1 && _singleProspect == null)
            {
                _singleProspect = await new ProspectsController().GetByIdAsync(_followUps[0].ProspectId);
                _singleProspect.ReminderTime = _followUps[0].ReminderTime;
            }
        }
Example #6
0
        protected void btnGo_Click(object sender, EventArgs e)
        {
            var country = _Countries[ddlCountry.SelectedValue];
            var role    = _Roles[ddlRole.SelectedValue];

            var prospect = new Prospect
            {
                CompanyName  = txtCompanyName.Text,
                EmailAddress = txtEmail.Text,
                FirstName    = txtFirstName.Text,
                LastName     = txtLastName.Text,
                Country      = country,
                Role         = role
            };

            using (var context = new ProductLaunchContext())
            {
                //reload child objects:
                prospect.Country = context.Countries.Single(x => x.CountryCode == prospect.Country.CountryCode);
                prospect.Role    = context.Roles.Single(x => x.RoleCode == prospect.Role.RoleCode);

                context.Prospects.Add(prospect);
                context.SaveChanges();
            }

            Server.Transfer("ThankYou.aspx");
        }
Example #7
0
        // Helper Method to modify the Adaptive Card template.
        public static AdaptiveCard GetAdaptiveCard(Prospect userProfile)
        {
            // Found flight number, just return the flight details now.
            string json = System.IO.File.ReadAllText(@"Data\\Assets\\Card.json");
            var    card = AdaptiveCards.AdaptiveCard.FromJson(json).Card;
            var    body = card.Body;

            // Fact
            AdaptiveFactSet adaptiveFactSet = (AdaptiveCards.AdaptiveFactSet)body[2];

            // Name
            AdaptiveFact name = (AdaptiveFact)adaptiveFactSet.Facts[0];

            name.Value = userProfile.Name;

            // Phone Number
            AdaptiveFact phoneNumber = (AdaptiveFact)adaptiveFactSet.Facts[1];

            phoneNumber.Value = userProfile.PhoneNumber;

            // Email Address
            AdaptiveFact emailAddr = (AdaptiveFact)adaptiveFactSet.Facts[2];

            emailAddr.Value = userProfile.Email;

            return(card);
        }
Example #8
0
        public async Task <IActionResult> PutProspect([FromRoute] int id, [FromBody] Prospect prospect)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != prospect.Id)
            {
                return(BadRequest());
            }

            _context.Entry(prospect).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProspectExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,ProspectName,ProspectPosition,ProspectOV,ProspectPotential,ProspectAge,ProspectInitialRating,TeamID")] Prospect prospect)
        {
            if (id != prospect.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(prospect);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProspectExists(prospect.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamID"] = new SelectList(_context.Teams, "ID", "CityName", prospect.TeamID);
            return(View(prospect));
        }
Example #10
0
        protected void btnGo_Click(object sender, EventArgs e)
        {
            var country = _Countries[ddlCountry.SelectedValue];
            var role    = _Roles[ddlRole.SelectedValue];

            var prospect = new Prospect
            {
                CompanyName  = txtCompanyName.Text,
                EmailAddress = txtEmail.Text,
                FirstName    = txtFirstName.Text,
                LastName     = txtLastName.Text,
                Country      = country,
                Role         = role
            };

            var handlerType = Config.Current["Dependencies:IProspectSaveHandler"];

            Log.Debug($"Using IProspectSaveHandler implementation: {handlerType}");

            var type    = Type.GetType(handlerType);
            var handler = (IProspectSaveHandler)Global.ServiceProvider.GetService(type);

            handler.SaveProspect(prospect);

            Log.Info($"Saved new prospect, email address: {prospect.EmailAddress}");
            Server.Transfer("ThankYou.aspx");
        }
Example #11
0
        public IHttpActionResult PutProspect(int id, Prospect prospect)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != prospect.id)
            {
                return(BadRequest());
            }

            db.Entry(prospect).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProspectExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #12
0
        private async Task <DialogTurnResult> SummaryAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            if ((bool)stepContext.Result)
            {
                Prospect userProfile = await _prospectProperty.GetAsync(stepContext.Context, () => new Prospect());

                try
                {
                    await stepContext.Context.SendActivityAsync("Fix the code of Lead Generation in D365 first.", cancellationToken : cancellationToken);

                    // Lead generation..
                    await stepContext.Context.SendActivityAsync("Registering you in our system..", cancellationToken : cancellationToken);

                    string referenceNumber = await D365WebAPIHelper.GenerateLead(userProfile, cRMCredentials);

                    await stepContext.Context.SendActivityAsync($"Thanks {userProfile.Name}. You're now registered (Ref: {referenceNumber}). Someone from our company will contact you.", cancellationToken : cancellationToken);
                }
                catch (Exception)
                {
                    await stepContext.Context.SendActivityAsync($"There's an issue with our system. Please retry again later.", cancellationToken : cancellationToken);
                }

                return(await stepContext.EndDialogAsync(cancellationToken));
            }
            else
            {
                // Taking customer back to the question no. 1
                return(await stepContext.NextAsync(-3, cancellationToken));
            }
        }
Example #13
0
        public static void CreateDocument(Prospect prospect)
        {
            var node   = new Uri(Config.ElasticsearchUrl);
            var client = new ElasticClient(node);

            client.Index(prospect, idx => idx.Index("prospects"));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ProspectId,Name")] Prospect prospect)
        {
            if (id != prospect.ProspectId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(prospect);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProspectExists(prospect.ProspectId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(prospect));
        }
        // GET: Prospects/Create
        public IActionResult Create()
        {
            var prospect = new Prospect();

            PopulateDropDownLists();
            return(View());
        }
Example #16
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.CurrentProspectId == 0)
        {
            return;
        }
        try
        {
            ReassignProspect();
            LPWeb.BLL.Prospect bProspect = new Prospect();

            bProspect.AssignProspect(CurrentProspectId, Convert.ToInt32(ddlUsers.SelectedItem.Value), oldUserID);

            //PageCommon.WriteJsEnd(this, "Assign Prospect Successfully", PageCommon.Js_RefreshParent);
            PageCommon.RegisterJsMsg(this, "Assign prospect successfully!", "parent.DialogAssignClose();");
        }
        catch (System.ServiceModel.EndpointNotFoundException ex)
        {
            LPLog.LogMessage(ex.Message);
            PageCommon.WriteJsEnd(this, "Failed to assign prospect, reason: Point Manager is not running.", PageCommon.Js_RefreshSelf);
        }
        catch (Exception exception)
        {
            LPLog.LogMessage(exception.Message);
            PageCommon.WriteJsEnd(this, string.Format("Failed to assign prospect, reason:{0}.", exception.Message), PageCommon.Js_RefreshSelf);
        }
    }
Example #17
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (TakedownModel.IsOffline)
            {
                return(new StatusCodeResult(503));
            }

            if (_Roles == null)
            {
                _Roles = await referenceDataService.GetRolesAsync();
            }
            if (_Countries == null)
            {
                _Countries = await referenceDataService.GetCountriesAsync();
            }

            Roles = _Roles.Select(x => new SelectListItem
            {
                Value = x.RoleCode,
                Text  = x.RoleName
            }).ToList();

            Countries = _Countries.Select(x => new SelectListItem
            {
                Value = x.CountryCode,
                Text  = x.CountryName
            }).ToList();

            Prospect = GetProspect();

            return(Page());
        }
Example #18
0
        /// <summary>
        /// Registers a prospect.
        /// </summary>
        /// <param name="prospect">The prospect.</param>
        /// <returns>Status.</returns>
        /// <exception cref="System.ArgumentNullException">prospect</exception>
        public async Task <Status> RegisterProspect(Prospect prospect)
        {
            if (prospect == null)
            {
                throw new ArgumentNullException("prospect");
            }

            var prospectDto = new ProspectDto
            {
                DsrPhone  = prospect.DsrPhone,
                FirstName = prospect.FirstName,
                LastName  = prospect.LastName,
                Phone     = prospect.Phone,
                Means     = prospect.Money,
                Authority = prospect.Authority,
                Need      = prospect.Need
            };

            Status    status    = null;
            StatusDto statusDto = await api.RegisterProspect(prospectDto);

            if (statusDto != null)
            {
                status = new Status
                {
                    Success = statusDto.Successful,
                    Text    = statusDto.ResponseText
                };
            }
            return(status);
        }
Example #19
0
        /// <summary>
        /// Handle prospect down sync response
        /// </summary>
        /// <param name="prospectResponse">The response</param>
        /// <returns>a void task</returns>
        private async Task HandleResponse(DownSyncServerResponse <Prospect> prospectResponse)
        {
            if (prospectResponse == null)
            {
                return;
            }

            foreach (var prospect in prospectResponse.Package)
            {
                Prospect existingProspect = null;
                try
                {
                    existingProspect = await new ProspectsController().GetSingleByCriteria(
                        new CriteriaBuilder().Add("Phone", prospect.Phone));
                }
                catch (Exception e)
                {
                    this.Logger.Error(e);
                }

                if (existingProspect != null && existingProspect.Id != default(Guid))
                {
                    prospect.Converted = existingProspect.Converted;
                    prospect.Id        = default(Guid);
                    prospect.Id        = existingProspect.Id;
                    continue;
                }

                prospect.DsrPhone = prospectResponse.DsrPhone;
            }

            await new ProspectsController().SaveBulkAsync(prospectResponse.Package);
        }
Example #20
0
        public ActionResult Create([Bind] ProspectsViewModel vm)
        {
            if (ModelState.IsValid)
            {
                Prospect prospect = new Prospect
                {
                    Name     = vm.Name,
                    FileName = vm.File.FileName
                };

                FileData data = new FileData();
                using (Stream inputStream = vm.File.InputStream)
                {
                    MemoryStream memoryStream = inputStream as MemoryStream;
                    if (memoryStream == null)
                    {
                        memoryStream = new MemoryStream();
                        inputStream.CopyTo(memoryStream);
                    }
                    data.Data = memoryStream.ToArray();
                }

                prospect.FileData = data;

                db.Prospects.Add(prospect);
                db.SaveChanges();
                return(RedirectToAction("Index", "Prospects"));
            }

            return(View(vm));
        }
        public async Task <IActionResult> Create([Bind("ID,ProspectName,ProspectPosition,ProspectOV,ProspectPotential,ProspectAge,ProspectInitialRating,ProspectRerollRating,AttributeID,ProspectDraftedBy,TeamID")] Prospect prospect)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(prospect);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                ViewData["TeamID"] = new SelectList(_context.Teams, "ID", "CityName", prospect.TeamID);
                PopulateDropDownLists();
                return(View(prospect));
            }
            catch (DbUpdateException dex)
            {
                if (dex.InnerException.Message.Contains("UNIQUE"))
                {
                    ModelState.AddModelError("", "Unable to save. Player already exists with same name, age, and position. Are you entering the same player twice?");
                }
                else
                {
                    ModelState.AddModelError("", "Unable to save. Check for duplicate entry and try again.");
                }
            }
            PopulateDropDownLists();
            return(View(prospect));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,ProspectName,ProspectPosition,ProspectOV,ProspectPotential,ProspectAge,ProspectInitialRating,ProspectRerollRating,AttributeID,TeamID")] Prospect prospect)
        {
            var prospectToUpdate = await _context.Prospects
                                   .Include(p => p.Team).Include(p => p.Attribute)
                                   .SingleOrDefaultAsync(p => p.ID == id);

            if (prospectToUpdate == null)
            {
                return(NotFound());
            }

            if (await TryUpdateModelAsync <Prospect>(prospectToUpdate, "", p => p.ProspectName, p => p.ProspectPosition, p => p.ProspectOV,
                                                     p => p.ProspectPotential, p => p.ProspectAge, p => p.ProspectInitialRating, p => p.AttributeID, p => p.ProspectRerollRating, p => p.TeamID))
            {
                try
                {
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                catch
                {
                    throw;
                }
            }
            PopulateDropDownLists(prospectToUpdate);
            return(View(prospectToUpdate));
        }
Example #23
0
        public async void PersonExistsTest()
        {
            try
            {
                const string phone    = "0784159753";
                Prospect     prospect = await prospectsController.GetByPhoneNumberAsync(phone);

                if (prospect != null)
                {
                    int result = await prospectsController.DeleteAsync(prospect);

                    if (result != 1)
                    {
                        throw new Exception("Could not delete prospect");
                    }
                }
                await SaveAsync("Kennedy", "Maluki", phone);

                prospect = await prospectsController.GetPersonIfExists(phone, null, ErrorFilterFlags.DisableErrorHandling, false);

                bool exists = prospect != null;
                await prospectsController.DeleteAsync(prospect);

                Assert.IsTrue(exists, "Test for checking whether prospect exists is failing when it should succeed as prospect was saved on device");
            }
            catch (Exception ex)
            {
                "Exception thrown ~".WriteLine(ex.Message);
            }
        }
Example #24
0
 public JsonResult GetNicDetails(string NIC)
 {
     AIA.Life.Models.Opportunity.Prospect objProspect = new Prospect();
     objProspect.NIC = NIC;
     objProspect     = objProspectBusiness.FetchNicDetails(objProspect);
     return(Json(objProspect, JsonRequestBehavior.AllowGet));
 }
Example #25
0
        protected void btnGo_Click(object sender, EventArgs e)
        {
            var country = _Countries[ddlCountry.SelectedValue];
            var role    = _Roles[ddlRole.SelectedValue];

            var prospect = new Prospect
            {
                CompanyName  = txtCompanyName.Text,
                EmailAddress = txtEmail.Text,
                FirstName    = txtFirstName.Text,
                LastName     = txtLastName.Text
            };

            Log.Info("Saving new prospect, email address: {0}", prospect.EmailAddress);
            var stopwatch = Stopwatch.StartNew();

            using (var context = new SignUpDbEntities())
            {
                //reload child objects:
                prospect.Country = context.Countries.First(x => x.CountryCode == country.CountryCode);
                prospect.Role    = context.Roles.First(x => x.RoleCode == role.RoleCode);

                context.AddToProspects(prospect);
                context.SaveChanges();
            }
            Log.Info("Prospect saved, email address: {0}, ID: {1}, took: {2}ms", prospect.EmailAddress, prospect.ProspectId, stopwatch.ElapsedMilliseconds);

            Server.Transfer("ThankYou.aspx");
        }
Example #26
0
        public async Task <ActionResult <Prospect> > PostProspect(Prospect item)
        {
            item.ProspectID = Guid.NewGuid();
            _context.Prospects.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetProspect), new { id = item.ProspectID }, item));
        }
Example #27
0
 public static Prospect ToEntity(this ProspectUpdateCommand command, Prospect entity)
 {
     entity.ProspectName   = command.ProspectName;
     entity.ProspectType   = command.ProspectType;
     entity.Closed         = command.Closed;
     entity.AdditionalInfo = command.AdditionalInfo;
     return(entity);
 }
Example #28
0
 public JsonResult GetNicValuesQuote(string NIC)
 {
     AIA.Life.Models.Opportunity.Prospect objProspect = new Prospect();
     objProspect.NIC      = NIC;
     objProspect.NICAVAIL = false;
     objProspect          = objProspectBusiness.FetchNicverifyQuote(objProspect);
     return(Json(objProspect, JsonRequestBehavior.AllowGet));
 }
Example #29
0
        public ActionResult DeleteConfirmed(int id)
        {
            Prospect prospect = db.Prospects.Find(id);

            db.Prospects.Remove(prospect);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #30
0
    private static string BuildTitle(Task emailTask, IMTDService service)
    {
        string retVal = "";

        retVal = emailTask.Task_CID.GetExternalText() + "; ";

        Base.Attribute projectAttr = emailTask.Attributes.Find(CodeTranslator.Find("TASK_ATTR", "PROJECT"));
        if (projectAttr != null)
        {
            BaseExtendable project = new BaseExtendable(CodeTranslator.Find("ENTITY_TYPE", "PROJECT").Code_IID);
            project.Entity_IID = (int)projectAttr.Value;
            project            = (BaseExtendable)service.Load(project);
            service.LoadAttributes(project);

            Base.Attribute contactAttr = project.Attributes.Find(CodeTranslator.Find("PROJECT_ATTR", "CONTACT"));
            if (contactAttr != null)
            {
                Contact targetContact = new Contact((int)contactAttr.Value);
                targetContact = (Contact)service.Load(targetContact);
                retVal       += targetContact.Customer_Name + "; ";

                /*
                 * CustomerSite targetSite = new CustomerSite(targetContact.Site_IID);
                 * targetSite = (CustomerSite)service.Load(targetSite);
                 * Customer targetCustomer = new Customer(targetSite.Customer_IID);
                 * targetCustomer = (Customer)service.Load(targetCustomer);
                 * retVal += targetCustomer.Name + "; ";
                 */
            }

            retVal += project.Description + "; ";

            Base.Attribute projectNumAttr = project.Attributes.Find(CodeTranslator.Find("PROJECT_ATTR", "PROJECTNUM"));
            if (projectNumAttr != null)
            {
                retVal += "P#:" + (string)projectNumAttr.Value;
            }
            else
            {
                retVal += "Q#:" + project.OID;
            }
        }
        else
        {
            Base.Attribute prospectAttr = emailTask.Attributes.Find(CodeTranslator.Find("TASK_ATTR", "PROSPECT"));
            if (prospectAttr != null)
            {
                int          prospectIID = (int)prospectAttr.Value;
                Prospect     propect     = service.LoadProspect(prospectIID);
                CustomerSite site        = service.LoadCustomerSite(propect.Site_IID);
                Customer     cust        = service.LoadCustomer(site.Customer_IID);
                retVal += " " + propect.First_Name + " " + propect.Last_Name + " (" + cust.Name + ")";
            }
        }

        return(retVal);
    }
Example #31
0
    public static Prospect CreateProspect()
    {
        //if (ConfigurationManager.AppSettings["IsProduction"] != "true")
        //    return new Prospect();

        Prospect prospect = new Prospect();
        prospect.Save();
        return prospect;
    }
        // POST api/prospects
        // // Returns 204 by default, overridden to return 201
        public HttpResponseMessage Post(Prospect prospect)
        {
            var addedProspect = _repository.Add(prospect);

            // WebAPI will return 204 by default, however, the HTTP spec states that successful
            // POSTs should return 201 with a link to the newly created resource.
            var response = Request.CreateResponse(HttpStatusCode.Created, prospect);
            response.Headers.Location = new Uri(Url.Link("DefaultApi", new {id = addedProspect.Id}));
            return response;
        }
Example #33
0
 protected void lblSimilarCaseOpen_Click(object sender, EventArgs e)
 {
     try
     {
         int sid = int.Parse(((Label)((LinkButton)sender).Parent.FindControl("lblID")).Text);
         Prospect student = new Prospect(sid, null);
         Prospect prospect = student.GetProspectParent();
         OpenExistingProspect(prospect);
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
         if (rethrow) throw;
     }
 }
Example #34
0
    protected void lbNewProspect_Click(object sender, EventArgs e)
    {
        try
        {
            WorkspaceBufferEngine engine = CurrentSession.BufferEngine;
            Prospect prospect = new Prospect(engine.GetNextValidID(), null);
            engine.Append(prospect);
            Prospect student = new Prospect(engine.GetNextValidID(), prospect);
            student.SetStudent = true;
            prospect.AddStudent(student);
            ProspectStudentCase studentCase = new ProspectStudentCase(
                engine.GetNextValidID(), student);
            studentCase.StaffID = CurrentSession.CredentialManager.ValidStaffID(1);

            UpdateWorkspaceSideBar();
        }
        catch (Exception ex)
        {
            bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
            if (rethrow) throw;
        }
    }
Example #35
0
 protected void lbNewStudent_Click(object sender, EventArgs e)
 {
     try
     {
         UpdateCurrentInfo();
         WorkspaceBufferEngine engine = CurrentSession.BufferEngine;
         Prospect prospect = engine.GetWorkspaceObjectWithType<Prospect>(
             CurrentSession.CurrentProspectID);
         Prospect student = new Prospect(engine.GetNextValidID(), prospect);
         student.SetStudent = true;
         prospect.AddStudent(student);
         DisplayProspect(CurrentSession.CurrentProspectID);
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
         if (rethrow) throw;
     }
 }
Example #36
0
    public static void UpdateProspect(Prospect prospect)
    {
        //if (ConfigurationManager.AppSettings["IsProduction"] != "true")
        //    return;

        prospect.Save();
        HttpContext.Current.Session["CurrentProspect"] = prospect;

        if (!string.IsNullOrEmpty(prospect.Email))
        {
            Subscribe(prospect);
            prospect.EmailSent = 1;
            prospect.LastEmailSent = DateTime.Now;
            prospect.Save();
        }
    }
Example #37
0
    public static void Subscribe(Prospect prospect)
    {
        if (ConfigurationManager.AppSettings["IsProduction"] != "true")
            return;

        string name = prospect.Name;
        string restaurantName = prospect.Restaurant;
        string email = prospect.Email;
        if (string.IsNullOrEmpty(name) || name.Contains('@'))
            name = "";
        if (!string.IsNullOrEmpty(name) && name.Contains(' '))
            name = name.Substring(0, name.IndexOf(' '));

        string subject = string.IsNullOrEmpty(name) ? "Let's get started" : name + ", Let's get started";
        if (!string.IsNullOrEmpty(restaurantName))
            subject += " with " + restaurantName;
        name = string.IsNullOrEmpty(name) ? "Hey" : "Hey " + name;
        string body = subscribeEmail.Replace("{Name}", name);

        Email subscribe = new Email("*****@*****.**", email, subject, body);
        subscribe.Send();
    }
Example #38
0
    protected void lnOPen_Click(object sender, EventArgs e)
    {
        try
        {
            GridViewRow row = (GridViewRow)(((LinkButton)sender).Parent.Parent);
            int id = int.Parse(((Label)row.Cells[4].FindControl("lblID")).Text);
            WorkspaceBufferEngine engine = CurrentSession.BufferEngine;

            if (row.Cells[2].Text == "Prospect")
            {
                Prospect prospect = new Prospect(id, null);
                engine.Append(prospect);
                DisplayProspect(prospect.ID);
                UpdateWorkspaceSideBar();
            }
            else if (row.Cells[2].Text == "Prospect Student")
            {
                Prospect student = new Prospect(id, null);
                Prospect prospect = student.GetProspectParent();
                engine.Append(prospect);
                DisplayProspect(prospect.ID);
                UpdateWorkspaceSideBar();

            }
        }
        catch (Exception ex)
        {
            bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
            if (rethrow) throw;
        }
    }
    public static void UpdateProspectPassword(Prospect value)
    {
        SqlParameter[] param = new SqlParameter[] {
            new SqlParameter("@ProspectId", value.ProspectId),
            new SqlParameter("@Password", value.Password)
        };

        SqlHelper.ExecuteNonQuery(Helper.ConnectionString, CommandType.StoredProcedure, "app_Prospect_UpdatePassword", param);
    }
Example #40
0
 private void OpenExistingProspect(Prospect prospect)
 {
     try
     {
         WorkspaceBufferEngine engine = CurrentSession.BufferEngine;
         engine.Append(prospect);
         UpdateCurrentInfo();
         UpdateWorkspaceSideBar();
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
         if (rethrow) throw;
     }
 }
    public static Prospect Read(SqlDataReader reader)
    {
        Prospect retval = new Prospect();

        for (int i = 0; i < reader.FieldCount; i++)
        {
            switch (reader.GetName(i))
            {
                case "ProspectId":
                    retval.ProspectId = Helper.ToInt32(reader[i]);
                    break;
                case "ProspectID":
                    retval.ProspectId = Helper.ToInt32(reader[i]);
                    break;
                case "CompanyId":
                    retval.CompanyId = Helper.ToInt32(reader[i]);
                    break;
                case "CompanyName":
                    retval.CompanyName = Helper.ToString(reader[i]);
                    break;
                case "FirstName":
                    retval.FirstName = Helper.ToString(reader[i]);
                    break;
                case "LastName":
                    retval.LastName = Helper.ToString(reader[i]);
                    break;
                case "Title":
                    retval.Title = Helper.ToString(reader[i]);
                    break;
                case "Address":
                    retval.Address.Address1 = Helper.ToString(reader[i]);
                    break;
                case "StreetAddress":
                    retval.Address.Address1 = Helper.ToString(reader[i]);
                    break;

                case "Address2":
                    retval.Address.Address2 = Helper.ToString(reader[i]);
                    //retval.Address2 = Helper.ToString(reader[i]);
                    break;
                case "City":
                    retval.Address.City = Helper.ToString(reader[i]);
                    //retval.City = Helper.ToString(reader[i]);
                    break;
                case "State":
                    retval.Address.State = Helper.ToString(reader[i]);
                    //retval.State = Helper.ToString(reader[i]);
                    break;
                case "Zip":
                    retval.Address.Zip = Helper.ToString(reader[i]);
                    //retval.Zip = Helper.ToString(reader[i]);
                    break;
                case "PostalCode":
                    retval.Address.Zip = Helper.ToString(reader[i]);
                    //retval.Zip = Helper.ToString(reader[i]);
                    break;
                case "Country":
                    retval.Address.Country = Helper.ToString(reader[i]);
                    //retval.Country = Helper.ToString(reader[i]);
                    break;
                case "Phone":
                    retval.Phone = Helper.ToString(reader[i]);
                    break;
                case "Phone1":
                    retval.Phone = Helper.ToString(reader[i]);
                    break;
                case "Fax":
                    retval.Fax = Helper.ToString(reader[i]);
                    break;
                case "Email":
                    retval.Email = Helper.ToString(reader[i]);
                    break;
                case "Username":
                    retval.Username = Helper.ToString(reader[i]);
                    break;
                case "Password":
                    retval.Password = Helper.ToString(reader[i]);
                    break;
                case "ProspectTypeId":
                    retval.ProspectTypeId = Helper.ToInt32(reader[i]);
                    break;
                case "IsBoardProspect":
                    retval.IsBoardProspect = Helper.ToBoolean(reader[i]);
                    break;
                case "BoardTitle":
                    retval.BoardTitle = Helper.ToString(reader[i]);
                    break;
                case "IsEmailList":
                    retval.IsEmailList = Helper.ToBoolean(reader[i]);
                    break;
                case "IsProspectRep":
                    retval.IsProspectRep = Helper.ToBoolean(reader[i]);
                    break;
                case "Description":
                    retval.Description = Helper.ToString(reader[i]);
                    break;
                case "Comments":
                    retval.Comments = Helper.ToString(reader[i]);
                    break;
                case "IsActive":
                    retval.IsActive = Helper.ToBoolean(reader[i]);
                    break;

                case "OwnerUser":
                    retval.OwnerUser = Helper.ToString(reader[i]);
                    break;
                case "SSN":
                    retval.SSN = Helper.ToString(reader[i]);
                    break;
                case "Birthdate":
                    retval.Birthdate = Helper.ToDateTime(reader[i]);
                    break;

                case "CountryID":
                    retval.CountryID= Helper.ToString(reader[i]);
                    break;
                case "StateID":
                    retval.stateID = Helper.ToString(reader[i]);
                    break;
                    //Ph email
                case "PhoneTypeID":
                    retval.TSWCatalogs.PhoneTypeId = Helper.ToString(reader[i]);
                    break;
                case "EmailTypeID":
                    retval.TSWCatalogs.EmailTypeId = Helper.ToString(reader[i]);
                    break;

                    //-----
                case "SiteID":
                    retval.TSWProspect.SiteID = Helper.ToInt32(reader[i]);
                    break;
                case "SourceID":
                    retval.TSWProspect.ProspectSourceID = Helper.ToInt32(reader[i]);
                    break;
                case "ProspectTypeID":
                    retval.TSWProspect.ProspectTypeID = Helper.ToInt32(reader[i]);
                    break;
                case "ProspectStatusID":
                    retval.TSWProspect.ProspectStatusID = Helper.ToInt32(reader[i]);
                    break;

           }
        }
        return retval;
    }