Exemple #1
0
        /// <summary>
        /// Method executed after the code related to the attribute. The action is to check if the value is null
        /// </summary>
        public void Postprocess(MarshalByRefObject inst, IMessage msg, ref IMessage msgReturn)
        {
            // Extract Action
            ONAction lAction = inst as ONAction;

            // Shared Event Control
            if ((lAction != null) && (lAction.OnContext.InSharedContext == true))             // No-Principal Shared Event
            {
                return;
            }

            ReturnMessage lReturnMessage = msgReturn as ReturnMessage;
            IONType       lArgument      = lReturnMessage.Args[IndexArgument] as IONType;

            if (lArgument == null || lArgument.Value == null)
            {
                if (AllowsNull == false)
                {
                    throw new ONNotNullArgumentException(null, IdService, IdClass, IdArgument, ServiceName, ClassName, Name);
                }
            }
            else if ((Length > 0) && (lArgument.Value.ToString().Length > Length))
            {
                throw new ONMaxLenghtArgumentException(null, IdArgument, Name, Length.ToString());
            }
        }
Exemple #2
0
        /// <summary>
        /// Generates a Not Equal operator with the right operand for querying the database.
        /// </summary>
        /// <param name="parameterName">Name of the parameter</param>
        /// <param name="parameterValue">Value of the parameter</param>
        /// <returns></returns>
        public string AddNEQComparison(string parameterName, IONType parameterValue)
        {
            // If the value is null it returns the 'IS NOT NULL' operand.
            if (parameterValue.Value == null)
            {
                return(" IS NOT NULL");
            }

            // It returns " <> ?" adding the parameter to the sentence
            return(" <> " + AddWhereParameter(parameterName, parameterValue));
        }
Exemple #3
0
        /// <summary>
        /// Generates a Not Equal operator for querying the database.
        /// </summary>
        /// <param name="leftParameterName">Name of the left parameter</param>
        /// <param name="leftparameterValue">Value of the left parameter</param>
        /// <param name="rightParameterName">Name of the right parameter</param>
        /// <param name="rightParameterValue">Name of the right parameter</param>
        /// <returns></returns>
        public string AddNEQComparison(string leftParameterName, IONType leftParameterValue, string rightParameterName, IONType rightParameterValue)
        {
            // If the value of the right parameter is null it returns the 'IS NOT NULL' operand.
            if (rightParameterValue.Value == null)
            {
                return(AddWhereParameter(leftParameterName, leftParameterValue) + " IS NOT NULL");
            }
            else if (leftParameterValue.Value == null)             //If the value of the left parameter is null it returns 'Right_Operand IS NOT NULL' operand but
            {
                return(AddWhereParameter(rightParameterName, rightParameterValue) + " IS NOT NULL");
            }

            // It returns "? <> ?" adding the parameters to the sentence
            return(AddWhereParameter(leftParameterName, leftParameterValue) + " <> " + AddWhereParameter(rightParameterName, rightParameterValue));
        }
Exemple #4
0
        public string AddWhereParameter(IONType parameterValue)
        {
            if (mInDisjunction)
            {
                mWhereDisjParametersName.Add("");
                mWhereDisjParametersItem.Add(parameterValue);
            }
            else
            {
                mWhereParametersName.Add("");
                mWhereParametersItem.Add(parameterValue);
            }

            if (parameterValue is ONString)
            {
                return("RTRIM(?)");
            }

            return("?");
        }
Exemple #5
0
        public override IONType GetParameter(string name)
        {
            IONType lParameter = null;

            lParameter = GetSelectParameter(name);
            if (lParameter != null)
            {
                return(lParameter);
            }

            lParameter = GetWhereParameter(name);
            if (lParameter != null)
            {
                return(lParameter);
            }

            lParameter = GetWhereDisjParameter(name);
            if (lParameter != null)
            {
                return(lParameter);
            }

            return(null);
        }
 /// <summary>
 /// Add OrderBy value parameter
 /// </summary>
 /// <param name="parameter">Value</param>
 protected void AddOrderByParameter(IONType parameter)
 {
     OrderByParameters.Add(parameter);
 }
        public string AddWhereParameter(IONType parameterValue)
        {
            if (mInDisjunction)
            {
                mWhereDisjParametersName.Add("");
                mWhereDisjParametersItem.Add(parameterValue);
            }
            else
            {
                mWhereParametersName.Add("");
                mWhereParametersItem.Add(parameterValue);
            }

            if (parameterValue is ONString)
                return "RTRIM(?)";

            return "?";
        }
 /// <summary>
 /// Add the parameter to the list of parameters of the SQL sentence
 /// </summary>
 /// <param name="name">Name of the parameter</param>
 /// <param name="parameter">Data type of the parameter</param>
 public void AddSelectParameter(string name, IONType parameter)
 {
     mSelectParametersName.Add(name);
     mSelectParametersItem.Add(parameter);
 }
 public string AddNEQComparison(IONType parameterValue)
 {
     return AddNEQComparison("", parameterValue);
 }
        /// <summary>
        /// Generates a Not Equal operator with the right operand for querying the database.
        /// </summary>
        /// <param name="parameterName">Name of the parameter</param>
        /// <param name="parameterValue">Value of the parameter</param>
        /// <returns></returns>
        public string AddNEQComparison(string parameterName, IONType parameterValue)
        {
            // If the value is null it returns the 'IS NOT NULL' operand.
            if (parameterValue.Value == null)
                return " IS NOT NULL";

            // It returns " <> ?" adding the parameter to the sentence
            return " <> " + AddWhereParameter(parameterName, parameterValue);
        }
 public string AddNEQComparison(IONType leftParameterValue, IONType rightParameterValue)
 {
     return AddNEQComparison("", leftParameterValue, "", rightParameterValue);
 }
Exemple #12
0
 /// <summary>
 /// Add OrderBy value parameter
 /// </summary>
 /// <param name="parameter">Value</param>
 protected void AddOrderByParameter(IONType parameter)
 {
     OrderByParameters.Add(parameter);
 }
Exemple #13
0
 /// <summary>
 /// Add the parameter to the list of parameters of the SQL sentence
 /// </summary>
 /// <param name="name">Name of the parameter</param>
 /// <param name="parameter">Data type of the parameter</param>
 public void AddSelectParameter(string name, IONType parameter)
 {
     mSelectParametersName.Add(name);
     mSelectParametersItem.Add(parameter);
 }
Exemple #14
0
 public string AddNEQComparison(IONType parameterValue)
 {
     return(AddNEQComparison("", parameterValue));
 }
Exemple #15
0
 public string AddNEQComparison(IONType leftParameterValue, IONType rightParameterValue)
 {
     return(AddNEQComparison("", leftParameterValue, "", rightParameterValue));
 }
Exemple #16
0
 /// <summary>
 /// Add the parameter to the list of parameters of the SQL sentence
 /// </summary>
 /// <param name="name">Name of the parameter</param>
 /// <param name="parameter">Data type of the parameter</param>
 public void AddParameter(string name, IONType parameter)
 {
     ParametersName.Add(name);
     ParametersItem.Add(parameter);
 }
        /// <summary>
        /// Generates a Not Equal operator for querying the database.
        /// </summary>
        /// <param name="leftParameterName">Name of the left parameter</param>
        /// <param name="leftparameterValue">Value of the left parameter</param>
        /// <param name="rightParameterName">Name of the right parameter</param>
        /// <param name="rightParameterValue">Name of the right parameter</param>
        /// <returns></returns>
        public string AddNEQComparison(string leftParameterName, IONType leftParameterValue, string rightParameterName, IONType rightParameterValue)
        {
            // If the value of the right parameter is null it returns the 'IS NOT NULL' operand.
            if (rightParameterValue.Value == null)
                return AddWhereParameter(leftParameterName, leftParameterValue) + " IS NOT NULL";
            else if (leftParameterValue.Value == null) //If the value of the left parameter is null it returns 'Right_Operand IS NOT NULL' operand but
                return AddWhereParameter(rightParameterName, rightParameterValue) + " IS NOT NULL";

            // It returns "? <> ?" adding the parameters to the sentence
            return AddWhereParameter(leftParameterName, leftParameterValue) + " <> " + AddWhereParameter(rightParameterName, rightParameterValue);
        }
Exemple #18
0
 /// <summary>
 /// Add the parameter to the list of parameters of the SQL sentence
 /// </summary>
 /// <param name="name">Name of the parameter</param>
 /// <param name="parameter">Data type of the parameter</param>
 public void AddParameter(string name, IONType parameter)
 {
     ParametersName.Add(name);
     ParametersItem.Add(parameter);
 }