/// <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 adoKeywordRelease = new Keyword_Release_ADO(); if (DTO.LngIsoCode != null) { Keyword_BSO_Extract bse = new Keyword_BSO_Extract(DTO.LngIsoCode); DTO.KrlValue = bse.Singularize(DTO.KrlValue); } //Create the Keyword_Subject - and retrieve the newly created Id int newId = adoKeywordRelease.Create(Ado, 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() { Keyword_Release_ADO adoKeywordRelease = new Keyword_Release_ADO(); //You can't change the mandatory flag DTO.KrlMandatoryFlag = false; if (DTO.LngIsoCode != null) { Keyword_BSO_Extract bse = new Keyword_BSO_Extract(DTO.LngIsoCode); DTO.KrlValue = bse.Singularize(DTO.KrlValue); } int updated = adoKeywordRelease.Update(Ado, DTO); if (updated == 0) { Log.Instance.Debug("No record found for update request"); Response.error = Label.Get("error.delete"); return(false); } else if (updated < 0) { Response.error = Label.Get("error.duplicate"); } Response.data = JSONRPC.success; return(true); }
/// <summary> /// Updates a Keyword Subject /// </summary> /// <param name="dto"></param> /// <returns></returns> internal int Update(Keyword_Subject_DTO dto) { if (dto.LngIsoCode != null) { Keyword_BSO_Extract bse = new Keyword_BSO_Extract(dto.LngIsoCode); dto.KsbValue = bse.Singularize(dto.KsbValue); } var inputParams = new List <ADO_inputParams>() { new ADO_inputParams() { name = "@KsbCode", value = dto.KsbCode }, new ADO_inputParams() { name = "@KsbValue", value = dto.KsbValue }, new ADO_inputParams() { name = "@KsbMandatoryFlag", value = dto.KsbMandatoryFlag != null?dto.KsbMandatoryFlag:false }, new ADO_inputParams() { name = "@KsbSingularisedFlag", value = dto.LngIsoCode != null } }; var returnParam = new ADO_returnParam() { name = "@ReturnVal", value = 0 }; ado.ExecuteNonQueryProcedure("System_Navigation_Keyword_Subject_Update", inputParams, ref returnParam); return((int)returnParam.value); }