protected virtual void OnUserAction(UserActionEventArgs e, bool createNew) { var actionName = e.ActionName.ToLower(); var actionName2 = Enum.GetName(typeof(ActionNames), ActionNames.Save).ToLower(); if (!actionName.Equals(actionName2, StringComparison.InvariantCulture)) { return; } ChangeToAdminAccount(); if (createNew) { SetDefaultDomainValue(e); } e.ContentView.UpdateContent(); if (e.ContentView.IsUserInputValid && _content.IsValid) { if (createNew && ChecksDuplicatedUser(e)) { WriteDuplactedUserErrorMessage(); RestoreOriginalUser(); return; } SaveUser(e, createNew); } this.RestoreOriginalUser(); }
// Internals //////////////////////////////////////////////////// private void SaveUser(UserActionEventArgs e, bool createNew) { try { if (createNew) { GenerateActivationId(); } if (!Configuration.ActivationEnabled) { EnableAndActivateUser(); } _content.Save(); if (createNew) { AddToSecurityGroups(e); } } catch (InvalidOperationException ex) //logged { Logger.WriteException(ex); //TODO: Biztos, hogy UserAlreadyExists? WriteErrorMessageOnly(HttpContext.GetGlobalResourceObject("PublicRegistrationPortlet", "UserAlreadyExists") as string); } }
private void AddToSecurityGroups(UserActionEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } foreach (var n in Configuration.SecurityGroups) { try { var g = Node.Load <SNC.Group>(n.Id); if (g != null && g.Id != RepositoryConfiguration.EveryoneGroupId) // Only add to a group if it is not an empty group or the everyone group { var u = Node.LoadNode(e.ContentView.ContentHandler.Id) as User; if (u != null) { g.AddMember(u); g.Save(); } } } catch (Exception ee) //logged { Logger.WriteException(ee); } } }
void _cvFormItem_UserAction(object sender, UserActionEventArgs e) { switch (e.ActionName) { case "save": e.ContentView.UpdateContent(); isContentValid = e.ContentView.Content.IsValid && e.ContentView.IsUserInputValid; if (e.ContentView.IsUserInputValid && e.ContentView.Content.IsValid) { try { e.ContentView.Content.Save(); //if(_cvFormItem != null) // _cvFormItem.Controls.Clear(); Controls.Clear(); _formItemID = e.ContentView.Content.Id; BuildAfterSubmitForm(e.ContentView.Content); } catch (FormatException ex) //logged { Logger.WriteException(ex); e.ContentView.ContentException = new FormatException("Invalid format!", ex); } catch (Exception exc) //logged { Logger.WriteException(exc); e.ContentView.ContentException = exc; } } break; } }
protected void cv_UserAction(object sender, UserActionEventArgs e) { if (e.ActionName == "Save") { var contentView = e.ContentView; var content = contentView.Content; contentView.UpdateContent(); if (contentView.IsUserInputValid && content.IsValid) { try { // The whole Inbox feature has been moved to the Content Repository layer: the Save // method of the ContentList type will take care of the workflow and Exchange subscription. content.Save(); CallDone(false); } catch (Exception ex) { Logger.WriteException(ex); contentView.ContentException = ex; } } return; } if (e.ActionName == "Cancel") { CallDone(false); return; } }
protected void cv_UserAction(object sender, UserActionEventArgs e) { if (e.ActionName == "Save") { var contentView = e.ContentView; var content = contentView.Content; contentView.UpdateContent(); if (contentView.IsUserInputValid && content.IsValid) { try { var additionalTypes = new List <string>(); additionalTypes.Add("File"); var option = ((IEnumerable <string>)content["GroupAttachments"]).FirstOrDefault(); if (option != null) { switch (option) { case "subject": case "sender": additionalTypes.Add("Folder"); break; case "email": additionalTypes.Add("Email"); break; } } ((GenericContent)content.ContentHandler).AllowChildTypes(additionalTypes); content.Save(); // remove current workflow RemoveWorkflow(); // start new workflow + subscription if email is given var newEmail = content["ListEmail"] as string; if (!string.IsNullOrEmpty(newEmail)) { StartSubscription(); } CallDone(); } catch (Exception ex) { Logger.WriteException(ex); contentView.ContentException = ex; } } return; } if (e.ActionName == "Cancel") { CallDone(); return; } }
private void Server_MessageReceivedCheck(object sender, UserActionEventArgs e) { if (!_chatService.IsChatExists(e.UserName)) { _userService.Recipient = e.UserName; _chatService.CreateChat(); } }
private void Server_LogInCompleted(object sender, UserActionEventArgs e) { if (_userService.CurrentUser.UserName != e.UserName) { Users.Add(e.UserName); RaisePropertyChanged("Users"); } }
private void Model_UserAction(object sender, UserActionEventArgs e) { if (DrawGuides) { CalculateGuides(e.Actions); Refresh(); } }
protected void ContentView_UserAction_Update(object sender, UserActionEventArgs e) { OnUserAction(e, false); if (e.ContentView.IsUserInputValid && e.ContentView.Content.IsValid) { WriteMessage(Configuration.UpdateProfileSuccessTemplate); } }
void _cvAfterSubmitFormItem_UserAction(object sender, UserActionEventArgs e) { switch (e.ActionName) { case "ok": CreateControls(); break; } }
private void SetDefaultDomainValue(UserActionEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } var domain = Node.LoadNode(Configuration.DefaultDomainPath); e.ContentView.Content.Fields["Domain"].SetData(domain.Name); }
// Receive a action from a user void OnUserAction(UserActionEventArgs userActionArgs) { if (debugLogPrivateMessages) { UnityEngine.Debug.Log("IpcIrc:JohnConnor: PRIVATE ACTION: " + userActionArgs.From + ": " + userActionArgs.Message); } if (debugEchoPrivateMessages) { IpcIrc.Instance.Message("IpcIrc:JohnConnor: PRIVATE ACTION: " + userActionArgs.From + ": " + userActionArgs.Message); } }
public void _contentView_UserAction(object sender, UserActionEventArgs e) { if (e.ActionName == "save") { e.ContentView.UpdateContent(); if (e.ContentView.IsUserInputValid && _content.IsValid) { string t = RepositoryPath.Combine(_content.ContentHandler.ParentPath, _content.Fields["Name"].GetData() as string); //PathInfoRemove: //if (RepositoryPathInfo.GetPathInfo(t) == null) if (NodeHead.Get(t) == null) { _content.Save(); ProcessUserAction(); } else { if (_content.ContentHandler.Id > 0) { _content.Save(); ProcessUserAction(); } else { this._recreateEditContentView = false; this._recreateNewContentView = false; this._displayMode = GetViewModeName(ViewMode.Browse); this._errorMessage = HttpContext.GetGlobalResourceObject("SingleContentPortlet", "ContentNameAlreadyExists") as string; } } } else { this._recreateNewContentView = true; _content.DontSave(); } } else if (e.ActionName == "cancel") { _recreateNewContentView = false; _recreateEditContentView = false; _displayMode = GetViewModeName(ViewMode.Browse); _container.Controls.Clear(); CreateChildControls(); } else { this._recreateNewContentView = false; this._recreateEditContentView = false; _container.Controls.Clear(); } }
protected virtual bool ChecksDuplicatedUser(UserActionEventArgs e) { if (Configuration.IsUniqueEmail) { var query = new NodeQuery(); query.Add(new StringExpression(PropertyType.GetByName("Email"), StringOperator.Equal, (string)e.ContentView.Content.Fields["Email"].GetData())); var result = query.Execute(); return(result.Count > 0 ? true : false); } var path = e.ContentView.Content.ContentHandler.ParentPath; var newUserName = e.ContentView.Content.Fields["Name"].GetData() as string; var t = RepositoryPath.Combine(VirtualPathUtility.AppendTrailingSlash(path), newUserName); return(NodeHead.Get(t) != null); }
public void _contentView_UserAction(object sender, UserActionEventArgs e) { if (e.ActionName == "save") { HandleSave(e.ContentView); } else if (e.ActionName == "cancel") { HandleCancel(); } else { this._recreateNewContentView = false; this._recreateEditContentView = false; _container.Controls.Clear(); } }
private void Server_GameRequested(object sender, UserActionEventArgs e) { _gameRequests.Add(e.UserName); var result = MessageBox.Show($"{e.UserName} requested a game with you, click yes to start game, click no to decline", "Game request", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { _gameRequests.Remove(e.UserName); _serverGame.StartNewGame(_userService.CurrentUser.UserName, e.UserName); } else { _gameRequests.Remove(e.UserName); _serverGame.DeclineGame(e.UserName, _userService.CurrentUser.UserName); } }
void contentView_UserAction(object sender, UserActionEventArgs e) { var contentView = e.ContentView; var content = contentView.Content; switch (e.ActionName) { case "save": OnSave(contentView, content); if (!contentView.IsUserInputValid || !content.IsValid || contentView.ContentException != null) { return; } break; } CallDone(); }
void NewContentViewUserAction(object sender, UserActionEventArgs e) { var contentView = e.ContentView; var content = contentView.Content; contentView.UpdateContent(); var backUrl = PortalContext.Current.BackUrl; if (String.IsNullOrEmpty(backUrl)) { backUrl = PortalContext.Current.RequestedUri.GetLeftPart(UriPartial.Path); } switch (e.ActionName) { case "save": if (contentView.IsUserInputValid && content.IsValid) { try { content.Save(); CallDone(); } catch (Exception ex) //logged { Logger.WriteException(ex); contentView.ContentException = ex; } } break; case "cancel": CurrentState = States[0]; SetControlsByState(); CallDone(); //HttpContext.Current.Response.Redirect(backUrl); break; } }
void VotingItemNewContentViewUserAction(object sender, UserActionEventArgs e) { // If the button's action is not Save if (e.ActionName != "Save") { return; } if (!SecurityHandler.HasPermission(e.ContentView.ContentHandler, PermissionType.AddNew)) { e.ContentView.ContentException = new Exception("You do not have the appropriate permissions to answer this question."); return; } e.ContentView.UpdateContent(); if (e.ContentView.Content.IsValid) { e.ContentView.Content.Save(); Controls.Clear(); ChildControlsCreated = false; _myState = "ThankYouView"; } }
protected void ContentView_UserAction_New(object sender, UserActionEventArgs e) { OnUserAction(e, true); }
private void Model_UpdateActions(object sender, UserActionEventArgs e) { SetGuides(null); Refresh(); }
private void BrowserUserActionRecording(object sender, UserActionEventArgs e) { }
private void BrowserUserActionRecorded(object sender, UserActionEventArgs e) { var userAction = e.UserAction; AddUserActionToGrid(userAction); }
private void BrowserUserActionPlayed(object sender, UserActionEventArgs e) { }
private void Diagram_UpdateActions(object sender, UserActionEventArgs e) { Invalidate(); }
private void Server_LogOutCompleted(object sender, UserActionEventArgs e) { Users.Remove(e.UserName); RaisePropertyChanged("Users"); }
private void Server_GameDeclined(object sender, UserActionEventArgs e) { MessageBox.Show($"{e.UserName} Declined your game request"); _gameRequests.Remove(e.UserName); }
private void model_UpdateActions(object sender, UserActionEventArgs e) { Invalidate(); }