public EntityFieldDef AddEntityFieldDef(Guid entityDefId, string fieldName, string caption, DataTypes dataType, int length) { if (RequestContext.Current.TenantId == Guid.Empty) { throw new ArgumentNullException("tenantId"); } if (entityDefId == Guid.Empty) { throw new ArgumentNullException("entityDefId"); } if (string.IsNullOrEmpty(fieldName)) { throw new ArgumentNullException("fieldName"); } EntityFieldDef result = null; try { DataModelContext.Initialize(RequestContext.Current.TenantId); result = MetadataLogic.AddEntityFieldDef(entityDefId, fieldName, caption, dataType, length); } finally { DataModelContext.Clear(); } return(result); }
/// <summary> /// Initializes the page. /// </summary> /// <remarks>This method runs on the first load of the page, and does NOT /// run on postbacks. If you want to run a method on PostBacks, override the /// Page_Load event</remarks> protected override void InitializePage() { base.InitializePage(); var individualMetadata = MetadataLogic.DescribeObject(msIndividual.CLASS_NAME); CRMLogic.InitPickList(individualMetadata.Fields.FirstOrDefault(f => f.Name == msIndividual.FIELDS.Prefix), tbPrefix); CRMLogic.InitPickList(individualMetadata.Fields.FirstOrDefault(f => f.Name == msIndividual.FIELDS.Suffix), tbSuffix); setProfileImage(img, targetObject); bindObjectToPage(); }
protected override void InitializeTargetObject() { base.InitializeTargetObject(); targetForm = LoadObjectFromAPI <msCustomObjectPortalForm>(ContextID); if (targetForm == null) { GoToMissingRecordPage(); } string entityID = null; if (ConciergeAPI.CurrentEntity != null) { entityID = ConciergeAPI.CurrentEntity.ID; } using (var api = GetServiceAPIProxy()) targetFormManifest = api.DescribePortalForm(targetForm.ID, entityID).ResultValue; // MS-5922 - only check this on initial load so that it will not fail on completion of creation of last allowed instance if (!IsPostBack) { if (!targetFormManifest.CanCreate) { GoTo("/AccessDenied.aspx"); } } if (ConciergeAPI.CurrentEntity == null && !targetForm.AllowAnonymousSubmissions) // we need them to go through registration { GoTo("~/profile/CreateAccount_BasicInfo.aspx?t=PortalForm&formID=" + targetForm.ID); return; } // ok, so we allow anonymous submissions here // MS-5360 if (string.IsNullOrWhiteSpace(CurrentFormID.Value)) { targetInstance = MetadataLogic.CreateNewObject(targetFormManifest.UnderlyingObjectName); targetInstance["Owner"] = entityID; } else { targetInstance = APIExtensions.LoadObjectFromAPI(CurrentFormID.Value); } }
public EntityDef[] GetEntityDefs() { if (RequestContext.Current.TenantId == Guid.Empty) { throw new ArgumentNullException("tenantId"); } EntityDef[] result = null; try { DataModelContext.Initialize(RequestContext.Current.TenantId); result = MetadataLogic.GetEntityDefs(); } finally { DataModelContext.Clear(); } return(result); }
public void UpdateEntityDef(Guid entityDefId, string caption) { if (RequestContext.Current.TenantId == Guid.Empty) { throw new ArgumentNullException("tenantId"); } if (entityDefId == Guid.Empty) { throw new ArgumentNullException("entityDefId"); } try { DataModelContext.Initialize(RequestContext.Current.TenantId); MetadataLogic.UpdateEntityDef(entityDefId, caption); } finally { DataModelContext.Clear(); } }
public void DeleteEntityFieldDef(Guid fieldDefId) { if (RequestContext.Current.TenantId == Guid.Empty) { throw new ArgumentNullException("tenantId"); } if (fieldDefId == Guid.Empty) { throw new ArgumentNullException("fieldDefId"); } try { DataModelContext.Initialize(RequestContext.Current.TenantId); MetadataLogic.DeleteEntityFieldDef(fieldDefId); } finally { DataModelContext.Clear(); } }
public EntityDef GetEnityDefByName(string name) { if (RequestContext.Current.TenantId == Guid.Empty) { throw new ArgumentNullException("tenantId"); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } EntityDef result = null; try { DataModelContext.Initialize(RequestContext.Current.TenantId); result = MetadataLogic.GetEnityDefByName(name); } finally { DataModelContext.Clear(); } return(result); }
public EntityFieldDef GetFieldDefById(Guid fieldId) { if (RequestContext.Current.TenantId == Guid.Empty) { throw new ArgumentNullException("tenantId"); } if (fieldId == Guid.Empty) { throw new ArgumentNullException("fieldId"); } EntityFieldDef result = null; try { DataModelContext.Initialize(RequestContext.Current.TenantId); result = MetadataLogic.GetFieldDefById(fieldId); } finally { DataModelContext.Clear(); } return(result); }
protected T CreateNewObject <T>() where T : msAggregate, new() { var instance = new T(); return(MetadataLogic.CreateNewObject(instance.ClassType).ConvertTo <T>()); }