예제 #1
0
        public static bool ValideParameters(ApiMethod method, ApiCall call, Action <string> callback)
        {
            bool IsSuccess = true;

            if (method.RequireParas != null && method.RequireParas.Count() > 0)
            {
                foreach (var item in method.RequireParas)
                {
                    string value = call.GetValue(item);
                    if (string.IsNullOrEmpty(value))
                    {
                        IsSuccess = false;
                        callback.Invoke(Hardcoded.GetValue("Require parameter not found", call.Context) + ": " + item);
                    }
                }
            }

            foreach (var item in method.Parameters)
            {
                if (item.ClrType != typeof(ApiCall) && (item.ClrType.IsValueType || item.ClrType == typeof(string)))
                {
                    string value = call.GetValue(item.Name);
                    if (string.IsNullOrEmpty(value))
                    {
                        IsSuccess = false;
                        callback.Invoke(Hardcoded.GetValue("Require parameter not found", call.Context) + ": " + item.Name);
                    }
                }
            }

            return(IsSuccess);
        }
예제 #2
0
        public static int GetPageNr(ApiCall call)
        {
            int    pagenr = 1;
            string value  = call.GetValue("pagenr");

            if (!string.IsNullOrEmpty(value))
            {
                if (int.TryParse(value, out pagenr))
                {
                    return(pagenr);
                }
            }
            return(pagenr);
        }