protected override void OnInit(EventArgs e) { try { base.OnInit(e); if (SessionManager.GetSessionValueNoRedirect(this.Page, SessionStrings.ENTITY_MAPPING) == null) { SessionManager.SetSessionValue(this.Page, SessionStrings.ENTITY_MAPPING, EntityUtils.CreateCatalogueMapping()); } } catch (IndException ex) { _ParentGenericUserControl.ReportControlError(ex); return; } catch (Exception ex) { _ParentGenericUserControl.ReportControlError(new IndException(ex)); return; } }
protected override void OnInit(EventArgs e) { try { base.OnInit(e); object connectionManager = SessionManager.GetSessionValueNoRedirect(ParentPage, SessionStrings.CONNECTION_MANAGER); this.Entity.SetSqlConnection(connectionManager); _EditMode = (SessionManager.GetSessionValueNoRedirect(ParentPage, SessionStrings.EDIT_PARAMETERS) != null); if (!_EditMode) { Entity.Id = ApplicationConstants.INT_NULL_VALUE; } else { Dictionary <string, object> editParameters = (Dictionary <string, object>)SessionManager.GetSessionValueNoRedirect((IndPopUpBasePage)this.Page, SessionStrings.EDIT_PARAMETERS); Entity.FillEditParameters(editParameters); } if (SessionManager.GetSessionValueNoRedirect(ParentPage, SessionStrings.ENTITY_MAPPING) == null) { SessionManager.SetSessionValue(ParentPage, SessionStrings.ENTITY_MAPPING, EntityUtils.CreateCatalogueMapping()); } //Get the properties of the entity entityProperties = GetEntityProperties(); //first create the layout CreateControlLayout(); //add custom validators LayoutAddCustomValidators(); //create the dictionary to be used in update operation if (IsPostBack) { CreateControlDictionaryForUpdate(); } //fill embedded entity from database FillEntityDataFromDB(); //populate controls with data from database only if page is not posted back if (!IsPostBack) { PopulateControlsFromEntity(); } } catch (IndException exc) { ShouldContinue = false; _ParentGenericUserControl.ReportControlError(exc); return; } catch (Exception ex) { ShouldContinue = false; _ParentGenericUserControl.ReportControlError(new IndException(ex)); return; } }