/// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            var adoKeyword_Subject = new Keyword_Subject_ADO(Ado);
            var list = adoKeyword_Subject.Read(DTO);

            Response.data = list;

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Deletes a Keyword subject
        /// </summary>
        /// <param name="Ado"></param>
        /// <param name="subjectDto"></param>
        /// <param name="mandatoryOnly"></param>
        /// <returns></returns>
        internal int Delete(ADO Ado, Subject_DTO subjectDto, bool?mandatoryOnly = null)
        {
            Keyword_Subject_ADO ksAdo = new Keyword_Subject_ADO(Ado);
            Keyword_Subject_DTO ksDto = new Keyword_Subject_DTO();

            ksDto.SbjCode = subjectDto.SbjCode;
            if (mandatoryOnly != null)
            {
                return(ksAdo.Delete(ksDto, mandatoryOnly));
            }
            else
            {
                return(ksAdo.Delete(ksDto));
            }
        }
예제 #3
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            var adoKeyword_Subject = new Keyword_Subject_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_Subject.Delete(DTO);

            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);
        }
        /// <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_Subject = new Keyword_Subject_ADO(Ado);

            //Create the Keyword_Subject - and retrieve the newly created Id
            int newId = adoKeyword_Subject.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);
        }
        /// <summary>
        /// execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            var adoKeyword_Subject = new Keyword_Subject_ADO(Ado);

            //Update and retrieve the number of updated rows
            int nUpdated = adoKeyword_Subject.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);
        }
        internal void Create(ADO Ado, Subject_DTO subjectDto, int subjectID)
        {
            //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("KSB_VALUE", typeof(string));
            dt.Columns.Add("KSB_SBJ_ID", typeof(int));
            dt.Columns.Add("KSB_MANDATORY_FLAG", typeof(bool));

            Keyword_Subject_ADO keywordSubjectAdo = new Keyword_Subject_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(subjectDto.SbjValue), subjectID);

            keywordSubjectAdo.Create(dt);
        }
예제 #7
0
        internal void Create(ADO Ado, Subject_DTO subjectDto, int subjectID)
        {
            //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 = Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code");

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

            dt.Columns.Add("KSB_VALUE", typeof(string));
            dt.Columns.Add("KSB_SBJ_ID", typeof(int));
            dt.Columns.Add("KSB_MANDATORY_FLAG", typeof(bool));

            Keyword_Subject_ADO keywordSubjectAdo = new Keyword_Subject_ADO(Ado);


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

            //IKeywordExtractor ext = kbe.GetExtractor();
            AddToTable(ref dt, kbe.ExtractSplitSingular(subjectDto.SbjValue), subjectID);

            keywordSubjectAdo.Create(dt);
        }