public override UIBusinessComponent BusinessToUI(BUSBusinessComponent businessEntity) { UIBusinessComponent UIEntity = base.BusinessToUI(businessEntity); UIEntity.TableName = businessEntity.TableName; UIEntity.ShadowCopy = businessEntity.ShadowCopy; return(UIEntity); }
public override BusinessComponent BusinessToData(BusinessComponent busComp, BUSBusinessComponent businessEntity, TContext context, bool NewRecord) { BusinessComponent dataEntity = base.BusinessToData(busComp, businessEntity, context, NewRecord); dataEntity.Table = businessEntity.Table; dataEntity.TableId = businessEntity.TableId; dataEntity.Routing = "/api/" + GetPermissibleName(businessEntity.Name) + "/"; dataEntity.ShadowCopy = businessEntity.ShadowCopy; return(dataEntity); }
public override BUSBusinessComponent DataToBusiness(BusinessComponent dataEntity, TContext context) { BUSBusinessComponent businessEntity = base.DataToBusiness(dataEntity, context); Table table = context.Tables.AsNoTracking().FirstOrDefault(i => i.Id == dataEntity.TableId); if (table != null) { businessEntity.Table = table; businessEntity.TableId = table.Id; businessEntity.TableName = table.Name; } businessEntity.ShadowCopy = dataEntity.ShadowCopy; return(businessEntity); }
public override BUSBusinessComponent UIToBusiness(UIBusinessComponent UIEntity, TContext context, IViewInfo viewInfo, bool isNewRecord) { BUSBusinessComponent businessEntity = base.UIToBusiness(UIEntity, context, viewInfo, isNewRecord); Table table = context.Tables.AsNoTracking().FirstOrDefault(n => n.Name == UIEntity.TableName); if (table != null) { businessEntity.Table = table; businessEntity.TableId = table.Id; businessEntity.TableName = table.Name; } else { businessEntity.Table = null; businessEntity.TableId = Guid.Empty; } businessEntity.ShadowCopy = UIEntity.ShadowCopy; return(businessEntity); }
public override IEnumerable <ValidationResult> BUSUIValidate(TContext context, BUSBusinessComponent businessComponent, UIBusinessComponent UIEntity) { List <ValidationResult> result = base.BUSUIValidate(context, businessComponent, UIEntity).ToList(); if (string.IsNullOrWhiteSpace(businessComponent.ErrorMessage)) { if (businessComponent.Table == null && !string.IsNullOrWhiteSpace(UIEntity.TableName)) { result.Add(new ValidationResult("Table with this name not found.", new List <string>() { "TableName" })); } } return(result); }