private Dictionary <int, string> GetQueryInParameters(ActionScope scope, QueryTypeInstance queryType)
        {
            Dictionary <int, string> queryTypeInID_value = new Dictionary <int, string>();

            foreach (var queryTypeIn in queryType.QueryTypeIns)
            {
                int queryTypeInID = queryTypeIn.QueryTypeIn.QueryTypeInID;
                var queryActionIn = this.QueryActionIns
                                    .FirstOrDefault(e => e.QueryTypeIn.QueryTypeIn.QueryTypeInID == queryTypeInID);
                if (queryActionIn == null)
                {
                    throw new FormGenerationException(string.Format(
                                                          "Query type in parameter not given in query action in parameters(QueryTypeInID = {0})",
                                                          queryTypeInID
                                                          ));
                }

                var operand = scope.OperandValues
                              .FirstOrDefault(e => e.OperandID == queryActionIn.QueryActionIn.OperandIDValue);
                if (operand == null)
                {
                    throw new FormGenerationException(string.Format(
                                                          "Query type in parameter operand not found in form(QueryTypeInID = {0}, OperandID = {1})",
                                                          queryTypeInID,
                                                          queryActionIn.QueryActionIn.OperandIDValue
                                                          ));
                }

                queryTypeInID_value.Add(queryTypeInID, operand.GetSerializedValue());
            }
            return(queryTypeInID_value);
        }
        private Dictionary <int, bool> GetQueryParts(ActionScope scope, QueryTypeInstance queryType)
        {
            Dictionary <int, bool> queryTypePartID_value = new Dictionary <int, bool>();

            foreach (var queryTypePart in queryType.QueryTypeParts)
            {
                int queryTypePartID = queryTypePart.QueryTypePartID;
                var queryActionPart = this.QueryActionParts
                                      .FirstOrDefault(e => e.QueryActionPart.QueryTypePartID == queryTypePartID);
                if (queryActionPart == null)
                {
                    throw new FormGenerationException(string.Format(
                                                          "Query type part parameter not given in query action part parameters(QueryTypePartID = {0})",
                                                          queryTypePartID
                                                          ));
                }

                var operand = scope.OperandValues
                              .FirstOrDefault(e => e.OperandID == queryActionPart.QueryActionPart.OperandIDValue);
                if (operand == null)
                {
                    throw new FormGenerationException(string.Format(
                                                          "Query type part parameter operand not found part form(QueryTypePartID = {0}, OperandID = {1})",
                                                          queryTypePartID,
                                                          queryActionPart.QueryActionPart.OperandIDValue
                                                          ));
                }

                if (operand.ValueType.ValueTypeID != (int)ValueTypeEnum.Boolean)
                {
                    throw new FormGenerationException(string.Format(
                                                          "Query type part parameter operand has not boolean value type(QueryTypePartID = {0}, OperandID = {1})",
                                                          queryTypePartID,
                                                          queryActionPart.QueryActionPart.OperandIDValue
                                                          ));
                }

                object value     = operand.GetDeserializedValue();
                bool   boolValue = value is bool?(bool)value : ((bool?)value) ?? false;
                queryTypePartID_value.Add(queryTypePartID, boolValue);
            }
            return(queryTypePartID_value);
        }