示例#1
0
        private void SetPathAndQuery(Uri uri)
        {
            string[] pathAndQuery = uri.PathAndQuery.Split(new string[] { "?" }, StringSplitOptions.RemoveEmptyEntries);
            Path     path         = Path.OneWhere(c => c.Value == pathAndQuery[0]);

            if (path == null)
            {
                path       = new Path();
                path.Value = pathAndQuery[0];
                path.Save();
            }
            this.PathId = path.Id;

            if (pathAndQuery.Length > 1)
            {
                string query = pathAndQuery[1];
                if (string.IsNullOrEmpty(query))
                {
                    this.QueryStringId = QueryString.Empty.Id;
                }
                else
                {
                    QueryString qs = QueryString.OneWhere(c => c.Value == query);
                    if (qs == null)
                    {
                        qs       = new QueryString();
                        qs.Value = pathAndQuery[1];
                        qs.Save();
                    }
                    this.QueryStringId = qs.Id;
                }
            }
        }
示例#2
0
        private static Path CreateFromFilter(IQueryFilter filter, Database database = null)
        {
            Database db  = database ?? Db.For <Path>();
            var      dao = new Path();

            filter.Parameters.Each(p =>
            {
                dao.Property(p.ColumnName, p.Value);
            });
            dao.Save(db);
            return(dao);
        }
示例#3
0
 public ActionResult Update(Bam.Net.Analytics.Path dao)
 {
     try
     {
         dao.Save();
         return(Json(new { Success = true, Message = "", Dao = dao.ToJsonSafe() }));
     }
     catch (Exception ex)
     {
         return(GetErrorResult(ex));
     }
 }
示例#4
0
        private static Path GetPath(Uri uri)
        {
            string[] pathAndQuery = uri.PathAndQuery.Split(new string[] { "?" }, StringSplitOptions.RemoveEmptyEntries);
            Path     path         = Path.OneWhere(c => c.Value == pathAndQuery[0]);

            if (path == null)
            {
                path       = new Path();
                path.Value = pathAndQuery[0];
                path.Save();
            }

            return(path);
        }