/// <summary> /// Handles the RowCommand event of the theGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewCommandEventArgs"/> instance containing the event data.</param> protected void theGrid_RowCommand(object sender, GridViewCommandEventArgs e) { switch (e.CommandName) { case "EditExisting": case "ViewExisting": break; default: // apparently another command, return return; } int index = Convert.ToInt32(e.CommandArgument); AuditActionTypeEntity selectedEntity = (AuditActionTypeEntity)_AuditActionTypeDS.EntityCollection[index]; StringBuilder pkFieldsAndValues = new StringBuilder(); pkFieldsAndValues.AppendFormat("&AuditActionTypeId={0}", selectedEntity.AuditActionTypeId); switch (e.CommandName) { case "EditExisting": Response.Redirect("~/EditExisting.aspx?EntityType=" + (int)EntityType.AuditActionTypeEntity + pkFieldsAndValues.ToString()); break; case "ViewExisting": Response.Redirect("~/ViewExisting.aspx?EntityType=" + (int)EntityType.AuditActionTypeEntity + pkFieldsAndValues.ToString()); break; } }
/// <summary>Creates a new, empty AuditActionTypeEntity object.</summary> /// <returns>A new, empty AuditActionTypeEntity object.</returns> public override IEntity Create() { IEntity toReturn = new AuditActionTypeEntity(); // __LLBLGENPRO_USER_CODE_REGION_START CreateNewAuditActionType // __LLBLGENPRO_USER_CODE_REGION_END return(toReturn); }
protected void Page_Load(object sender, EventArgs e) { if (_filterToUse != null) { using (DataAccessAdapter adapter = new DataAccessAdapter()) { AuditActionTypeEntity instance = (AuditActionTypeEntity)adapter.FetchNewEntity(new AuditActionTypeEntityFactory(), new RelationPredicateBucket(_filterToUse)); if (instance != null) { } } } }
/// <summary> /// Eventhandler for the PerformWork event on the _AuditActionTypeDS datasourcecontrol /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _AuditActionTypeDS_PerformWork(object sender, PerformWorkEventArgs2 e) { // as we're using a formview, there's just 1 entity in the UoW. AuditActionTypeEntity entityToProcess = null; List <UnitOfWorkElement2> elementsToInsert = e.Uow.GetEntityElementsToInsert(); if (elementsToInsert.Count > 0) { // it's an insert operation. grab the entity so we can determine the PK later on. entityToProcess = (AuditActionTypeEntity)elementsToInsert[0].Entity; } using (DataAccessAdapter adapter = new DataAccessAdapter()) { e.Uow.Commit(adapter, true); } if (entityToProcess != null) { // store the PK values so a redirect can use these. _pkValuesAfterInsert = "&AuditActionTypeId=" + entityToProcess.AuditActionTypeId; } }