public ActionResult PersonalizationUpdate(DataAccess.Models.ProductDetail.Advisor.AdvisorPersonalizationInfo viewModel)
        {
            if (ModelState.IsValid)
            {
                if (viewModel.LogoUrl != null &&                                               // LogoUrl will be null if logo cannot be edited
                    viewModel.LogoUrl.Equals("REMOVE", StringComparison.OrdinalIgnoreCase))
                {
                    viewModel.LogoUrl = String.Empty;
                }

                var userMasterEntityId          = FederatedLoginClient.User.UserMasterEntityId;
                var deleteCustomPersonalization = viewModel.UseAgencyDefaultPersonalization;
                var success = PersonalizationManager.PersonalizationSet(userMasterEntityId, !deleteCustomPersonalization, viewModel);

                // All we have to do is indicate success or failure.
                // For either, assume the page will respond in the proper manner.
                return(new HttpStatusCodeResult(success ? HttpStatusCode.OK : HttpStatusCode.InternalServerError));
            }
            else
            {
                // Validation error(s) detected on the server side
                var partialView = Personalization(viewModel.AssociatedMasterEntityId, true); // round-trip the incoming model
                Response.StatusCode = (int)HttpStatusCode.PartialContent;                    // same error as used in agency settings validation error
                return(partialView);                                                         // client will replace the existing editing partial with this one
            }
        }
 public void Initialize()
 {
     shimsContext = ShimsContext.Create();
     SetupShims();
     personalizationManager = new PersonalizationManager(new ShimSPWeb());
     privateObject          = new PrivateObject(personalizationManager);
     privateType            = new PrivateType(typeof(PersonalizationManager));
 }
예제 #3
0
        public void TestSetup()
        {
            _mockConsole  = new Mock <IConsoleWrapper>();
            _mockIdentity = new Mock <IWindowsIdentityWrapper>();

            _factoryMock = new Mock <IPersonalizationManagerUtilityFactory>();
            _factoryMock.Setup(x => x.CreateIdentity).Returns(_mockIdentity.Object);
            _factoryMock.Setup(x => x.CreateConsole).Returns(_mockConsole.Object);

            _target = new PersonalizationManager(_factoryMock.Object);
        }
예제 #4
0
        static void Main(string[] args)
        {
            IPersonalizationManagerUtilityFactory factory = new PersonalizationManagerUtilityFactory();
            PersonalizationManager pmanager = new PersonalizationManager(factory);

            bool status = pmanager.SetCredentials("ConsoleApp");

            (string user, SecureString password) = pmanager.GetCredentials("ConsoleApp");

            var targetBstr   = Marshal.SecureStringToBSTR(password);
            var targetString = Marshal.PtrToStringBSTR(targetBstr);
        }