예제 #1
0
        public static FriendViewList CreateFriendViewListFromAppUserEditView(ApplicationDbContext db, Guid appUserId, string url)
        {
            List <FriendView> userFriendListView        = FriendViewHelpers.GetFriendViewByType(db, appUserId, LevelEnum.User);
            List <FriendView> userBranchFriendListView  = FriendViewHelpers.GetFriendViewByType(db, appUserId, LevelEnum.Branch);
            List <FriendView> userCompanyFriendListView = FriendViewHelpers.GetFriendViewByType(db, appUserId, LevelEnum.Company);

            FriendViewList list = new FriendViewList()
            {
                UserFriendListView        = userFriendListView,
                UserBranchFriendListView  = userBranchFriendListView,
                UserCompanyFriendListView = userCompanyFriendListView,
                CallingUrl = url
            };

            return(list);
        }
예제 #2
0
        public static AppUserEditView GetAppUserEditViewForUser(ApplicationDbContext db, AppUser appUserDetails)
        {
            Branch     branch     = BranchHelpers.GetBranch(db, appUserDetails.CurrentBranchId);
            BranchUser branchUser = BranchUserHelpers.GetBranchUser(db, appUserDetails.AppUserId, appUserDetails.CurrentBranchId);

            AppUserSettings appUserSettings = AppUserSettingsHelpers.GetAppUserSettingsForUser(db, appUserDetails.AppUserId);

            AppUserEditView view = new AppUserEditView()
            {
                AppUserId                                           = appUserDetails.AppUserId,
                FirstName                                           = appUserDetails.FirstName,
                LastName                                            = appUserDetails.LastName,
                EntityStatus                                        = appUserDetails.EntityStatus,
                PrivacyLevel                                        = appUserDetails.PrivacyLevel,
                SelectedBranchId                                    = appUserDetails.CurrentBranchId,
                UserRole                                            = branchUser.UserRole,
                AppUserSettingsId                                   = appUserSettings.AppUserSettingsId,
                BranchName                                          = branch.BranchName,
                BranchBusinessType                                  = branch.BusinessType,
                BranchAddressLine1                                  = branch.AddressLine1,
                BranchAddressLine2                                  = branch.AddressLine2,
                BranchAddressLine3                                  = branch.AddressLine3,
                BranchAddressTownCity                               = branch.AddressTownCity,
                BranchAddressCounty                                 = branch.AddressCounty,
                BranchAddressPostcode                               = branch.AddressPostcode,
                CampaignDashboardMaxDistance                        = appUserSettings.CampaignDashboardMaxDistance,
                CampaignDashboardMaxAge                             = appUserSettings.CampaignDashboardMaxAge,
                RequiredListingDashboardMaxDistance                 = appUserSettings.RequiredListingDashboardMaxDistance,
                RequiredListingDashboardMaxAge                      = appUserSettings.RequiredListingDashboardMaxAge,
                AvailableListingDashboardMaxDistance                = appUserSettings.AvailableListingDashboardMaxDistance,
                AvailableListingDashboardMaxAge                     = appUserSettings.AvailableListingDashboardMaxAge,
                CampaignDashboardExternalSelectionLevel             = appUserSettings.CampaignDashboardExternalSelectionLevel,
                RequiredListingDashboardExternalSelectionLevel      = appUserSettings.RequiredListingDashboardExternalSelectionLevel,
                AvailableListingDashboardExternalSelectionLevel     = appUserSettings.AvailableListingDashboardExternalSelectionLevel,
                CampaignGeneralInfoDisplayMyUserListings            = appUserSettings.CampaignGeneralInfoDisplayMyUserListings,
                CampaignGeneralInfoDisplayMyBranchListings          = appUserSettings.CampaignGeneralInfoDisplayMyBranchListings,
                CampaignGeneralInfoDisplayMyCompanyListings         = appUserSettings.CampaignGeneralInfoDisplayMyCompanyListings,
                CampaignGeneralInfoDisplayBlockedListings           = appUserSettings.CampaignGeneralInfoDisplayBlockedListings,
                CampaignGeneralInfoMaxDistance                      = appUserSettings.CampaignGeneralInfoMaxDistance,
                RequiredListingGeneralInfoDisplayMyUserListings     = appUserSettings.RequiredListingGeneralInfoDisplayMyUserListings,
                RequiredListingGeneralInfoDisplayMyBranchListings   = appUserSettings.RequiredListingGeneralInfoDisplayMyBranchListings,
                RequiredListingGeneralInfoDisplayMyCompanyListings  = appUserSettings.RequiredListingGeneralInfoDisplayMyCompanyListings,
                RequiredListingGeneralInfoDisplayBlockedListings    = appUserSettings.RequiredListingGeneralInfoDisplayBlockedListings,
                RequiredListingGeneralInfoMaxDistance               = appUserSettings.RequiredListingGeneralInfoMaxDistance,
                AvailableListingGeneralInfoDisplayMyUserListings    = appUserSettings.AvailableListingGeneralInfoDisplayMyUserListings,
                AvailableListingGeneralInfoDisplayMyBranchListings  = appUserSettings.AvailableListingGeneralInfoDisplayMyBranchListings,
                AvailableListingGeneralInfoDisplayMyCompanyListings = appUserSettings.AvailableListingGeneralInfoDisplayMyCompanyListings,
                AvailableListingGeneralInfoDisplayBlockedListings   = appUserSettings.AvailableListingGeneralInfoDisplayBlockedListings,
                AvailableListingGeneralInfoMaxDistance              = appUserSettings.AvailableListingGeneralInfoMaxDistance,
                CampaignManageViewInternalSelectionLevel            = appUserSettings.CampaignManageViewInternalSelectionLevel,
                RequiredListingManageViewInternalSelectionLevel     = appUserSettings.RequiredListingManageViewInternalSelectionLevel,
                AvailableListingManageViewInternalSelectionLevel    = appUserSettings.AvailableListingManageViewInternalSelectionLevel,
                OffersManageViewInternalSelectionLevel              = appUserSettings.OffersManageViewInternalSelectionLevel,
                OffersAcceptedAuthorisationManageViewLevel          = appUserSettings.OffersAcceptedAuthorisationManageViewLevel,
                OffersRejectedAuthorisationManageViewLevel          = appUserSettings.OffersRejectedAuthorisationManageViewLevel,
                OffersReturnedAuthorisationManageViewLevel          = appUserSettings.OffersReturnedAuthorisationManageViewLevel,
                OrdersManageViewInternalSelectionLevel              = appUserSettings.OrdersManageViewInternalSelectionLevel,
                OrdersDespatchedAuthorisationManageViewLevel        = appUserSettings.OrdersDespatchedAuthorisationManageViewLevel,
                OrdersDeliveredAuthorisationManageViewLevel         = appUserSettings.OrdersDeliveredAuthorisationManageViewLevel,
                OrdersCollectedAuthorisationManageViewLevel         = appUserSettings.OrdersCollectedAuthorisationManageViewLevel,
                OrdersClosedAuthorisationManageViewLevel            = appUserSettings.OrdersClosedAuthorisationManageViewLevel,
                CampaignGeneralInfoExternalSelectionLevel           = appUserSettings.CampaignGeneralInfoExternalSelectionLevel,
                RequiredListingGeneralInfoExternalSelectionLevel    = appUserSettings.RequiredListingGeneralInfoExternalSelectionLevel,
                AvailableListingGeneralInfoExternalSelectionLevel   = appUserSettings.AvailableListingGeneralInfoExternalSelectionLevel,
                GroupListViewsForUserOnly                           = GroupViewHelpers.GetGroupEditViewForForUserOnly(db, appUserDetails.AppUserId),
                UserFriendListView                                  = FriendViewHelpers.GetFriendViewByType(db, appUserDetails.AppUserId, LevelEnum.User),
                UserBranchFriendListView                            = FriendViewHelpers.GetFriendViewByType(db, appUserDetails.AppUserId, LevelEnum.Branch),
                UserCompanyFriendListView                           = FriendViewHelpers.GetFriendViewByType(db, appUserDetails.AppUserId, LevelEnum.Company),
                UserBlockListView                                   = BlockViewHelpers.GetBlockViewByType(db, appUserDetails.AppUserId, LevelEnum.User),
                UserBranchBlockListView                             = BlockViewHelpers.GetBlockViewByType(db, appUserDetails.AppUserId, LevelEnum.Branch),
                UserCompanyBlockListView                            = BlockViewHelpers.GetBlockViewByType(db, appUserDetails.AppUserId, LevelEnum.Company)
            };

            return(view);
        }