Esempio n. 1
0
        /// <summary>
        /// Reads a list of KeywordProducts
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        internal List <dynamic> Read(Keyword_Product_DTO dto)
        {
            var inputParams = new List <ADO_inputParams>();

            if (dto.KprCode != default(int))
            {
                inputParams.Add(new ADO_inputParams {
                    name = "@KprCode", value = dto.KprCode
                });
            }

            if (dto.PrcCode != null)
            {
                inputParams.Add(new ADO_inputParams {
                    name = "@PrcCode", value = dto.PrcCode
                });
            }

            if (dto.SbjCode != default(int))
            {
                inputParams.Add(new ADO_inputParams {
                    name = "@SbjCode", value = dto.SbjCode
                });
            }

            var reader = ado.ExecuteReaderProcedure("System_Navigation_Keyword_Product_Read", inputParams);

            return(reader.data);
        }
        /// <summary>
        /// Deletes a Keyword Product
        /// </summary>
        /// <param name="Ado"></param>
        /// <param name="dto"></param>
        /// <param name="mandatoryOnly"></param>
        /// <returns></returns>
        internal int Delete(ADO Ado, Product_DTO dto, bool?mandatoryOnly = null)
        {
            Keyword_Product_ADO kpAdo = new Keyword_Product_ADO(Ado);
            Keyword_Product_DTO kpDto = new Keyword_Product_DTO();

            kpDto.PrcCode = dto.PrcCode;
            if (mandatoryOnly != null)
            {
                return(kpAdo.Delete(kpDto, mandatoryOnly));
            }
            else
            {
                return(kpAdo.Delete(kpDto));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a Keyword Product from a DTO
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        internal int Create(Keyword_Product_DTO dto)
        {
            if (dto.LngIsoCode != null)
            {
                Keyword_BSO_Extract bse = new Keyword_BSO_Extract(dto.LngIsoCode);
                dto.KprValue = bse.Singularize(dto.KprValue);
            }

            var inputParams = new List <ADO_inputParams>()
            {
                new ADO_inputParams()
                {
                    name = "@KprValue", value = dto.KprValue
                },
                new ADO_inputParams()
                {
                    name = "@PrcCode", value = dto.PrcCode
                },
                new ADO_inputParams()
                {
                    name = "@KprMandatoryFlag", value = dto.KprMandatoryFlag != null? dto.KprMandatoryFlag:false
                },
                new ADO_inputParams()
                {
                    name = "@KprSingularisedFlag", value = dto.LngIsoCode != null
                }
            };

            var returnParam = new ADO_returnParam()
            {
                name = "@ReturnVal", value = 0
            };

            ado.ExecuteNonQueryProcedure("System_Navigation_Keyword_Product_Create", inputParams, ref returnParam);

            return((int)returnParam.value);
        }
Esempio n. 4
0
        /// <summary>
        /// Deletes a KeywordProduct
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="mandatoryOnly"></param>
        /// <returns></returns>
        internal int Delete(Keyword_Product_DTO dto, bool?mandatoryOnly = null)
        {
            var inputParams = new List <ADO_inputParams>();

            if (dto.KprCode != default(int))
            {
                inputParams.Add(new ADO_inputParams()
                {
                    name = "@KprCode", value = dto.KprCode
                });
            }

            if (dto.PrcCode != null)
            {
                inputParams.Add(new ADO_inputParams()
                {
                    name = "@PrcCode", value = dto.PrcCode
                });
            }

            if (mandatoryOnly != null)
            {
                inputParams.Add(new ADO_inputParams()
                {
                    name = "@KprMandatoryFlag", value = mandatoryOnly
                });
            }

            var returnParam = new ADO_returnParam()
            {
                name = "@ReturnVal", value = 0
            };

            ado.ExecuteNonQueryProcedure("System_Navigation_Keyword_Product_Delete", inputParams, ref returnParam);

            return((int)returnParam.value);
        }