コード例 #1
0
        /// <summary>
        /// Creates a Keyword Product
        /// </summary>
        /// <param name="Ado"></param>
        /// <param name="productDto"></param>
        /// <param name="productID"></param>
        internal void Create(ADO Ado, Product_DTO productDto, int productID)
        {
            //If there is no direct means of finding out which langauge the product name uses,
            // we take a default language from the settings
            string LngIsoCode;

            if (productDto.LngIsoCode == null)
            {
                LngIsoCode = Configuration_BSO.GetCustomConfig("language.iso.code");
            }
            else
            {
                LngIsoCode = productDto.LngIsoCode;
            }

            //Create the table that will be bulk inserted
            DataTable dt = new DataTable();

            dt.Columns.Add("KPR_VALUE", typeof(string));
            dt.Columns.Add("KPR_PRC_ID", typeof(int));
            dt.Columns.Add("KPR_MANDATORY_FLAG", typeof(bool));

            Keyword_Product_ADO keywordProductAdo = new Keyword_Product_ADO(Ado);


            //Get a Keyword Extractor - the particular version returned will depend on the language
            Keyword_BSO_Extract kbe = new Navigation.Keyword_BSO_Extract(LngIsoCode);

            AddToTable(ref dt, kbe.ExtractSplitSingular(productDto.PrcValue), productID);

            keywordProductAdo.Create(dt);
        }
コード例 #2
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            var adoKeyword_Product = new Keyword_Product_ADO(Ado);
            var list = adoKeyword_Product.Read(DTO);

            Response.data = list;

            return(true);
        }
コード例 #3
0
        /// <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));
            }
        }
コード例 #4
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            var adoKeyword_Product = new Keyword_Product_ADO(Ado);

            //attempting to delete. The number of entities deleted are passed to the entitiesDeleted variable (this is 1 for a successful delete)
            int nDeleted = adoKeyword_Product.Delete(DTO, false);

            Log.Instance.Debug("Delete operation finished in ADO");

            if (nDeleted == 0)
            {
                Log.Instance.Debug("No record found for delete request");
                Response.error = Label.Get("error.delete");
                return(false);
            }

            Response.data = JSONRPC.success;
            return(true);
        }
コード例 #5
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            var adoKeyword_Product = new Keyword_Product_ADO(Ado);

            //Update and retrieve the number of updated rows
            int nUpdated = adoKeyword_Product.Update(DTO);

            if (nUpdated == 0)
            {
                Log.Instance.Debug("No record found for update request");
                Response.error = Label.Get("error.update");
                return(false);
            }
            else if (nUpdated < 0)
            {
                Response.error = Label.Get("error.duplicate");
            }

            Response.data = JSONRPC.success;
            return(true);
        }
コード例 #6
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            //Validation of parameters and user have been successful. We may now proceed to read from the database
            var adoKeyword_Product = new Keyword_Product_ADO(Ado);

            //Create the Keyword_Product - and retrieve the newly created Id
            int newId = adoKeyword_Product.Create(DTO);

            if (newId == 0)
            {
                Response.error = Label.Get("error.create");
                return(false);
            }
            else if (newId < 0)
            {
                Response.error = Label.Get("error.duplicate");
            }

            Response.data = JSONRPC.success;
            return(true);
        }
コード例 #7
0
        internal void Create(ADO Ado, Product_DTO productDto, int productID)
        {
            //There is no direct means of finding out which langauge the product name uses,
            // so we take a default language from the settings
            string languageCode = Utility.GetCustomConfig("APP_KEYWORD_DEFAULT_LANGUAGE_ISO_CODE");

            //Create the table that will be bulk inserted
            DataTable dt = new DataTable();

            dt.Columns.Add("KPR_VALUE", typeof(string));
            dt.Columns.Add("KPR_PRC_ID", typeof(int));
            dt.Columns.Add("KPR_MANDATORY_FLAG", typeof(bool));

            Keyword_Product_ADO keywordProductAdo = new Keyword_Product_ADO(Ado);


            //Get a Keyword Extractor - the particular version returned will depend on the language
            IKeywordExtractor ext = Keyword_BSO_Extract.GetExtractor(languageCode);

            AddToTable(ref dt, ext.ExtractSplitSingular(productDto.PrcValue), productID);

            keywordProductAdo.Create(dt);
        }