本文整理汇总了C#中Rock.Web.UI.Controls.RowEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# RowEventArgs类的具体用法?C# RowEventArgs怎么用?C# RowEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RowEventArgs类属于Rock.Web.UI.Controls命名空间,在下文中一共展示了RowEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: gContentChannels_Delete
/// <summary>
/// Handles the Delete event of the gContentChannels control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
protected void gContentChannels_Delete( object sender, RowEventArgs e )
{
var rockContext = new RockContext();
ContentChannelService contentChannelService = new ContentChannelService( rockContext );
ContentChannel contentChannel = contentChannelService.Get( e.RowKeyId );
if ( contentChannel != null )
{
string errorMessage;
if ( !contentChannelService.CanDelete( contentChannel, out errorMessage ) )
{
mdGridWarning.Show( errorMessage, ModalAlertType.Information );
return;
}
contentChannel.ParentContentChannels.Clear();
contentChannel.ChildContentChannels.Clear();
contentChannelService.Delete( contentChannel );
rockContext.SaveChanges();
}
BindGrid();
}
示例2: gGroupType_Delete
/// <summary>
/// Handles the Delete event of the gGroupType control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
protected void gGroupType_Delete( object sender, RowEventArgs e )
{
var rockContext = new RockContext();
GroupTypeService groupTypeService = new GroupTypeService( rockContext );
GroupType groupType = groupTypeService.Get( e.RowKeyId );
if ( groupType != null )
{
int groupTypeId = groupType.Id;
if ( !groupType.IsAuthorized( "Administrate", CurrentPerson ) )
{
mdGridWarning.Show( "Sorry, you're not authorized to delete this group type.", ModalAlertType.Alert );
return;
}
string errorMessage;
if ( !groupTypeService.CanDelete( groupType, out errorMessage ) )
{
mdGridWarning.Show( errorMessage, ModalAlertType.Alert );
return;
}
groupType.ParentGroupTypes.Clear();
groupType.ChildGroupTypes.Clear();
groupTypeService.Delete( groupType );
rockContext.SaveChanges();
GroupTypeCache.Flush( groupTypeId );
}
BindGrid();
}
示例3: gBinaryFile_Delete
/// <summary>
/// Handles the Delete event of the gBinaryFile control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
protected void gBinaryFile_Delete( object sender, RowEventArgs e )
{
var rockContext = new RockContext();
BinaryFileService binaryFileService = new BinaryFileService( rockContext );
BinaryFile binaryFile = binaryFileService.Get( e.RowKeyId );
if ( binaryFile != null )
{
string errorMessage;
if ( !binaryFileService.CanDelete( binaryFile, out errorMessage ) )
{
mdGridWarning.Show( errorMessage, ModalAlertType.Information );
return;
}
Guid guid = binaryFile.Guid;
bool clearDeviceCache = binaryFile.BinaryFileType.Guid.Equals( Rock.SystemGuid.BinaryFiletype.CHECKIN_LABEL.AsGuid() );
binaryFileService.Delete( binaryFile );
rockContext.SaveChanges();
if ( clearDeviceCache )
{
Rock.CheckIn.KioskDevice.FlushAll();
Rock.CheckIn.KioskLabel.Flush( guid );
}
}
BindGrid();
}
示例4: gSignatureDocumentTemplate_Delete
/// <summary>
/// Handles the Delete event of the gSignatureDocumentTemplate control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
protected void gSignatureDocumentTemplate_Delete( object sender, RowEventArgs e )
{
var rockContext = new RockContext();
var signatureDocumentService = new SignatureDocumentService( rockContext );
var signatureDocumentTemplateService = new SignatureDocumentTemplateService( rockContext );
SignatureDocumentTemplate type = signatureDocumentTemplateService.Get( e.RowKeyId );
if ( type != null )
{
if ( !UserCanEdit && !type.IsAuthorized( Authorization.EDIT, CurrentPerson ) )
{
mdGridWarning.Show( "Sorry, you're not authorized to delete this signature document template.", ModalAlertType.Alert );
return;
}
string errorMessage;
if ( !signatureDocumentTemplateService.CanDelete( type, out errorMessage ) )
{
mdGridWarning.Show( errorMessage, ModalAlertType.Information );
return;
}
signatureDocumentTemplateService.Delete( type );
rockContext.SaveChanges();
}
BindGrid();
}
示例5: gSites_Delete
/// <summary>
/// Handles the Delete event of the gSites control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
protected void gSites_Delete( object sender, RowEventArgs e )
{
bool canDelete = false;
var rockContext = new RockContext();
SiteService siteService = new SiteService( rockContext );
Site site = siteService.Get( e.RowKeyId );
if ( site != null )
{
string errorMessage;
canDelete = siteService.CanDelete( site, out errorMessage, includeSecondLvl: true );
if ( !canDelete )
{
mdGridWarning.Show( errorMessage, ModalAlertType.Alert );
return;
}
siteService.Delete( site );
rockContext.SaveChanges();
SiteCache.Flush( site.Id );
}
BindGrid();
}
示例6: gCampuses_Delete
/// <summary>
/// Handles the Delete event of the gCampuses control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
protected void gCampuses_Delete( object sender, RowEventArgs e )
{
var rockContext = new RockContext();
CampusService campusService = new CampusService( rockContext );
Campus campus = campusService.Get( e.RowKeyId );
if ( campus != null )
{
// Don't allow deleting the last campus
if ( !campusService.Queryable().Where( c => c.Id != campus.Id ).Any() )
{
mdGridWarning.Show( campus.Name + " is the only campus and cannot be deleted (Rock requires at least one campus).", ModalAlertType.Information );
return;
}
string errorMessage;
if ( !campusService.CanDelete( campus, out errorMessage ) )
{
mdGridWarning.Show( errorMessage, ModalAlertType.Information );
return;
}
CampusCache.Flush( campus.Id );
campusService.Delete( campus );
rockContext.SaveChanges();
}
BindGrid();
}
示例7: OnClick
/// <summary>
/// Raises the <see cref="E:Click"/> event.
/// </summary>
/// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param>
public virtual void OnClick( RowEventArgs e )
{
if ( Click != null )
{
Click( this, e );
}
}
示例8: rGrid_Delete
protected void rGrid_Delete( object sender, RowEventArgs e )
{
Rock.CMS.Block block = _blockService.Get( ( int )rGrid.DataKeys[e.RowIndex]["id"] );
if ( BlockInstance != null )
{
_blockService.Delete( block, CurrentPersonId );
_blockService.Save( block, CurrentPersonId );
Rock.Web.Cache.Block.Flush( block.Id );
}
BindGrid();
}
示例9: gReport_RowSelected
/// <summary>
/// Handles the RowSelected event of the gReport control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param>
protected void gReport_RowSelected( object sender, RowEventArgs e )
{
string url = GetAttributeValue( "UrlMask" );
if ( !string.IsNullOrWhiteSpace( url ) )
{
foreach ( string key in gReport.DataKeyNames )
{
url = url.Replace( "{" + key + "}", gReport.DataKeys[e.RowIndex][key].ToString() );
}
Response.Redirect( url, false );
}
}
示例10: gEmailTemplates_Delete
/// <summary>
/// Handles the Delete event of the gEmailTemplates control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
protected void gEmailTemplates_Delete( object sender, RowEventArgs e )
{
var rockContext = new RockContext();
SystemEmailService emailTemplateService = new SystemEmailService( rockContext );
SystemEmail emailTemplate = emailTemplateService.Get( (int)gEmailTemplates.DataKeys[e.RowIndex]["id"] );
if ( emailTemplate != null )
{
emailTemplateService.Delete( emailTemplate );
rockContext.SaveChanges();
}
BindGrid();
}
示例11: attendanceDelete_Click
protected void attendanceDelete_Click(object sender, RowEventArgs e)
{
RockContext editContext = new RockContext();
AttendanceService editAttServe = new AttendanceService(editContext);
var attendItem = editAttServe.Queryable().Where(x => x.Id == e.RowKeyId).FirstOrDefault();
if (attendItem.IsAuthorized("Edit", CurrentPerson))
{
attendItem.DidAttend = !attendItem.DidAttend;
attendItem.DidNotOccur = !attendItem.DidAttend;
editContext.SaveChanges();
}
_rockContext = new RockContext();
attendServ = new AttendanceService(_rockContext);
doStuff();
}
示例12: gCompileTheme_Click
/// <summary>
/// Handles the Click event of the gCompileTheme control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param>
protected void gCompileTheme_Click( object sender, RowEventArgs e )
{
var theme = new RockTheme( e.RowKeyValue.ToString() );
string messages = string.Empty;
bool compileSuccess = theme.Compile( out messages );
if ( compileSuccess )
{
mdThemeCompile.Show( "Theme was successfully compiled.", ModalAlertType.Information );
}
else
{
nbMessages.NotificationBoxType = NotificationBoxType.Danger;
nbMessages.Text = string.Format( "An error occurred while compiling the {0} them. Message: {1}", theme.Name, messages );
}
}
示例13: gCalendarItemOccurrenceList_Copy
/// <summary>
/// Handles the Copy event of the gCalendarItemOccurrenceList control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param>
protected void gCalendarItemOccurrenceList_Copy( object sender, RowEventArgs e )
{
using ( RockContext rockContext = new RockContext() )
{
EventItemOccurrenceService eventItemOccurrenceService = new EventItemOccurrenceService( rockContext );
EventItemOccurrence eventItemOccurrence = eventItemOccurrenceService.Get( e.RowKeyId );
if ( eventItemOccurrence != null )
{
var qryParams = new Dictionary<string, string>();
qryParams.Add( "EventCalendarId", PageParameter( "EventCalendarId" ) );
qryParams.Add( "EventItemId", _eventItem.Id.ToString() );
qryParams.Add( "EventItemOccurrenceId", "0" );
qryParams.Add( "CopyFromId", eventItemOccurrence.Id.ToString() );
NavigateToLinkedPage( "DetailPage", qryParams );
}
}
}
示例14: gScheduledJobs_Delete
/// <summary>
/// Handles the Delete event of the grdScheduledJobs control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
protected void gScheduledJobs_Delete( object sender, RowEventArgs e )
{
var rockContext = new RockContext();
var jobService = new ServiceJobService( rockContext );
ServiceJob job = jobService.Get( e.RowKeyId );
string errorMessage;
if ( !jobService.CanDelete( job, out errorMessage ) )
{
mdGridWarning.Show( errorMessage, ModalAlertType.Information );
return;
}
jobService.Delete( job );
rockContext.SaveChanges();
BindGrid();
}
示例15: gBulkLoad_Click
/// <summary>
/// Handles the Click event of the gContentItemBulkLoad control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param>
protected void gBulkLoad_Click( object sender, RowEventArgs e )
{
var entityType = EntityTypeCache.Read( e.RowKeyId );
if (entityType != null )
{
BulkIndexEntityTypeTransaction bulkIndexTransaction = new BulkIndexEntityTypeTransaction();
bulkIndexTransaction.EntityTypeId = entityType.Id;
RockQueue.TransactionQueue.Enqueue( bulkIndexTransaction );
maMessages.Show( string.Format("A request has been sent to index {0}.", entityType.FriendlyName.Pluralize()), ModalAlertType.Information );
}
else
{
maMessages.Show( "An error occurred launching the bulk index request. Could not find the entity type.", ModalAlertType.Alert );
}
}