Exemplo n.º 1
0
        public IHttpActionResult PutEmployeeInfo(string id, ComponentDTO component)
        {
            Response _response = new Response();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != component.Id)
            {
                return(BadRequest());
            }
            try
            {
                _ComponentDTORepo.Update(id, component);
                _response.IsSuccess = true;
                return(Ok <Response>(_response));
            }
            catch (Exception ex)
            {
                _response.IsSuccess    = false;
                _response.ErrorMessage = ex;
                return(InternalServerError(new ApplicationException("Something went wrong in this request. internal exception: " + ex.Message)));
            }
        }
Exemplo n.º 2
0
        private void createTable(ComponentDTO componentDTO)
        {
            string str = componentDTO.InheritedType.GenericType.TokenizeString;

            componentEntity.getInheritedTokenList(componentDTO.InheritedTypeId);

            BLL.BLComponent.updateComponentRender(componentDTO);
        }
Exemplo n.º 3
0
        public string createRenderHTML(ComponentDTO componentDTO, decimal sourcePageContentId)
        {
            string         componentStr          = "";
            GenericTypeDTO genericTypeDTO        = BLL.BLInheritedType.getGenericType(componentDTO.InheritedTypeId);
            List <string>  cmpPlaceHolderList    = Parser.getPlaceHolderList(genericTypeDTO.TokenizeString, Constant.pattern);
            Dictionary <string, string> tokenDic = new Dictionary <string, string>();

            List <ComponentTokenDTO> componentTokenList = BLL.BLComponent.getComponentTokenList(componentDTO.ComponentId);

            foreach (ComponentTokenDTO componentToken in componentTokenList)
            {
                if (!tokenDic.Keys.Contains(componentToken.TokenName))
                {
                    tokenDic[componentToken.TokenName] = componentToken.TokenValue;
                }
            }

            List <InheritedTokenDTO> inheritedTokenList = BLL.BLInheritedToken.getInheritedTokenList(componentDTO.InheritedTypeId);

            foreach (InheritedTokenDTO inheritedToken in inheritedTokenList)
            {
                if (!tokenDic.Keys.Contains(inheritedToken.TokenName))
                {
                    tokenDic[inheritedToken.TokenName] = inheritedToken.TokenValue;
                }
            }

            componentStr = genericTypeDTO.TokenizeString;
            foreach (string cmpPlaceHolder in cmpPlaceHolderList)
            {
                //if (Parser.clean(cmpPlaceHolder) == "ngClick")
                //{
                //componentStr = componentStr.Replace(cmpPlaceHolder, BLL.BLDesign.getNavigationDesign(sourcePageContentId, componentDTO.ComponentId));
                //}

                componentStr = componentStr.Replace("<<<ngClick>>>", "makeDesign_" + componentDTO.ComponentId + "()");

                //DesignDTO designDTO =  BLL.BLComponent.getComponentDesign(componentDTO, sourcePageContentId);
                //if(designDTO.DesignId >0)
                //    componentStr = componentStr.Replace("<<<ngClick>>>", "design_" + designDTO.DesignId + "(this)");

                if (tokenDic.Keys.Contains(Parser.clean(cmpPlaceHolder)))
                {
                    componentStr = componentStr.Replace(cmpPlaceHolder, tokenDic[Parser.clean(cmpPlaceHolder)]);
                }
                else
                {
                    componentStr = componentStr.Replace(cmpPlaceHolder, "");
                }
            }
            componentStr            = Parser.removeUnUsableAttributes(componentStr);
            componentDTO.RenderHTML = componentStr;

            BLL.BLComponent.updateComponentRender(componentDTO);
            return(componentStr);
        }
        public Component Post(ComponentDTO value)
        {
            Component model = new Component()
            {
                ProviderId = value.ProviderId,
                Name       = value.Name,
                Price      = value.Price,
                Quantity   = value.Quantity
            };

            return(IComponentRepository.Create(model));
        }
Exemplo n.º 5
0
        public string renderComponent(ComponentDTO componentDTO, decimal sourcePageContentId)
        {
            string componentStr = "";

            if (componentDTO.RenderHTML == null || componentDTO.RenderHTML == "")
            {
                componentStr = createRenderHTML(componentDTO, sourcePageContentId);
            }
            else
            {
                componentStr = componentDTO.RenderHTML;
            }
            return(componentStr);
        }
Exemplo n.º 6
0
        public void RenderCustomHTML(decimal sourcePageContentId, ComponentDTO componentDTO)
        {
            InheritedTypeDTO inheritedTypeDTO = BLL.BLInheritedType.getInheritedTypeInfo(componentDTO.InheritedTypeId);

            if (inheritedTypeDTO.GenericType.Title == "Table")
            {
                componentDTO.RenderHTML = BLL.BLComponent.createRenderHTML(componentDTO, sourcePageContentId);
                createTable(componentDTO);
            }
            else
            {
                BLL.BLComponent.createRenderHTML(componentDTO, sourcePageContentId);
            }
        }
Exemplo n.º 7
0
        public decimal changeComponentTable(decimal tableBodyId, decimal componentId, decimal sourcePageContentId)
        {
            decimal      tableBodyId1 = tableEntity.changeComponentTable(tableBodyId, componentId);
            ComponentDTO componentDTO = BLL.BLComponent.getComponentInfo(componentId);

            componentDTO.TableBodyId = tableBodyId1;


            TableBodyDTO tableBodyDTO = BLL.BLTable.getTableData(tableBodyId);

            InheritedTypeDTO inheritedTypeDTO = BLL.BLInheritedType.getInheritedTypeInfo(componentDTO.InheritedTypeId);
            GenericTypeDTO   genericTypeDTO   = BLL.BLGenericType.getGenericTypeInfo(inheritedTypeDTO.GenericTypeId);

            BLL.BLComponent.saveComponentRenderHTML(componentDTO.ComponentId, genericTypeDTO.TokenizeString.Replace("<<<tableId>>>", tableBodyDTO.TableBodyId.ToString()));
            return(tableBodyId1);
        }
Exemplo n.º 8
0
        public IHttpActionResult CreateComponentDTO(ComponentDTO ComponentDTO)
        {
            Response _response = new Response();

            try
            {
                var result = _ComponentDTORepo.Insert(ComponentDTO);
                return(Ok(result));
            }
            catch (Exception ex)
            {
                _response.IsSuccess    = false;
                _response.ErrorMessage = ex;
                return(InternalServerError(new ApplicationException("Something went wrong in this request. internal exception: " + ex.Message)));
            }
        }
Exemplo n.º 9
0
        public List <ComponentTokenDTO> getComponentTotalTokenList(decimal componentId, decimal projectId, decimal pageId)
        {
            List <ComponentTokenDTO> tokenList = new List <ComponentTokenDTO>();

            ComponentDTO  componentDTO           = componentEntity.getComponentInfo(componentId);
            string        TokenizeString         = componentDTO.InheritedType.GenericType.TokenizeString;
            List <string> placeHolderList        = Parser.getPlaceHolderList(TokenizeString, Constant.pattern);
            Dictionary <string, string> TokenDic = new Dictionary <string, string>();

            foreach (string placeHolder in placeHolderList)
            {
                if (!TokenDic.Keys.Contains(Parser.clean(placeHolder)) && !Parser.clean(placeHolder).Contains("Page."))
                {
                    TokenDic.Add(Parser.clean(placeHolder), "");
                }
            }

            List <InheritedTokenDTO> inheritedTokenList = componentEntity.getInheritedTokenList(componentDTO.InheritedTypeId);
            List <ComponentTokenDTO> componentTokenList = componentEntity.getComponentTokenList(componentId);

            foreach (KeyValuePair <string, string> tokenNameValue in TokenDic)
            {
                ComponentTokenDTO token = new ComponentTokenDTO();
                token.TokenName   = tokenNameValue.Key;
                token.ComponentId = componentId;
                List <InheritedTokenDTO> inheritedTokenDTO = inheritedTokenList.Where(w => w.TokenName == tokenNameValue.Key).ToList();
                if (inheritedTokenDTO.Count > 0)
                {
                    token.InheritedTokenId    = inheritedTokenDTO.First().InheritedTokenId;
                    token.InheritedTokenValue = inheritedTokenDTO.First().TokenValue;
                    token.InheritedTypeId     = inheritedTokenDTO.First().InheritedTypeId.Value;
                }

                List <ComponentTokenDTO> componentTokenDTO = componentTokenList.Where(w => w.TokenName == tokenNameValue.Key).ToList();
                if (componentTokenDTO.Count > 0)
                {
                    token.InheritedTokenId = componentTokenDTO.First().InheritedTokenId;
                    token.ComponentId      = componentTokenDTO.First().ComponentId;
                    token.ComponentTokenId = componentTokenDTO.First().ComponentTokenId;
                    token.TokenValue       = componentTokenDTO.First().TokenValue;
                    token.Overrided        = true;
                }
                tokenList.Add(token);
            }

            return(tokenList);
        }