Пример #1
0
        private SqlParameter[] QueryParameters(HttpContext Context)
        {
            List <SqlParameter> Parameters = new List <SqlParameter>();

            string[] QueryKeys =
            {
                "StoreUsername",
                "EntryKey",
                "EntryName",
                "EntryUse",
                "EntryUsername",
                "EntryPassword",
                "EntryConnectionString",
                "EntryToken",
                "EntryVariable",
                "EntryStartDate",
                "EntryEndDate"
            };

            foreach (string QueryKey in QueryKeys)
            {
                if (Context.Request.Query.TryGetValue(QueryKey, out var QueryValue))
                {
                    Parameters.Add(new SqlParameter($"@{QueryKey}", QueryValue.ToString()));
                }
            }
            return(Parameters.ToArray());
        }
        private bool WriteErrorIfNotNull(string propertyPath, QueryValue queryValue)
        {
            if (!queryValue.IsNull)
            {
                this.errors.Add(string.Format(CultureInfo.InvariantCulture, "Error: expected null value for propertyPath '{0}' instead recieved '{1}'", propertyPath, queryValue.ToString()));
                return true;
            }

            return false;
        }
Пример #3
0
        private bool WriteErrorIfNotNull(string propertyPath, QueryValue queryValue)
        {
            if (!queryValue.IsNull)
            {
                this.errors.Add(string.Format(CultureInfo.InvariantCulture, "Error: expected null value for propertyPath '{0}' instead recieved '{1}'", propertyPath, queryValue.ToString()));
                return(true);
            }

            return(false);
        }