Exemplo n.º 1
0
        public async Task <report> get_report(options options)
        {
            table_base t = this[options.uid];

            if (null == t)
            {
                throw new Exception("Invalid type");
            }
            return(await t.report(options));
        }
Exemplo n.º 2
0
        public async Task <object> perform_operation(options options, bool return_object = false)
        {
            string header = String.Empty;
            object obj    = null;

            table_base t = this[options.uid];

            switch (options.operation.ToLower())
            {
            /***ON SINGULAR TABLE****/
            case "report": if (null == t)
                {
                    throw new Exception("Table did not load properly, Invalid type-report");
                }
                obj = await t.report(options);

                break;

            case "list":  obj = globals.get_list();
                break;

            case "config": if (globals.models.ContainsKey(options.uid))
                {
                    obj = globals.models[options.uid];
                }
                else
                {
                    throw new Exception(String.Format("Config: Model not in global cache. {0}", options.uid));
                }
                break;

            case "stat": if (null == t)
                {
                    throw new Exception("Table did not load properly, Invalid type");
                }
                obj = t.stat();
                break;

            /***ON ALL TABLES****/
//                case "stats" : obj=stats(options);     break;

            default: return("Unknown operation");
            }
            if (return_object)
            {
                return(obj);
            }
            if (options.format == "raw")
            {
                header = options.ToString();
            }
            string base_string = await optupt_converter(options.format, obj);

            return(header + base_string);
        }