void IPrivacyPolicyRepository.Add(PrivacyPolicy privacyPolicy) { var MongoDB = _mongoClient.GetDatabase(JsonAccessControlSetting.PrivacyAccessControlDbName); var Collec = MongoDB.GetCollection <PrivacyPolicy>(JsonAccessControlSetting.PrivacyCollectionName); Collec.InsertOneAsync(privacyPolicy); }
public async Task<Response> Insert([FromForm] PrivacyPolicy model) { Response _objResponse = new Response(); try { if (ModelState.IsValid) { _context.Add(model); await _context.SaveChangesAsync(); _objResponse.Status = "Success"; _objResponse.Data = null; } else { _objResponse.Status = "Validation Error"; _objResponse.Data = null; } } catch (Exception ex) { _objResponse.Data = null; _objResponse.Status = ex.ToString(); Console.WriteLine("\nMessage ---\n{0}", ex.ToString()); Console.WriteLine("\nStackTrace ---\n{0}", ex.StackTrace); } return _objResponse; }
public async Task <bool> UpdatePrivacyPolicyAsync(PrivacyPolicy model) { if (model.Id == 0) { PrivacyPolicy privacy = new PrivacyPolicy { Content = model.Content, PubDate = DateTime.Now, IsPublished = model.IsPublished }; await _context.PrivacyPolicies.AddAsync(privacy); } else { PrivacyPolicy privacy = new PrivacyPolicy { Id = model.Id, Content = model.Content, IsPublished = model.IsPublished, LastModified = DateTime.Now }; _context.PrivacyPolicies.Update(privacy); } var updated = await _context.SaveChangesAsync(); return(updated > 0); }
private void PrivacylinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { this.Hide(); PrivacyPolicy privacy = new PrivacyPolicy(); privacy.Show(); }
public void Validate_WhenValid_HasNoErrors() { var mockPickListItem = new PickListItem { Id = 123 }; var mockLookupItem = new LookupItem { Id = Guid.NewGuid() }; var mockPrivacyPolicy = new PrivacyPolicy { Id = Guid.NewGuid() }; var request = new MailingListAddMember() { CandidateId = null, PreferredTeachingSubjectId = mockLookupItem.Id, AcceptedPolicyId = (Guid)mockPrivacyPolicy.Id, ConsiderationJourneyStageId = mockPickListItem.Id, DegreeStatusId = mockPickListItem.Id, Email = "*****@*****.**", FirstName = "John", LastName = "Doe", AddressPostcode = "KY11 9YU", }; var result = _validator.TestValidate(request); // Ensure no validation errors on root object (we expect errors on the Candidate // properties as we can't mock them). var propertiesWithErrors = result.Errors.Select(e => e.PropertyName); propertiesWithErrors.All(p => p.StartsWith("Candidate.")).Should().BeTrue(); }
public List<PrivacyPolicy> Get() { List<PrivacyPolicy> list = null; DataProvider.ExecuteCmd(GetConnection, "dbo.PrivacyPolicy_Select" , inputParamMapper: null , map: delegate (IDataReader reader, short set) { PrivacyPolicy p = new PrivacyPolicy(); int startingIndex = 0; p.Id = reader.GetSafeInt32(startingIndex++); p.ParentId = reader.GetSafeInt32(startingIndex++); p.Title = reader.GetSafeString(startingIndex++); p.Description = reader.GetSafeString(startingIndex++); p.DisplayOrder = reader.GetSafeInt32(startingIndex++); p.CreatedBy = reader.GetSafeString(startingIndex++); p.CreatedDate = reader.GetSafeDateTime(startingIndex++); p.ModifiedBy = reader.GetSafeString(startingIndex++); p.ModifiedDate = reader.GetSafeDateTime(startingIndex++); if (list == null) { list = new List<PrivacyPolicy>(); } list.Add(p); } ); return list; }
public async Task<Response> Update(int id, [FromForm] PrivacyPolicy model) { Response _objResponse = new Response(); try { if (id != model.PrivacyPolicyId) { _objResponse.Status = "No record found"; _objResponse.Data = null; } else { _context.Entry(model).State = EntityState.Modified; await _context.SaveChangesAsync(); _objResponse.Status = "Success"; _objResponse.Data = null; } } catch (Exception ex) { _objResponse.Data = null; _objResponse.Status = ex.ToString(); Console.WriteLine("\nMessage ---\n{0}", ex.ToString()); Console.WriteLine("\nStackTrace ---\n{0}", ex.StackTrace); } return _objResponse; }
public void ShowAdsScreen(int openId) { this.openId = openId; PrivacyPolicyConfiguration privacyPolicyConfiguration = GetPrivacyPolicyConfiguration(); if (privacyPolicyConfiguration == null) { Debug.Log("Privacy Policy Configuration could not be retrieved. Please make sure you have configured properly the text for the privacy policy in the defaultGameConfig.json file."); return; } string deviceLocale = GetLocaleFromSystemLanguage(); bool privacyPolicyTextSet = false; foreach (PrivacyPolicy privacyPolicy in privacyPolicyConfiguration.privacyPolicies) { if (privacyPolicy.locale.Equals(deviceLocale)) { adsTitle = privacyPolicy.ads.title; adsPersonalisedAds = privacyPolicy.ads.personalisedAds; adsDescription = privacyPolicy.ads.description; adsSave = privacyPolicy.ads.save; privacyPolicyTextSet = true; break; } } if (!privacyPolicyTextSet) { PrivacyPolicy englishPrivacyPolicy = getDefaultEnglishPrivacyPolicy(privacyPolicyConfiguration); if (englishPrivacyPolicy != null) { adsTitle = englishPrivacyPolicy.ads.title; adsPersonalisedAds = englishPrivacyPolicy.ads.personalisedAds; adsDescription = englishPrivacyPolicy.ads.description; adsSave = englishPrivacyPolicy.ads.save; } else { adsTitle = ""; adsPersonalisedAds = ""; adsDescription = ""; adsSave = ""; } } AdsTitle.text = adsTitle; AdsPeronalised.isOn = withPersonalisedAds; AdsPeronalised.GetComponentInChildren <Text>().text = adsPersonalisedAds; AdsDescription.text = adsDescription; AdsSaveButton.GetComponentInChildren <Text>().text = adsSave; MainScreen.SetActive(false); SettingsScreen.SetActive(false); InfoScreen.SetActive(false); AdsScreen.SetActive(true); }
public PrivacyPolicy Get(int id) { PrivacyPolicy p = new PrivacyPolicy(); DataProvider.ExecuteCmd(GetConnection, "dbo.PrivacyPolicy_SelectById" , inputParamMapper: delegate (SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Id", id); }, map: delegate (IDataReader reader, short set) { int startingIndex = 0; p.Id = reader.GetSafeInt32(startingIndex++); p.ParentId = reader.GetSafeInt32(startingIndex++); p.DisplayOrder = reader.GetSafeInt32(startingIndex++); p.Title = reader.GetSafeString(startingIndex++); p.Description = reader.GetSafeString(startingIndex++); p.CreatedBy = reader.GetString(startingIndex++); p.CreatedDate = reader.GetSafeDateTime(startingIndex++); p.ModifiedBy = reader.GetString(startingIndex++); p.ModifiedDate = reader.GetDateTime(startingIndex++); } ); return p; }
public ActionResult AddUpdatePrivacyPolicy(PrivacyPolicy model) { if (ModelState.IsValid) { var result = userService.AddUpdatePrivacyPolicyData(model); } return(View()); }
public void ShowMainScreen(int openId) { this.openId = openId; PrivacyPolicyConfiguration privacyPolicyConfiguration = GetPrivacyPolicyConfiguration(); if (privacyPolicyConfiguration == null) { Debug.Log("Privacy Policy Configuration could not be retrieved. Please make sure you have configured properly the text for the privacy policy in the defaultGameConfig.json file."); return; } string deviceLocale = GetLocaleFromSystemLanguage(); bool privacyPolicyTextSet = false; foreach (PrivacyPolicy privacyPolicy in privacyPolicyConfiguration.privacyPolicies) { if (privacyPolicy.locale.Equals(deviceLocale)) { mainDescription = privacyPolicy.main.description; mainAccept = privacyPolicy.main.accept; mainSettings = privacyPolicy.main.settings; privacyPolicyTextSet = true; break; } } if (!privacyPolicyTextSet) { PrivacyPolicy englishPrivacyPolicy = getDefaultEnglishPrivacyPolicy(privacyPolicyConfiguration); if (englishPrivacyPolicy != null) { mainDescription = englishPrivacyPolicy.main.description; mainAccept = englishPrivacyPolicy.main.accept; mainSettings = englishPrivacyPolicy.main.settings; } else { mainDescription = ""; mainAccept = ""; mainSettings = ""; } } MainDescription.text = mainDescription; MainAcceptButton.GetComponentInChildren <Text>().text = mainAccept; MainSettingsButton.GetComponentInChildren <Text>().text = mainSettings; MainAcceptToggle.isOn = false; MainScreen.SetActive(true); SettingsScreen.SetActive(false); InfoScreen.SetActive(false); AdsScreen.SetActive(false); }
private void onSettingsCommand(IUICommand command) { Rect windowBounds = Window.Current.Bounds; settingsPopup = new Popup(); settingsPopup.Closed += settingsPopup_Closed; Window.Current.Activated += Current_Activated; settingsPopup.IsLightDismissEnabled = true; Page settingPage = null; switch (command.Id.ToString()) { case "AU": settingPage = new AboutUs(); break; case "CU": settingPage = new ContactUs(); break; case "PP": settingPage = new PrivacyPolicy(); break; case "TC": settingPage = new TermsAndConditions(); break; } settingsPopup.Width = settingsWidth; settingsPopup.Height = windowBounds.Height; // Add the proper animation for the panel. settingsPopup.ChildTransitions = new TransitionCollection(); settingsPopup.ChildTransitions.Add(new PaneThemeTransition() { Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left }); if (settingPage != null) { settingPage.Width = settingsWidth; settingPage.Height = windowBounds.Height; } // Place the SettingsFlyout inside our Popup window. settingsPopup.Child = settingPage; // Let's define the location of our Popup. settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0); settingsPopup.SetValue(Canvas.TopProperty, 0); settingsPopup.IsOpen = true; }
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) { base.OnBackKeyPress(e); if (PrivacyPolicy.CanGoBack) { PrivacyPolicy.GoBack(); e.Cancel = true; } }
/// <summary> /// Request following users of a user. /// </summary> /// <param name="uid">User id</param> /// <param name="privacyPolicy">The <see cref="PrivacyPolicy" /> options targeting private or public</param> /// <returns> /// The <see cref="FollowingEngine" /> containing following users. /// </returns> /// <exception cref="IllegalPrivatePolicyException"></exception> public IFetchEngine <User> Following(string uid, PrivacyPolicy privacyPolicy) { EnsureNotCancelled(); if (!CheckPrivacyPolicy(uid, privacyPolicy)) { throw new IllegalPrivatePolicyException(uid); } return(new FollowingEngine(this, privacyPolicy, uid, new EngineHandle(CancelInstance))); }
// -------------------------------------------------- // This part contains all APIs that depend on the // IFetchEngine, however, the uniqueness of the inner // elements is not guaranteed, call Distinct() if you // are care about the uniqueness of the results // -------------------------------------------------- /// <summary> /// Request bookmarked illustrations for a user. /// </summary> /// <param name="uid">User id</param> /// <param name="privacyPolicy">The <see cref="PrivacyPolicy" /> options targeting private or public</param> /// <param name="targetFilter">The <see cref="TargetFilter" /> options targeting android or ios</param> /// <returns> /// The <see cref="BookmarkEngine" />> iterator containing bookmarked illustrations for the user. /// </returns> /// <exception cref="IllegalPrivatePolicyException">Requesting other user's private bookmarks will throw this exception.</exception> public IFetchEngine <Illustration> Bookmarks(string uid, PrivacyPolicy privacyPolicy, TargetFilter targetFilter = TargetFilter.ForAndroid) { EnsureNotCancelled(); if (!CheckPrivacyPolicy(uid, privacyPolicy)) { throw new IllegalPrivatePolicyException(uid); } return(new BookmarkEngine(this, uid, privacyPolicy, targetFilter, new EngineHandle(CancelInstance)).Apply(RegisterInstance)); }
/// <summary> /// Creates a <see cref="BookmarkEngine" /> /// </summary> /// <param name="makoClient">The <see cref="MakoClient" /> that owns this object</param> /// <param name="uid">Id of the user</param> /// <param name="privacyPolicy">The privacy option</param> /// <param name="targetFilter">Indicates the target API of the fetch operation</param> /// <param name="engineHandle"></param> public BookmarkEngine( MakoClient makoClient, string uid, PrivacyPolicy privacyPolicy, TargetFilter targetFilter, EngineHandle?engineHandle = null) : base(makoClient, engineHandle) { _uid = uid; _privacyPolicy = privacyPolicy; _targetFilter = targetFilter; }
public IActionResult PrivacyPolicy(PrivacyPolicy policy) { var signedInUserId = Convert.ToInt64(HttpContext.Session.GetString("StudioLoggedInUserId")); policy.DateLastModified = DateTime.Now; policy.LastModifiedBy = signedInUserId; _databaseConnection.Entry(policy).State = EntityState.Modified; _databaseConnection.SaveChanges(); TempData["display"] = "You have successfully modified the Privacy Policy!"; TempData["notificationtype"] = NotificationType.Success.ToString(); return(RedirectToAction("Dashboard", "Home")); }
private static PrivacyPolicy GetPrivacyPolicyMapper(IDataReader reader) { PrivacyPolicy privacyPolicy = new PrivacyPolicy(); int startingIndex = 0; privacyPolicy.Id = reader.GetSafeInt32(startingIndex++); privacyPolicy.Title = reader.GetSafeString(startingIndex++); privacyPolicy.Paragraph = reader.GetSafeString(startingIndex++); privacyPolicy.DateCreated = reader.GetSafeUtcDateTime(startingIndex++); privacyPolicy.DateModified = reader.GetSafeUtcDateTime(startingIndex++); privacyPolicy.UserId = reader.GetSafeInt32(startingIndex++); privacyPolicy.SortOrder = reader.GetSafeInt32(startingIndex++); return(privacyPolicy); }
public void ShowInfoScreen() { PrivacyPolicyConfiguration privacyPolicyConfiguration = GetPrivacyPolicyConfiguration(); if (privacyPolicyConfiguration == null) { Debug.Log("Privacy Policy Configuration could not be retrieved. Please make sure you have configured properly the text for the privacy policy in the defaultGameConfig.json file."); return; } string deviceLocale = GetLocaleFromSystemLanguage(); bool privacyPolicyTextSet = false; foreach (PrivacyPolicy privacyPolicy in privacyPolicyConfiguration.privacyPolicies) { if (privacyPolicy.locale.Equals(deviceLocale)) { infoDescription = privacyPolicy.info.description; infoOk = privacyPolicy.info.ok; privacyPolicyTextSet = true; break; } } if (!privacyPolicyTextSet) { PrivacyPolicy englishPrivacyPolicy = getDefaultEnglishPrivacyPolicy(privacyPolicyConfiguration); if (englishPrivacyPolicy != null) { infoDescription = englishPrivacyPolicy.info.description; infoOk = englishPrivacyPolicy.info.ok; } else { infoDescription = ""; infoOk = ""; } } InfoDescription.text = infoDescription; InfoOkButton.GetComponentInChildren <Text>().text = infoOk; MainScreen.SetActive(false); SettingsScreen.SetActive(false); InfoScreen.SetActive(true); AdsScreen.SetActive(false); }
public async void Get_ReturnsPrivacyPolicy() { var policy = new PrivacyPolicy() { Id = Guid.NewGuid() }; _mockStore.Setup(mock => mock.GetPrivacyPolicyAsync((Guid)policy.Id)).ReturnsAsync(policy); var response = await _controller.Get((Guid)policy.Id); var ok = response.Should().BeOfType <OkObjectResult>().Subject; ok.Value.Should().Be(policy); }
public ActionResult SavePrivacyPolicy(PrivacyPolicy policy) { var adminId = HttpContext.Session.GetInt32("Id"); if (adminId.HasValue) { _context.Entry(policy).State = policy.Id > 0 ? EntityState.Modified : EntityState.Added; _context.SaveChanges(); return(RedirectToAction("AddPrivacyPolicy")); } else { return(RedirectToAction("LogIn", "Admin")); } }
public PrivacyPolicy ReadById(int id) { PrivacyPolicy privacyPolicy = new PrivacyPolicy(); DataProvider.ExecuteCmd("dbo.PrivacyPolicy_SelectById", inputParamMapper: (SqlParameterCollection inputs) => { inputs.AddWithValue("@Id", id); }, singleRecordMapper: (IDataReader reader, short resultSet) => { privacyPolicy = DataMapper <PrivacyPolicy> .Instance.MapToObject(reader); }); return(privacyPolicy); }
private static IEnumerable <PrivacyPolicy> MockPrivacyPolicies() { var policy1 = new PrivacyPolicy() { Id = Guid.NewGuid(), Text = "Policy 1", CreatedAt = DateTime.UtcNow.AddDays(-10) }; var policy2 = new PrivacyPolicy() { Id = Guid.NewGuid(), Text = "Policy 2", CreatedAt = DateTime.UtcNow }; var policy3 = new PrivacyPolicy() { Id = Guid.NewGuid(), Text = "Policy 3", CreatedAt = DateTime.UtcNow.AddDays(-5) }; return(new[] { policy1, policy2, policy3 }); }
public async Task <IActionResult> UpdatePrivacyPolicy(PrivacyPolicy privacyPolicy) { try { if (!ModelState.IsValid) { return(View()); } await _adminService.UpdatePrivacyPolicyAsync(privacyPolicy); return(RedirectToAction("PrivacyPolicy", "Admin").Success_alert("Success", "")); } catch (Exception) { return(RedirectToAction("UpdatePrivacyPolicy", "Admin").Danger_alert("Error", "Something went wrong. Please try again in few moments or contact administrator")); } }
public async Task <ActionResult> UpdatePrivacyPolicy(int id) { var privacyPolicy = await _blogService.GetPrivacyByIdAsync(id); if (privacyPolicy is null) { return(NotFound()); } PrivacyPolicy privacy = new PrivacyPolicy { Id = privacyPolicy.Id, Content = privacyPolicy.Content, IsPublished = privacyPolicy.IsPublished }; return(View(privacy)); }
bool IConditionalExpressionService.IsPrivacyPolicyRelateToContext(PrivacyPolicy policy, JObject user, JObject resource, JObject environment) { if (policy.Target != null) { if (CheckRelativeFunction(policy.Target, user, resource, environment) == true) { return(true); } } foreach (var rule in policy.Rules) { if (CheckRelativeFunction(rule.Condition, user, resource, environment) == true) { return(true); } } return(false); }
public void Validate_WhenValid_HasNoErrors() { var mockPrivacyPolicy = new PrivacyPolicy { Id = Guid.NewGuid() }; _mockStore .Setup(mock => mock.GetPrivacyPolicies()) .Returns(new[] { mockPrivacyPolicy }.AsQueryable()); var policy = new CandidatePrivacyPolicy() { AcceptedPolicyId = (Guid)mockPrivacyPolicy.Id, }; var result = _validator.TestValidate(policy); result.IsValid.Should().BeTrue(); }
public void Create([FromBody] SubPrivacyPolicyInsertCommand command) { bool IsResourceRequired = true; var fieldRules = new List <FieldRule>(); foreach (var rule in command.Rules) { var condition = _conditionalExpressionService.Parse(rule.Condition); var fieldRule = new FieldRule() { Identifer = rule.RuleID, FieldEffects = rule.FieldEffects, Condition = condition }; fieldRules.Add(fieldRule); if (!IsResourceRequired) { IsResourceRequired = rule.Condition.Contains("\"Resource."); } } var policy = new PrivacyPolicy() { CollectionName = command.CollectionName, Description = command.Description, Id = command.PolicyID, Rules = fieldRules, IsAttributeResourceRequired = IsResourceRequired }; _privacyPolicyRepository.Add(policy); var priorty = new PriorityFunction() { Name = command.PolicyID, Priority = command.Priority }; _privacyDomainRepository.AddPriorityFunctions(command.DomainName, priorty); }
public void Create([FromBody] PrivacyPolicyInsertCommand command) { bool IsResourceRequired = false; if (command.Target.Contains("\"Resource.")) { IsResourceRequired = true; } var fieldRules = new List <FieldRule>(); var target = _conditionalExpressionService.Parse(command.Target); foreach (var rule in command.Rules) { var condition = _conditionalExpressionService.Parse(rule.Condition); var fieldRule = new FieldRule() { Identifer = rule.RuleID, FieldEffects = rule.FieldEffects, Condition = condition }; fieldRules.Add(fieldRule); if (!IsResourceRequired) { IsResourceRequired = rule.Condition.Contains("\"Resource."); } } var policy = new PrivacyPolicy() { CollectionName = command.CollectionName, Description = command.Description, PolicyId = command.PolicyID, Rules = fieldRules, IsAttributeResourceRequired = IsResourceRequired, Target = target }; _privacyPolicyRepository.Add(policy); }
public ActionResult PrivacyPolicy() { PrivacyPolicy privacy = new PrivacyPolicy(); privacy = Mapper.Map <PrivacyPolicy>(_newsService.GetPrivacyPolicyAll(HCRGUser != null ? HCRGUser.OrganizationID : (Convert.ToInt32(_encryptionService.DecryptString2(System.Configuration.ConfigurationManager.AppSettings["OrganizationID"]))))); if (privacy != null) { string decodedHTML = HttpUtility.HtmlDecode(privacy.PrivacyPolicyContent); if (decodedHTML != null) { privacy.PrivacyPolicyContent = decodedHTML.Replace(GlobalConst.Message.SlashStoragePath, GlobalConst.Message.StoragePath); privacy.PrivacyPolicyContent = privacy.PrivacyPolicyContent.Replace("/richtexteditor/", GlobalConst.Extension.http + GlobalConst.ConstantChar.Colon + GlobalConst.ConstantChar.ForwardSlash + GlobalConst.ConstantChar.ForwardSlash + Request.Url.Host.ToLower() + GlobalConst.ConstantChar.Colon + Request.Url.Port + "/richtexteditor/"); privacy.PrivacyPolicyContent = privacy.PrivacyPolicyContent.Replace(" ", ""); } else { privacy.PrivacyPolicyContent = decodedHTML; } } return(Json(privacy)); }
/// <summary> /// Create a new PrivacyPolicy object. /// </summary> /// <param name="privacy_ID">Initial value of Privacy_ID.</param> public static PrivacyPolicy CreatePrivacyPolicy(int privacy_ID) { PrivacyPolicy privacyPolicy = new PrivacyPolicy(); privacyPolicy.Privacy_ID = privacy_ID; return privacyPolicy; }
/// <summary> /// There are no comments for PrivacyPolicy in the schema. /// </summary> public void AddToPrivacyPolicy(PrivacyPolicy privacyPolicy) { base.AddObject("PrivacyPolicy", privacyPolicy); }