protected void btnGroupDelete_Click(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var groupId = e.RowKeyId; RockContext rockContext = new RockContext(); CourseService courseService = new CourseService(rockContext); GroupService groupService = new GroupService(rockContext); var course = GetCourse(courseService); var group = groupService.Get(groupId); if (course.EnrolledGroups.Select(g => g.Id).Contains(groupId)) { course.EnrolledGroups.Remove(course.EnrolledGroups.Where(g => g.Id == groupId).FirstOrDefault()); rockContext.SaveChanges(); } //The async code in the client doesn't play nice with Web Forms ¯\_(ツ)_/¯ Task.Run(() => { var riseClient = new RiseClient(); riseClient.Unenroll(course, group); }); BindGrid(); }
/// <summary> /// Handles the RowSelected event of the gContactList control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param> protected void gContactList_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var queryParams = new Dictionary <string, string>(); queryParams.Add("PersonId", e.RowKeyId.ToString()); NavigateToLinkedPage("PersonProfilePage", queryParams); }
protected void gOAuthClients_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { ClientService clientService = new ClientService(OAuthContext); Client client = clientService.Get(e.RowKeyId); hfClientId.Value = client.Id.ToString(); tbClientName.Text = client.ClientName; tbApiKey.Text = client.ApiKey.ToString(); tbApiSecret.Text = client.ApiSecret.ToString(); tbCallbackUrl.Text = client.CallbackUrl; cbActive.Checked = client.Active; ClientScopeService clientScopeService = new ClientScopeService(OAuthContext); ScopeService scopeService = new ScopeService(OAuthContext); cblClientScopes.DataSource = scopeService.Queryable().Select(s => new { Id = s.Id, Value = s.Identifier + " - " + s.Description }).ToList(); cblClientScopes.DataBind(); clientScopeService.Queryable().Where(cs => cs.ClientId == client.Id).ToList().ForEach(cs => cblClientScopes.Items.FindByValue(cs.ScopeId.ToString()).Selected = cs.Active ); gOAuthClientEdit.Show(); }
/// <summary> /// Handles the RowSelected event of the gItems control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param> protected void gItems_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var queryParams = new Dictionary <string, string>(); queryParams.Add("controllerType", e.RowKeyValue.ToString()); NavigateToLinkedPage("DetailPage", queryParams); }
protected void gSchedules_Delete(object sender, Rock.Web.UI.Controls.RowEventArgs e) { if (Schedules.ContainsKey(e.RowKeyId)) { Schedules.Remove(e.RowKeyId); } BindSchedules(); }
/// <summary> /// Handles the RowSelected event of the gList control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param> protected void gList_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var queueKey = e.RowKeyValue as string; NavigateToLinkedPage(AttributeKey.QueueDetailPage, new Dictionary <string, string> { { PageParameterKey.QueueKey, queueKey } }); }
protected void gLocations_Delete(object sender, Rock.Web.UI.Controls.RowEventArgs e) { if (Locations.ContainsKey(e.RowKeyId)) { Locations.Remove(e.RowKeyId); } BindLocations(); }
protected void gOAuthClientsDelete_Click(object sender, Rock.Web.UI.Controls.RowEventArgs e) { ClientService clientService = new ClientService(OAuthContext); clientService.Delete(clientService.Get(e.RowKeyId)); OAuthContext.SaveChanges(); OAuthContext = new OAuthContext(); gOAuthClients_Bind(sender, e); }
protected void gOAuthScopesDelete_Click(object sender, Rock.Web.UI.Controls.RowEventArgs e) { ScopeService scopeService = new ScopeService(OAuthContext); scopeService.Delete(scopeService.Get(e.RowKeyId)); OAuthContext.SaveChanges(); OAuthContext = new OAuthContext(); gOAuthScopes_Bind(sender, e); }
/// <summary> /// Handles the RowSelected event of the gBindings control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void gBindings_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { mdEditBinding.SaveButtonText = "Save"; mdEditBinding.Title = "Edit Binding"; hfEditBindingIndex.Value = e.RowIndex.ToString(); ShowBinding(BindingsState[e.RowIndex]); mdEditBinding.Show(); }
protected void gOAuthScopes_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { ScopeService scopeService = new ScopeService(OAuthContext); Scope scope = scopeService.Get(e.RowKeyId); hfScopeId.Value = scope.Id.ToString(); tbIdentifier.Text = scope.Identifier; tbDescription.Text = scope.Description; cbScopeActive.Checked = scope.Active; gOAuthScopeEdit.Show(); }
/// <summary> /// Handles the RowSelected event of the gAttendees control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param> protected void gAttendees_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { string personGuid = e.RowKeyValues[0].ToString(); var queryParams = new Dictionary <string, string> { { PageParameterKey.Person, personGuid } }; if (!NavigateToLinkedPage(AttributeKey.PersonPage, queryParams)) { ShowWarningMessage("The 'Person Page' Block Attribute must be defined."); } }
protected void btnDelete_Click(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var id = ( string )e.RowKeyValue; var task = Task.Run(() => { RiseClient riseClient = new RiseClient(); riseClient.DeleteWebhook(id); }); task.Wait(1000 * 10); BindGrid(); }
protected void btnDelete_Click(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var rcId = ( int )e.RowKeyValue; RockContext rockContext = new RockContext(); RecurringCommunicationService recurringCommunicationService = new RecurringCommunicationService(rockContext); var recurringCommunication = recurringCommunicationService.Get(rcId); if (recurringCommunication != null) { recurringCommunicationService.Delete(recurringCommunication); rockContext.SaveChanges(); } BindGrid(); }
/// <summary> /// Handles the RowSelected event of the gTransactionDetails control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param> protected void gTransactionDetails_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { if (!readOnly) { var rockContext = new RockContext(); LoadRelatedImages(new FinancialTransactionService(rockContext).Get(hfIdTransValue.ValueAsInt()).Id); var transactionDetailsId = (int)e.RowKeyValue; hfIdValue.Value = transactionDetailsId.ToString(); var ftd = new FinancialTransactionDetailService(rockContext).Get(transactionDetailsId); ddlTransactionAccount.SelectedValue = ftd.AccountId.ToString(); tbTransactionAmount.Text = ftd.Amount.ToString(); tbTransactionSummary.Text = ftd.Summary; mdDetails.Show(); } }
protected void gHistory_Delete(object sender, Rock.Web.UI.Controls.RowEventArgs e) { using (var rockContext = new RockContext()) { var service = new AttendanceService(rockContext); var attendance = service.Get(e.RowKeyId); if (attendance != null) { service.Delete(attendance); rockContext.SaveChanges(); } } ShowDetail(PageParameter("Person").AsGuid()); }
/// <summary> /// Handles the DataBound event of the lUnmatchedPerson control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param> protected void lUnmatchedPerson_DataBound(object sender, Rock.Web.UI.Controls.RowEventArgs e) { Literal lPhoneNumberDisplay = sender as Literal; var person = e.Row.DataItem as Person; if (person != null) { var phoneNumbers = person.PhoneNumbers.Select(a => a.NumberFormatted).ToList(); if (phoneNumbers.Any()) { lPhoneNumberDisplay.Text = string.Format("{0} (Unknown Person)", phoneNumbers.AsDelimited(",")); } else { lPhoneNumberDisplay.Text = "Unknown Person"; } } }
/// <summary> /// Handles the user clicking the delete button in the gAttendees control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void gAttendeesDelete_Click(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var rockContext = new RockContext(); var attendanceService = new AttendanceService(rockContext); var attendance = attendanceService.Get(e.RowKeyId); attendance.DidAttend = false; rockContext.SaveChanges(); if (attendance.LocationId != null) { Rock.CheckIn.KioskLocationAttendance.Flush(attendance.LocationId.Value); } nbAttended.Text = string.Format("{0} has been removed from attendance.", attendance.PersonAlias.Person.FullName); BindAttendees(); }
/// <summary> /// Handles the Delete event of the gContactList control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param> protected void gContactList_Delete(object sender, Rock.Web.UI.Controls.RowEventArgs e) { int?businessId = hfBusinessId.Value.AsIntegerOrNull(); if (businessId.HasValue) { var businessContactId = e.RowKeyId; var rockContext = new RockContext(); var groupMemberService = new GroupMemberService(rockContext); Guid businessContact = Rock.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_BUSINESS_CONTACT.AsGuid(); Guid business = Rock.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_BUSINESS.AsGuid(); Guid ownerGuid = Rock.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_OWNER.AsGuid(); foreach (var groupMember in groupMemberService.Queryable() .Where(m => ( // The contact person in the business's known relationships m.PersonId == businessContactId && m.GroupRole.Guid.Equals(businessContact) && m.Group.Members.Any(o => o.PersonId == businessId && o.GroupRole.Guid.Equals(ownerGuid)) ) || ( // The business in the person's know relationships m.PersonId == businessId && m.GroupRole.Guid.Equals(business) && m.Group.Members.Any(o => o.PersonId == businessContactId && o.GroupRole.Guid.Equals(ownerGuid)) ) )) { groupMemberService.Delete(groupMember); } rockContext.SaveChanges(); BindContactListGrid(new PersonService(rockContext).Get(businessId.Value)); } }
/// <summary> /// Handles the Click event of the btnLinkToPerson control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param> protected void btnLinkToPerson_Click(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var selectedPersonId = e.RowKeyId; hfNamelessPersonId.Value = selectedPersonId.ToString(); var person = new PersonService(new RockContext()).Get(selectedPersonId); var title = "Link Nameless Person"; var phoneNumbers = person.PhoneNumbers.Select(a => a.NumberFormatted).ToList(); if (phoneNumbers.Any()) { title = string.Format("Link Phone Numbers {0} To Person ", phoneNumbers.AsDelimited(",")); } mdLinkToPerson.Title = title; ppPerson.SetValue(null); newPersonEditor.SetFromPerson(null); mdLinkToPerson.Show(); }
/// <summary> /// Handles the Delete event of the gContactList control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param> protected void gContactList_Delete(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var rockContext = new RockContext(); var personService = new PersonService(rockContext); var business = personService.Get(int.Parse(hfBusinessId.Value)); int?businessContactRoleId = new GroupTypeRoleService(rockContext).Queryable() .Where(r => r.Guid.Equals(new Guid(Rock.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_BUSINESS_CONTACT))) .Select(r => r.Id) .FirstOrDefault(); var groupMemberService = new GroupMemberService(rockContext); var groupMember = business.GivingGroup.Members.Where(role => role.GroupRoleId == businessContactRoleId && role.PersonId == e.RowKeyId).FirstOrDefault(); if (groupMember != null) { groupMemberService.Delete(groupMember); rockContext.SaveChanges(); } BindContactListGrid(business); }
protected void gRecords_CheckedChanged(object sender, Rock.Web.UI.Controls.RowEventArgs e) { //Only change value if user edit if (IsUserAuthorized(Rock.Security.Authorization.EDIT)) { RockContext rockContext = new RockContext(); ChangeRecordService changeRecordService = new ChangeRecordService(rockContext); var changeRecord = changeRecordService.Get(e.RowKeyId); if (changeRecord != null) { if (changeRecord.IsRejected) { changeRecord.IsRejected = false; } else { changeRecord.IsRejected = true; } } rockContext.SaveChanges(); } BindGrid(); }
/// <summary> /// Handles the Delete event of the gTransactionDetails control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param> protected void gTransactionDetails_Delete(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var rockContext = new RockContext(); var ftdService = new FinancialTransactionDetailService(rockContext); var ftd = ftdService.Get(e.RowKeyId); if (ftd != null) { string errorMessage; if (!ftdService.CanDelete(ftd, out errorMessage)) { maGridWarning.Show(errorMessage, Rock.Web.UI.Controls.ModalAlertType.Information); return; } ftdService.Delete(ftd); rockContext.SaveChanges(); } FinancialTransaction transaction = new FinancialTransaction(); transaction = new FinancialTransactionService(rockContext).Get(hfIdTransValue.ValueAsInt()); BindTransactionDetailGrid(transaction); }
protected void gGroups_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { NavigateToLinkedPage("PublishGroupDetailPage", new Dictionary <string, string> { { "PublishGroupId", e.RowKeyValue.ToString() } }); }
/// <summary> /// Handles the Delete event of the gBindings control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void gBindings_Delete(object sender, Rock.Web.UI.Controls.RowEventArgs e) { BindingsState.RemoveAt(e.RowIndex); GridBind(); }
protected void gGrid_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { var personAliasGuid = (( Guid )e.RowKeyValue).ToString(); NavigateToWorkflow(personAliasGuid); }
protected void gCommunication_Delete(object sender, Rock.Web.UI.Controls.RowEventArgs e) { }
protected void gRC_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { NavigateToLinkedPage(AttributeKeys.DetailsPage, new Dictionary <string, string> { { "RecurringCommunicationId", e.RowKeyId.ToString() } }); }
protected void gRequests_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { NavigateToLinkedPage("DetailsPage", new Dictionary <string, string> { { "ChangeRequest", e.RowKeyId.ToString() } }); }
/// <summary> /// Handles the RowSelected event of the gCommunicationQueue control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs" /> instance containing the event data.</param> protected void gCommunicationQueue_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { NavigateToLinkedPage("DetailPage", "CommunicationId", e.RowKeyId); }