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);
        }
Example #2
0
        public override BUSApplet Init(TContext context)
        {
            BUSApplet businessEntity = base.Init(context);

            businessEntity.DisplayLines = 1;
            return(businessEntity);
        }
Example #3
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);
        }
Example #4
0
        public override UIApplet BusinessToUI(BUSApplet businessEntity)
        {
            UIApplet UIEntity = base.BusinessToUI(businessEntity);

            UIEntity.InitFlag           = businessEntity.Initflag;
            UIEntity.BusCompName        = businessEntity.BusCompName;
            UIEntity.DisplayLines       = businessEntity.DisplayLines.ToString();
            UIEntity.EmptyState         = businessEntity.EmptyState;
            UIEntity.PhysicalRenderName = businessEntity.PhysicalRenderName;
            UIEntity.Header             = businessEntity.Header;
            UIEntity.Type    = businessEntity.Type;
            UIEntity.Virtual = businessEntity.Virtual;
            return(UIEntity);
        }
        public override Applet BusinessToData(Applet applet, BUSApplet businessEntity, TContext context, bool NewRecord)
        {
            Applet dataEntity = base.BusinessToData(applet, businessEntity, context, NewRecord);

            dataEntity.Header           = businessEntity.Header;
            dataEntity.Type             = businessEntity.Type;
            dataEntity.Initflag         = businessEntity.Initflag;
            dataEntity.EmptyState       = businessEntity.EmptyState;
            dataEntity.PhysicalRenderId = businessEntity.PhysicalRenderId;
            dataEntity.DisplayLines     = businessEntity.DisplayLines;
            dataEntity.BusCompId        = businessEntity.BusCompId;
            dataEntity.Routing          = "/api/" + GetPermissibleName(businessEntity.Name) + "/";
            dataEntity.Virtual          = businessEntity.Virtual;
            return(dataEntity);
        }
Example #6
0
        public override IEnumerable <ValidationResult> BUSUIValidate(TContext context, BUSApplet businessComponent, UIApplet UIEntity)
        {
            List <ValidationResult> result = base.BUSUIValidate(context, businessComponent, UIEntity).ToList();

            if (string.IsNullOrWhiteSpace(businessComponent.ErrorMessage))
            {
                if (!string.IsNullOrWhiteSpace(UIEntity.BusCompName) && businessComponent.BusComp == null)
                {
                    result.Add(new ValidationResult(
                                   "Business component with this name not found.",
                                   new List <string>()
                    {
                        "BusCompName"
                    }));
                }

                if (!string.IsNullOrWhiteSpace(UIEntity.PhysicalRenderName) && businessComponent.PhysicalRender == null)
                {
                    result.Add(new ValidationResult(
                                   "Physical render with this name not found.",
                                   new List <string>()
                    {
                        "PhysicalRenderName"
                    }));
                }
            }
            return(result);
        }