示例#1
0
        public IHttpActionResult Last()
        {
            SqlAccess sa = new SqlAccess();

            Durados.Web.Mvc.View logView = (Durados.Web.Mvc.View)map.Database.Views["Durados_Log"];

            Dictionary <string, object> values = new Dictionary <string, object>();

            values.Add(logView.GetFieldByColumnNames("LogType").Name, "-611");
            int      rowCount = 0;
            DataView dataView = logView.FillPage(1, 1, values, false, new Dictionary <string, SortDirection>()
            {
                { "ID", SortDirection.Desc }
            }, out rowCount, null, null);

            if (dataView.Count == 0)
            {
                return(NotFound());
            }

            string   guid      = (string)dataView[0]["Action"];
            DateTime timestamp = (DateTime)dataView[0]["Time"];

            values = new Dictionary <string, object>();
            values.Add(logView.GetFieldByColumnNames("LogType").Name, "-611");
            values.Add(logView.GetFieldByColumnNames("Action").Name, guid);
            rowCount = 0;
            dataView = logView.FillPage(1, 1, values, false, new Dictionary <string, SortDirection>()
            {
                { "MethodName", SortDirection.Asc }
            }, out rowCount, null, null);

            string model = string.Empty;
            string sql   = string.Empty;

            foreach (System.Data.DataRowView row in dataView)
            {
                if (!row.Row.IsNull("Trace"))
                {
                    model += row["Trace"].ToString();
                }

                if (!row.Row.IsNull("FreeText"))
                {
                    sql += row["FreeText"].ToString();
                }
            }

            return(Ok(new { model = model, sql = sql, timestamp = timestamp }));
        }
示例#2
0
        private bool IsOverTheLimit(Durados.Web.Mvc.View view)
        {
            int count;

            view.FillPage(1, 100000, null, null, null, out count, null, null);

            int limit = Map.GetLimit(Limits.Cron);

            return(count >= limit);
        }