コード例 #1
0
 public void AddNewPendingSpecialistInvitationToProviderTeam(Specialist specialist, int specialistId, int maintenanceProviderId)
 {
     var teamlist = UnitofWork.MaintenanceTeamAssociationRepository.FindBy(x => x.MaintenanceProviderId == maintenanceProviderId).ToList();
     var teamcount = UnitofWork.MaintenanceTeamAssociationRepository.Count(x => x.MaintenanceProviderId == maintenanceProviderId);
     switch (teamcount)
     {
         //if Provider has no team
         case 0:
             //UI for Creating Team and renaming and deleting Team
             //Redirect to create team
             RedirectToAction("Create", "Team");
             break;
         //If Provider has only 1 team then proceed
         case 1:
             if (ModelState.IsValid)
             {
                 var currentteam = teamlist.First();
                 var npti = new SpecialistPendingTeamInvitation
                 {
                     MaintenanceProviderId = maintenanceProviderId,
                     SpecialistID = specialistId,
                     TeamId = currentteam.TeamId,
                     TeamName = currentteam.TeamName
                 };
                 UnitofWork.SpecialistPendingTeamInvitationRepository.Add(npti);
                 UnitofWork.Save();
             }
             break;
         // Else if Provider has more than 1
         default:
             if (teamcount > 1)
             {
                 RedirectToAction("SelectTeam", "Team");
                 RedirectToAction("SelectTeam", "Team", new { id = specialistId });
             }
             break;
     }
 }
コード例 #2
0
        public Specialist FirstSpecialist()
        {
            var firstSpecialist = new Specialist {

                 SpecialistId = 1
            ,
                 FirstName = null,
                 LastName = null,
                 Address = null,
                 EmailAddress = null,
                 Description = null,
                // GUID = new CustomGuid().CreateGuid("BSNAItOawkSl07t77RKnMjYwYyG4bCt0g8DVDBv5m0")
                 GUID = new Guid("dddddddd-dddd-dddd-1111-dddddddddddd")
            ,
                 VCard = null,
                 Skype = null,
                 Twitter = null,
                 LinkedIn = null,
                 GooglePlus = null,
                 Photo = null,
                 GoogleMap = null,
                 Country = null,
                 Region = null,
                 City = null,
                 Zip = null,
                 CountryCode = null,
                 PercentageofCompletion = new Int32(),
                 Rating = new Int32(),
                 YouTubeVideo = new Boolean(),
                 YouTubeVideoURL = null,
                 VimeoVideo = new Boolean(),
                 VimeoVideoURL = "http://www.specialistVimeo.com",

             };

            return firstSpecialist;
        }
コード例 #3
0
 public void RegisterSpecialist(RegisterModel model)
 {
     var nextspecialistId =
             UnitofWork.SpecialistRepository.All.OrderByDescending(x => x.SpecialistId)
                 .First()
                 .SpecialistId + 1;
     var newspecialist = new Specialist { EmailAddress = model.Email, SpecialistId = nextspecialistId };
     var user = MembershipService.GetUser(model.UserName);
     if (user != null)
     {
         if (user.ProviderUserKey != null) newspecialist.GUID = new Guid(user.ProviderUserKey.ToString());
         newspecialist.FirstName = model.UserName;
         newspecialist.Photo = "./../images/dotimages/avatar-placeholder.png";
         newspecialist.GoogleMap = "USA";
         newspecialist.PercentageofCompletion = 50;
         UnitofWork.SpecialistRepository.Add(newspecialist);
         UnitofWork.Save();
         SpecialistInitialProfileValues(model, newspecialist.SpecialistId);
     }
 }
コード例 #4
0
        public Specialist SecondSpecialist()
        {
            var secondSpecialist = new Specialist {

                 SpecialistId = 2
            ,
                 FirstName = null,
                 LastName = null,
                 Address = null,
                 EmailAddress = null,
                 Description = null,
                 GUID = new CustomGuid().CreateGuid("BSNePf57YwhzeE9QfOyepPfIPao4UD5UohG_fI-#eda7d")
            ,
                 VCard = null,
                 Skype = null,
                 Twitter = null,
                 LinkedIn = null,
                 GooglePlus = null,
                 Photo = null,
                 GoogleMap = null,
                 Country = "USA",
                 Region = null,
                 City = null,
                 Zip = null,
                 CountryCode = null,
                 PercentageofCompletion = new Int32(),
                 Rating = new Int32(),
                 YouTubeVideo = new Boolean(),
                 YouTubeVideoURL = null,
                 VimeoVideo = new Boolean(),
                 VimeoVideoURL = null

             };

            return secondSpecialist;
        }
コード例 #5
0
        public Specialist ThirdSpecialist()
        {
            var thirdSpecialist = new Specialist {

                 SpecialistId = 3
            ,
                 FirstName = null,
                 LastName = null,
                 Address = null,
                 EmailAddress = null,
                 Description = null,
                 GUID = new CustomGuid().CreateGuid("BSNAItOeidr07t77RKnMjYwYyG4bCt0g8DVDBv5m0")
            ,
                 VCard = null,
                 Skype = null,
                 Twitter = null,
                 LinkedIn = null,
                 GooglePlus = null,
                 Photo = null,
                 GoogleMap = null,
                 Country = null,
                 Region = null,
                 City = null,
                 Zip = null,
                 CountryCode = null,
                 PercentageofCompletion = new Int32(),
                 Rating = new Int32(),
                 YouTubeVideo = new Boolean(),
                 YouTubeVideoURL = null,
                 VimeoVideo = new Boolean(),
                 VimeoVideoURL = null

             };

            return thirdSpecialist;
        }
コード例 #6
0
        public void Initialize()
        {
            // Arrange
            #region AccountHelperTest

            #region Repo
            var maintenanceCompanyLookUpRepo = new FakeMaintenanceCompanyLookUpRepository();
            var maintenanceCompanyRepo = new FakeMaintenanceCompanyRepository();
            var maintenanceCompanySpecializationRepo = new FakeMaintenanceCompanySpecializationRepository();
            var maintenanceCustomServicesRepo = new FakeMaintenanceCustomServiceRepository();
            var maintenanceExteriorRepo = new FakeMaintenanceExteriorRepository();
            var maintenanceInteriorRepo = new FakeMaintenanceInteriorRepository();
            var maintenanceNewConstructionRepo = new FakeMaintenanceNewConstructionRepository();
            var maintenanceRepairRepo = new FakeMaintenanceRepairRepository();
            var maintenanceUtilityRepo = new FakeMaintenanceUtilityRepository();

            var currencyRepo = new FakeCurrencyRepository();
            var specialistProfileCommentRepo = new FakeSpecialistProfileCommentRepository();
            var specialistWorkRepo = new FakeSpecialistWorkRepository();
            var agentRepo = new FakeAgentRepository();
            var ownerRepo = new FakeOwnerRepository();
            var specialistRepo = new FakeSpecialistRepository();
            var tenantRepo = new FakeTenantRepository();
            var providerRepo = new FakeMaintenanceProviderRepository();
            Uow = new UnitofWork
            {
                MaintenanceCompanyLookUpRepository = maintenanceCompanyLookUpRepo,
                MaintenanceCompanyRepository = maintenanceCompanyRepo,
                MaintenanceCompanySpecializationRepository = maintenanceCompanySpecializationRepo,
                MaintenanceCustomServiceRepository = maintenanceCustomServicesRepo,
                MaintenanceExteriorRepository = maintenanceExteriorRepo,
                MaintenanceInteriorRepository = maintenanceInteriorRepo,
                MaintenanceNewConstructionRepository = maintenanceNewConstructionRepo,
                MaintenanceRepairRepository = maintenanceRepairRepo,
                MaintenanceUtilityRepository = maintenanceUtilityRepo,
                CurrencyRepository = currencyRepo,
                SpecialistProfileCommentRepository = specialistProfileCommentRepo,
                SpecialistWorkRepository = specialistWorkRepo,
                AgentRepository = agentRepo,
                OwnerRepository = ownerRepo,
                SpecialistRepository = specialistRepo,
                TenantRepository = tenantRepo,
                MaintenanceProviderRepository = providerRepo
            };
            #endregion

            #region Mocking IUserHelper

            #region  AccountHelper UserHelper
            var mockHelper = new Mock<IUserHelper>();
            mockHelper.
                Setup(x => x.UserIdentity).
                Returns(new UserIdentity(Uow, new FakeMembershipProvider()));
            mockHelper.
                Setup(x => x.AgentPrivateProfileHelper).
                Returns(AgentPrivateProfileHelperMock);
            mockHelper.
              Setup(x => x.OwnerPrivateProfileHelper).
              Returns(OwnerPrivateProfileHelperMock);
            mockHelper.
              Setup(x => x.ProviderPrivateProfileHelper).
              Returns(ProviderPrivateProfileHelperMock);
            mockHelper.
              Setup(x => x.SpecialistPrivateProfileHelper).
              Returns(SpecialistPrivateProfileHelperMock);
            mockHelper.
                Setup(x => x.TenantPrivateProfileHelper).
                Returns(TenantPrivateProfileHelperMock);
            #endregion

            #endregion

            #region Mocking MemberShipService
            //MembershipService Optional
            var membershipMock = new Mock<IMembershipService>();
            //var userMock = new Mock<MembershipUser>();
            //var secondSpecialist = professionalRepo.MyList[1];
            //userMock.Setup(u => u.ProviderUserKey).Returns(secondSpecialist.GUID);
            //userMock.Setup(u => u.UserName).Returns(secondSpecialist.FirstName);
            //membershipMock.Setup(s => s.GetUser(It.IsAny<string>())).Returns(userMock.Object);
            #endregion

            #region Controller Construction + Mocking Context

            Controller = new AccountHelper(Uow, membershipMock.Object, mockHelper.Object, new MockEmailService());
            Controller.MockHttpContext();

            #endregion

            #region ExpectedResult Helper
            ExpectedOwner = new ExpectedHelper(Uow).GetExpectedOwner();
            ExpectedAgent = new ExpectedHelper(Uow).GetExpectedAgent();
            ExpectedTenant = new ExpectedHelper(Uow).GetExpectedTenant();
            ExpectedProvider = new ExpectedHelper(Uow).GetExpectedProvider();
            ExpectedSpecialist = new ExpectedHelper(Uow).GetExpectedSpecialist();
            #endregion

            #endregion //AccountHelperTest
        }
コード例 #7
0
 public string SocialTitleBuilding(Specialist s)
 {
     return SpecialistPublicProfileHelper.SocialTitleBuilding(s);
 }
コード例 #8
0
 public CommonSharedSocialLinks ShareSpecialist(Specialist s)
 {
     return SpecialistPublicProfileHelper.ShareSpecialist(s);
 }
コード例 #9
0
 public void AddNewPendingSpecialistInvitationToProviderTeam(Specialist specialist, int specialistId, int maintenanceProviderId)
 {
     ProviderPrivateProfileHelper.AddNewPendingSpecialistInvitationToProviderTeam(specialist, specialistId, maintenanceProviderId);
 }
コード例 #10
0
        public void Initialize()
        {
            // Arrange
            #region AccountHelperTest

            #region Repo
            var maintenanceCompanyLookUpRepo = new FakeMaintenanceCompanyLookUpRepository();
            var maintenanceCompanyRepo = new FakeMaintenanceCompanyRepository();
            var maintenanceCompanySpecializationRepo = new FakeMaintenanceCompanySpecializationRepository();
            var maintenanceCustomServicesRepo = new FakeMaintenanceCustomServiceRepository();
            var maintenanceExteriorRepo = new FakeMaintenanceExteriorRepository();
            var maintenanceInteriorRepo = new FakeMaintenanceInteriorRepository();
            var maintenanceNewConstructionRepo = new FakeMaintenanceNewConstructionRepository();
            var maintenanceRepairRepo = new FakeMaintenanceRepairRepository();
            var maintenanceUtilityRepo = new FakeMaintenanceUtilityRepository();

            var currencyRepo = new FakeCurrencyRepository();
            var specialistProfileCommentRepo = new FakeSpecialistProfileCommentRepository();
            var specialistWorkRepo = new FakeSpecialistWorkRepository();
            var agentRepo = new FakeAgentRepository();
            var ownerRepo = new FakeOwnerRepository();
            var specialistRepo = new FakeSpecialistRepository();
            var tenantRepo = new FakeTenantRepository();
            var providerRepo = new FakeMaintenanceProviderRepository();
            Uow = new UnitofWork
            {
                MaintenanceCompanyLookUpRepository = maintenanceCompanyLookUpRepo,
                MaintenanceCompanyRepository = maintenanceCompanyRepo,
                MaintenanceCompanySpecializationRepository = maintenanceCompanySpecializationRepo,
                MaintenanceCustomServiceRepository = maintenanceCustomServicesRepo,
                MaintenanceExteriorRepository = maintenanceExteriorRepo,
                MaintenanceInteriorRepository = maintenanceInteriorRepo,
                MaintenanceNewConstructionRepository = maintenanceNewConstructionRepo,
                MaintenanceRepairRepository = maintenanceRepairRepo,
                MaintenanceUtilityRepository = maintenanceUtilityRepo,
                CurrencyRepository = currencyRepo,
                SpecialistProfileCommentRepository = specialistProfileCommentRepo,
                SpecialistWorkRepository = specialistWorkRepo,
                AgentRepository = agentRepo,
                OwnerRepository = ownerRepo,
                SpecialistRepository = specialistRepo,
                TenantRepository = tenantRepo,
                MaintenanceProviderRepository = providerRepo
            };
            #endregion

            #region Mocking IUserHelper

            #region  AccountHelper UserHelper
            var mockHelper = new Mock<IUserHelper>();
            mockHelper.
                Setup(x => x.UserIdentity).
                Returns(new UserIdentity(Uow, new FakeMembershipProvider()));
            mockHelper.
                Setup(x => x.AgentPrivateProfileHelper).
                Returns(AgentPrivateProfileHelperMock);
            mockHelper.
              Setup(x => x.OwnerPrivateProfileHelper).
              Returns(OwnerPrivateProfileHelperMock);
            mockHelper.
              Setup(x => x.ProviderPrivateProfileHelper).
              Returns(ProviderPrivateProfileHelperMock);
            mockHelper.
              Setup(x => x.SpecialistPrivateProfileHelper).
              Returns(SpecialistPrivateProfileHelperMock);
            mockHelper.
                Setup(x => x.TenantPrivateProfileHelper).
                Returns(TenantPrivateProfileHelperMock);
            #endregion

            #endregion

            #region Mocking MemberShipService
            var fakeMemberShipService = new FakeMemberShipService();
            #endregion

            #region Controller Construction + Mocking Context

            Controller = new TenantController(Uow, fakeMemberShipService, mockHelper.Object);
            Controller.MockHttpContext();

            #endregion

            #region ExpectedResult Helper
            ExpectedOwner = new ExpectedHelper(Uow).GetExpectedOwner();
            ExpectedAgent = new ExpectedHelper(Uow).GetExpectedAgent();
            ExpectedTenant = new ExpectedHelper(Uow).GetExpectedTenant();
            ExpectedProvider = new ExpectedHelper(Uow).GetExpectedProvider();
            ExpectedSpecialist = new ExpectedHelper(Uow).GetExpectedSpecialist();
            #endregion

            #endregion //AccountHelperTest
        }
コード例 #11
0
        public string SocialTitleBuilding(Specialist s)
        {
            var title = s.FirstName;
            if (title != null)
            {
                title += " , ";
            }

            title += s.LastName;
            if (title.Length >= 1)
            {
                title += " , ";
            }

            title += s.Address;
            if (title.Length >= 1)
            {
                title += " , ";
            }

            title += s.Region;
            if (title.Length >= 1)
            {
                title += " , ";
            }
            title += s.City;
            if (title.Length >= 1)
            {
                title += " , ";
            }

            if (title.Length >= 50)
            {
                title = title.Substring(0, 50);
            }
            return title;
        }
コード例 #12
0
        public CommonSharedSocialLinks ShareSpecialist(Specialist s)
        {
            if (HttpContext.Request == null || HttpContext.Request.Url == null) return null;
            var url = HttpContext.Request.Url.AbsoluteUri.ToString(CultureInfo.InvariantCulture);
            var title = SocialTitleBuilding(s);
            var summary = s.Description;
            if (!String.IsNullOrEmpty(summary))
            {
                if (summary.Length >= 140)
                {
                    summary = summary.Substring(0, 140);
                }
            }
            var tweet = title;
            if (tweet != null && title.Length >= 1)
            {
                tweet += "--";
            }
            tweet += url;
            if (!String.IsNullOrEmpty(tweet))
            {
                if (tweet.Length >= 140)
                {
                    tweet = tweet.Substring(0, 140);
                }
            }

            //TODO UPDATE BEFORE RELEASE
            const string sitename = "http://www.haithem-araissia.com";
            //This is the correct one for production because facebook require active url present. after you Register your domain
            //ViewBag.FaceBook = SocialHelper.FacebookShareOnlyUrl(url);
            //TOD UPDATE BEFORE RELEASE
            return new  CommonSharedSocialLinks
            {
                FaceBook = new SocialHelper().FacebookShareOnlyUrl(sitename),
                Twitter = new SocialHelper().TwitterShare(tweet),
                GooglePlusShare = new SocialHelper().GooglePlusShare(url),
                LinkedIn = new SocialHelper().LinkedInShare(url, title, summary, sitename)
            };
        }