/// <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); OrderAuditInfoEntity selectedEntity = (OrderAuditInfoEntity)_OrderAuditInfoDS.EntityCollection[index]; StringBuilder pkFieldsAndValues = new StringBuilder(); pkFieldsAndValues.AppendFormat("&AuditInfoId={0}", selectedEntity.AuditInfoId); switch (e.CommandName) { case "EditExisting": Response.Redirect("~/EditExisting.aspx?EntityType=" + (int)EntityType.OrderAuditInfoEntity + pkFieldsAndValues.ToString()); break; case "ViewExisting": Response.Redirect("~/ViewExisting.aspx?EntityType=" + (int)EntityType.OrderAuditInfoEntity + pkFieldsAndValues.ToString()); break; } }
/// <summary>Creates a new, empty OrderAuditInfoEntity object.</summary> /// <returns>A new, empty OrderAuditInfoEntity object.</returns> public override IEntity Create() { IEntity toReturn = new OrderAuditInfoEntity(); // __LLBLGENPRO_USER_CODE_REGION_START CreateNewOrderAuditInfo // __LLBLGENPRO_USER_CODE_REGION_END return(toReturn); }
protected void Page_Load(object sender, EventArgs e) { if (_filterToUse != null) { using (DataAccessAdapter adapter = new DataAccessAdapter()) { OrderAuditInfoEntity instance = (OrderAuditInfoEntity)adapter.FetchNewEntity(new OrderAuditInfoEntityFactory(), new RelationPredicateBucket(_filterToUse)); if (instance != null) { } } } }
/// <summary> /// Adds one OrderAudit entry to auditInfo entities. /// </summary> /// <param name="orderId">Id of the order affected.</param> /// <param name="actionType">Type of the action.</param> /// <param name="actionData">The action data.</param> private void AddOrderAuditEntryToList(int orderId, AuditType actionType, string actionData) { // create a new audit unit OrderAuditInfoEntity orderAuditInfo = new OrderAuditInfoEntity(); orderAuditInfo.AffectedEntityName = EntityType.OrderEntity.ToString(); orderAuditInfo.ActionDateTime = DateTime.Now; orderAuditInfo.AuditActionTypeId = (int)actionType; orderAuditInfo.UserId = GetCurrentUserID(); orderAuditInfo.ActionData = actionData; // specific for order entities orderAuditInfo.OrderId = orderId; // adds for further DB persist _orderAuditInfoEntities.Add(orderAuditInfo); }
/// <summary> /// Eventhandler for the PerformWork event on the _OrderAuditInfoDS datasourcecontrol /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _OrderAuditInfoDS_PerformWork(object sender, PerformWorkEventArgs2 e) { // as we're using a formview, there's just 1 entity in the UoW. OrderAuditInfoEntity 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 = (OrderAuditInfoEntity)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 = "&AuditInfoId=" + entityToProcess.AuditInfoId; } }