public override BUSApplet DataToBusiness(Applet dataEntity, TContext context)
        {
            BUSApplet      businessEntity = base.DataToBusiness(dataEntity, context);
            PhysicalRender physicalRender = context.PhysicalRenders.AsNoTracking().FirstOrDefault(i => i.Id == dataEntity.PhysicalRenderId);

            if (physicalRender != null)
            {
                businessEntity.PhysicalRender     = physicalRender;
                businessEntity.PhysicalRenderId   = physicalRender.Id;
                businessEntity.PhysicalRenderName = physicalRender.Name;
            }
            BusinessComponent busComp = context.BusinessComponents.AsNoTracking().FirstOrDefault(i => i.Id == dataEntity.BusCompId);

            if (busComp != null)
            {
                businessEntity.BusComp     = busComp;
                businessEntity.BusCompId   = busComp.Id;
                businessEntity.BusCompName = busComp.Name;
            }

            businessEntity.Virtual      = dataEntity.Virtual;
            businessEntity.Header       = dataEntity.Header;
            businessEntity.Type         = dataEntity.Type;
            businessEntity.EmptyState   = dataEntity.EmptyState;
            businessEntity.DisplayLines = dataEntity.DisplayLines;
            businessEntity.Initflag     = dataEntity.Initflag;
            return(businessEntity);
        }
예제 #2
0
        public override BUSApplet UIToBusiness(UIApplet UIEntity, TContext context, IViewInfo viewInfo, bool isNewRecord)
        {
            BUSApplet businessEntity = base.UIToBusiness(UIEntity, context, viewInfo, isNewRecord);

            // BusComp
            BusinessComponent busComp = context.BusinessComponents.AsNoTracking().FirstOrDefault(n => n.Name == UIEntity.BusCompName);

            if (busComp != null)
            {
                businessEntity.BusComp     = busComp;
                businessEntity.BusCompId   = busComp.Id;
                businessEntity.BusCompName = busComp.Name;
            }

            // PhysicalRender
            PhysicalRender PR = context.PhysicalRenders.FirstOrDefault(n => n.Name == UIEntity.PhysicalRenderName);

            if (PR != null)
            {
                businessEntity.PhysicalRender     = PR;
                businessEntity.PhysicalRenderId   = PR.Id;
                businessEntity.PhysicalRenderName = PR.Name;
            }

            businessEntity.Virtual      = UIEntity.Virtual;
            businessEntity.Header       = UIEntity.Header;
            businessEntity.Type         = UIEntity.Type;
            businessEntity.Initflag     = UIEntity.InitFlag;
            businessEntity.DisplayLines = Convert.ToInt32(UIEntity.DisplayLines);
            businessEntity.EmptyState   = UIEntity.EmptyState;
            return(businessEntity);
        }
예제 #3
0
        public override IEnumerable <ValidationResult> UIValidate(TContext context, IViewInfo viewInfo, UIPhysicalRender UIEntity, bool isNewRecord)
        {
            List <ValidationResult> result         = base.UIValidate(context, viewInfo, UIEntity, isNewRecord).ToList();
            PhysicalRender          physicalRender = context.PhysicalRenders.AsNoTracking().FirstOrDefault(n => n.Name == UIEntity.Name);

            if (physicalRender != null && physicalRender.Id != UIEntity.Id)
            {
                result.Add(new ValidationResult("Physical render with this name is already exists.", new List <string>()
                {
                    "Name"
                }));
            }
            return(result);
        }