/// <summary> /// Job that updates the JobPulse setting with the current date/time. /// This will allow us to notify an admin if the jobs stop running. /// /// Called by the <see cref="IScheduler" /> when a /// <see cref="ITrigger" /> fires that is associated with /// the <see cref="IJob" />. /// </summary> public virtual void Execute(IJobExecutionContext context) { using (new Rock.Data.UnitOfWorkScope()) { AttributeService attribService = new AttributeService(); AttributeValueService attributeValueService = new AttributeValueService(); Rock.Core.Attribute jobPulseAttrib = attribService.GetGlobalAttribute("JobPulse"); Rock.Core.AttributeValue jobPulseAttribValue = jobPulseAttrib.AttributeValues.FirstOrDefault(); // create attribute value if one does not exist if (jobPulseAttribValue == null) { jobPulseAttribValue = new AttributeValue(); jobPulseAttribValue.AttributeId = jobPulseAttrib.Id; attributeValueService.Add(jobPulseAttribValue, null); } // store todays date and time jobPulseAttribValue.Value = DateTime.Now.ToString(); // save attribute attributeValueService.Save(jobPulseAttribValue, null); } }
protected void rGrid_Delete(object sender, RowEventArgs e) { Rock.Core.Attribute attribute = _attributeService.Get(( int )rGrid.DataKeys[e.RowIndex]["id"]); if (attribute != null) { Rock.Web.Cache.Attribute.Flush(attribute.Id); _attributeService.Delete(attribute, CurrentPersonId); _attributeService.Save(attribute, CurrentPersonId); } BindGrid(); }
protected void rGridAttribute_Delete(object sender, RowEventArgs e) { Rock.Core.Attribute attribute = attributeService.Get((int)rGridAttribute.DataKeys[e.RowIndex]["id"]); if (attribute != null) { Rock.Web.Cache.Attribute.Flush(attribute.Id); attributeService.Delete(attribute, CurrentPersonId); attributeService.Save(attribute, CurrentPersonId); } rGridAttribute_Bind(hfTypeId.Value); }
void modalDetails_SaveClick(object sender, EventArgs e) { Rock.Core.Attribute attribute; int attributeId = 0; if (hfId.Value != string.Empty && !Int32.TryParse(hfId.Value, out attributeId)) { attributeId = 0; } if (attributeId == 0) { attribute = new Rock.Core.Attribute(); attribute.System = false; attribute.Entity = _entity; attribute.EntityQualifierColumn = _entityQualifierColumn; attribute.EntityQualifierValue = _entityQualifierValue; _attributeService.Add(attribute, CurrentPersonId); } else { Rock.Web.Cache.Attribute.Flush(attributeId); attribute = _attributeService.Get(attributeId); } attribute.Key = tbKey.Text; attribute.Name = tbName.Text; attribute.Category = tbCategory.Text; attribute.Description = tbDescription.Text; attribute.FieldTypeId = Int32.Parse(ddlFieldType.SelectedValue); attribute.DefaultValue = tbDefaultValue.Text; attribute.MultiValue = cbMultiValue.Checked; attribute.Required = cbRequired.Checked; _attributeService.Save(attribute, CurrentPersonId); BindGrid(); }
void modalDetails_SaveClick( object sender, EventArgs e ) { Rock.Core.Attribute attribute; int attributeId = 0; if ( hfId.Value != string.Empty && !Int32.TryParse( hfId.Value, out attributeId) ) attributeId = 0; if ( attributeId == 0 ) { attribute = new Rock.Core.Attribute(); attribute.System = false; attribute.Entity = _entity; attribute.EntityQualifierColumn = _entityQualifierColumn; attribute.EntityQualifierValue = _entityQualifierValue; _attributeService.Add( attribute, CurrentPersonId ); } else { Rock.Web.Cache.Attribute.Flush( attributeId ); attribute = _attributeService.Get( attributeId ); } attribute.Key = tbKey.Text; attribute.Name = tbName.Text; attribute.Category = tbCategory.Text; attribute.Description = tbDescription.Text; attribute.FieldTypeId = Int32.Parse( ddlFieldType.SelectedValue ); attribute.DefaultValue = tbDefaultValue.Text; attribute.MultiValue = cbMultiValue.Checked; attribute.Required = cbRequired.Checked; _attributeService.Save( attribute, CurrentPersonId ); BindGrid(); }