コード例 #1
0
        public ActionResult ForwardtoFriend(string friendname, string friendemailaddress, string message, int id)
        {
            //var email = UserHelper.SpecialistPublicProfileHelper.SpecialPublicProfileComposeForwardToFriendEmail(friendname, friendemailaddress, message, id);
            dynamic email = new Postal.Email("ForwardtoFriend/Multipart");
            var newposter = new PosterHelper(UnitofWork, MembershipService);
            var poster = newposter.GetSendtoFriendPoster(HttpContext.Request.Url);
            email.To = friendemailaddress;
            email.FriendName = friendname;
            email.From = "*****@*****.**";
            email.SenderFirstName = poster.FirstName;
            email.Title = string.Format("Request From {0}", poster.FirstName);
            email.SubTitle = "Request from ";
            email.Message = message;
            email.InvitationNote = " invite you to see this skilled professional.";
            email.FooterNote = "Check out this Professional";
            var uri = HttpContext.Request.Url;
            if (uri != null)
            {
                var host = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port;
                email.ProfileUrl = host + uri.AbsolutePath.Replace("ForwardtoFriend", "");
                var currentSpecialist = UserHelper.SpecialistPublicProfileHelper.GetPublicProfileSpecialistBySpecialistId(id);
                if (currentSpecialist != null)
                {
                    var specialistTitle = currentSpecialist.FirstName + " , " + currentSpecialist.LastName;
                    if (specialistTitle.Length >= 50)
                    {
                        specialistTitle = specialistTitle.Substring(0, 50);
                    }
                    email.CustomTitle = specialistTitle;
                }
                if (currentSpecialist != null)
                {
                    email.PhotoPath = host + "/" + UserHelper.SpecialistPublicProfileHelper.GetSpecialistPrimaryWorkPhoto(id).Replace("../../", "");
                }
            }

            try
            {
               // ViewBag.Email = email;
                ((Postal.Email) email).SendAsync();

               // EmailService.Send(email);
            }
            catch (Exception)
            {
                return RedirectToAction("Index", new { id, sharespecialist = false });
            }
            return RedirectToAction("Index", new { id, sharespecialist = true });
        }
コード例 #2
0
        public CoreUserHelper(IGenericUnitofWork uow, IMembershipService membershipService)
        {
            MembershipService = membershipService;
            UnitofWork = uow;

            #region PrivateProfileHelper
            SpecialistPrivateProfileHelper = new SpecialistPrivateProfileHelper(uow, membershipService, this);
            OwnerPrivateProfileHelper = new OwnerPrivateProfileHelper(uow, membershipService, this);
            AgentPrivateProfileHelper = new AgentPrivateProfileHelper(uow, membershipService, this);
            TenantPrivateProfileHelper = new TenantPrivateProfileHelper(uow, membershipService, this);
            ProviderPrivateProfileHelper = new ProviderPrivateProfileHelper(uow, membershipService, this);
            #region Associated
            ProviderTeamPrivateProfileHelper = new ProviderTeamPrivateProfileHelper(uow, membershipService, this);
            #endregion
            #endregion

            #region PublicProfileHelper
            SpecialistPublicProfileHelper = new SpecialistPublicProfileHelper(uow, membershipService, this);
            OwnerPublicProfileHelper = new OwnerPublicProfileHelper(uow, membershipService);
            AgentPublicProfileHelper = new AgentPublicProfileHelper(uow, membershipService);
            TenantPublicProfileHelper = new TenantPublicProfileHelper(uow, membershipService);
            ProviderPublicProfileHelper = new ProviderPublicProfileHelper(uow, membershipService, this);
            #endregion

            #region Common
            LocationHelper = new LocationHelper(uow, membershipService);
            PosterHelper = new PosterHelper(uow, membershipService);
            UserIdentity = new UserIdentity(uow, membershipService);
            #endregion

            #region Job
            TenantRentalApplicationHelper = new TenantRentalApplicationHelper(uow, membershipService);
            JobOffer = new JobOffer(uow, membershipService);
            #endregion

            #region Unit
            UnitHelper = new UnitHelper(uow, membershipService, this);
            #endregion
        }
コード例 #3
0
        public void InsertComment_When_Poster_Is_Not_Authenticated_Should_Return_DefaultPoster()
        {
            //Act
            Controller.FakeHttpContext();

            //Context
            var actual = Controller.InsertComment(1000, "");

            //Assert
            Assert.IsInstanceOfType(actual, typeof(RedirectToRouteResult));
            var routeResult = actual as RedirectToRouteResult;
            Debug.Assert(routeResult != null, "routeResult != null");
            Assert.AreEqual(routeResult.RouteValues["action"], "Index");
            Assert.AreEqual(1000, routeResult.RouteValues["id"], "Route should map to the id parameter");
            Assert.AreEqual(true, routeResult.RouteValues["insertingnewcomment"], "Route should map to the insertingnewcomment parameter");

            var poster = new PosterHelper(Uow, new FakeMembershipProvider()).GetSendtoFriendPoster(new Uri("http://tempuri.org:80"));
            var defaultInsertedRecord = Uow.SpecialistProfileCommentRepository.
                FindBy(x => x.PosterId == poster.PosterId && x.SpecialistId == 1000);
            Assert.AreEqual(defaultInsertedRecord.First().PosterPhotoPath,
                "../../images/dotimages/single-property/agent-480x350.png");
        }
コード例 #4
0
        public void InsertComment_When_Poster_Is_Authenticated()
        {
            //Act
            Controller.FakeHttpContextWithAuthenticatedUser(LookUpRoles.Roles.Specialist);
            Controller.MockControllerContextForServerMap();

            var actual = Controller.InsertComment(2, "");

            //Assert
            Assert.IsInstanceOfType(actual, typeof(RedirectToRouteResult));
            var routeResult = actual as RedirectToRouteResult;
            Debug.Assert(routeResult != null, "routeResult != null");
            Assert.AreEqual(routeResult.RouteValues["action"], "Index");
            Assert.AreEqual(2, routeResult.RouteValues["id"], "Route should map to the id parameter");
            Assert.AreEqual(true, routeResult.RouteValues["insertingnewcomment"], "Route should map to the insertingnewcomment parameter");

            var poster = new PosterHelper(Uow, new FakeMembershipProvider()).GetSendtoFriendPoster(new Uri("http://tempuri.org:80"));
            var specialistCommentsInserted = Uow.SpecialistProfileCommentRepository.
                                                FindBy(x => x.PosterId == poster.PosterId && x.SpecialistId == 2);
            var specialistProfileComments = specialistCommentsInserted as IList<SpecialistProfileComment> ?? specialistCommentsInserted.ToList();

            if (specialistCommentsInserted != null && specialistProfileComments.Any())
            {
                Assert.AreEqual(specialistProfileComments.First().PosterProfileLink,
                "http://tempuri.org:80/SpecialistProfile/1");
            }
            else
            {
                Debug.Assert(specialistCommentsInserted == null || specialistProfileComments.First() == null, "No Records has been inserted");
                Assert.AreEqual("No- Records has been inserted", "No Records has been inserted");
            }
        }