Пример #1
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            var adoReason = new Reason_ADO();

            if (DTO.LngIsoCode == Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) // we are updating the Reason in the default language
            {
                //Update the Reason - and retrieve the number of updated rows
                int nUpdated = adoReason.Update(Ado, DTO, SamAccountName);
                if (nUpdated == 0)
                {
                    Log.Instance.Debug("Can't update Reason");
                    Response.error = Label.Get("error.update");
                    return(false);
                }
            }
            else //we are updating the Reason in another valid language
            {
                int nUpdated = adoReason.CreateOrUpdateReasonLanguage(Ado, DTO);
                if (nUpdated == 0)
                {
                    Log.Instance.Debug("Can't create/update Reason Language");
                    Response.error = Label.Get("error.update");
                    return(false);
                }
            }

            Response.data = JSONRPC.success;
            return(true);
        }
Пример #2
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 adoReason = new Reason_ADO();

            //First we must check if the Reason exists already (we can't have duplicates)
            if (adoReason.Exists(Ado, DTO.RsnCode))
            {
                //This Reason exists already, we can't proceed
                Log.Instance.Debug("Reason exists already - create request refused");
                Response.error = Label.Get("error.duplicate");

                return(false);
            }

            //Create the Reason - and retrieve the newly created Id
            int newId = adoReason.Create(Ado, DTO, SamAccountName);

            if (newId == 0)
            {
                Log.Instance.Debug("Can't create Reason");
                Response.error = Label.Get("error.create");
                return(false);
            }

            Response.data = JSONRPC.success;
            return(true);
        }
Пример #3
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 adoReason = new Reason_ADO();

            //Reasons are returned as an ADO result
            ADO_readerOutput result = adoReason.Read(Ado, DTO);

            if (!result.hasData)
            {
                return(false);
            }

            Response.data = result.data;
            return(true);
        }
Пример #4
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            var adoReason = new Reason_ADO();

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

            if (nDeleted == 0)
            {
                Log.Instance.Debug("Can't delete Reason");

                Response.error = Label.Get("error.delete");
                return(false);
            }

            Response.data = JSONRPC.success;
            return(true);
        }