Наследование: QueryResults
Пример #1
0
 public ActionResult NamedQuery(string name)
 {
     ViewBag.Title = "QueryBuilder";
     var id = DbUtil.Db.QueryIdByName(name);
     var m = new QueryModel(id);
     return ViewQuery(m);
 }
Пример #2
0
 public ActionResult Index(Guid? id)
 {
     ViewBag.Title = "QueryBuilder";
     ViewBag.OrigQueryId = id;
     var m = new QueryModel(id);
     return ViewQuery(m);
 }
Пример #3
0
 public ActionResult Cut(QueryModel m)
 {
     try { m.Cut(); }
     catch (Exception ex)
     {
         var errorLog = ErrorLog.GetDefault(null);
         errorLog.Log(new Error(ex));
     }
     return View("Conditions", m);
 }
Пример #4
0
 private void InitToolbar(QueryModel m)
 {
     ViewBag.OnQueryBuilder = "true";
     ViewBag.TagAction = "/Query/TagAll/";
     ViewBag.UnTagAction = "/Query/UnTagAll/";
     ViewBag.AddContact = "/Query/AddContact/";
     ViewBag.AddTasks = "/Query/AddTasks/";
     ViewBag.GearSpan = "span12";
     ViewBag.queryid = m.TopClause.Id;
 }
Пример #5
0
 private ActionResult ViewQuery(QueryModel m)
 {
     InitToolbar(m);
     m.TopClause.IncrementLastRun();
     DbUtil.Db.SubmitChanges();
     m.QueryId = m.TopClause.Id;
     ViewBag.xml = m.TopClause.ToXml();
     var sb = new StringBuilder();
     foreach (var c in m.TopClause.AllConditions)
     {
         sb.AppendLine(c.Key.ToString());
         if (c.Value.FieldInfo == null)
             return NewQuery();
     }
     ViewBag.ConditionList = sb.ToString();
     return View("Index", m);
 }
Пример #6
0
 private void UpdateConditions(Guid id)
 {
     var query = DbUtil.Db.LoadQueryById2(id);
     userpeopleid = (from u in DbUtil.Db.Users
                     where u.Username == query.Owner
                     select u.PeopleId).SingleOrDefault();
     var c = Condition.Import(query.Text, query.Name, newGuids: false, topguid: id);
     m = new QueryModel { TopClause = c };
     var settings = new XmlWriterSettings
     {
         Indent = true,
         Encoding = new UTF8Encoding(false)
     };
     var sb = new StringBuilder();
     using (var w = XmlWriter.Create(sb, settings))
         UpdateCondition(w, id);
     query.Text = sb.ToString();
     DbUtil.Db.SubmitChanges();
 }
Пример #7
0
 public ActionResult Copy(QueryModel m)
 {
     m.Copy();
     return Content("ok");
 }
Пример #8
0
 public ActionResult CodeSelect(QueryModel m)
 {
     return View("EditorTemplates/CodeSelect", m);
 }
Пример #9
0
 public ActionResult AddTasks(QueryModel m)
 {
     return Content(Task.AddTasks(m.TopClause.Id).ToString());
 }
Пример #10
0
 public ContentResult AddContact(QueryModel m)
 {
     var cid = Contact.AddContact(m.TopClause.Id);
     return Content("/Contact/" + cid);
 }
Пример #11
0
 public ContentResult TagAll(string tagname, bool? cleartagfirst, QueryModel m)
 {
     if (!tagname.HasValue())
         return Content("error: no tag name");
     if (Util2.CurrentTagName == tagname && !(cleartagfirst ?? false))
     {
         m.TagAll();
         return Content("Remove");
     }
     var tag = DbUtil.Db.FetchOrCreateTag(tagname, Util.UserPeopleId, DbUtil.TagTypeId_Personal);
     if (cleartagfirst ?? false)
         DbUtil.Db.ClearTag(tag);
     m.TagAll(tag);
     Util2.CurrentTag = tagname;
     DbUtil.Db.TagCurrent();
     return Content("Manage");
 }
Пример #12
0
 public JsonResult SavedQueries(QueryModel m)
 {
     return Json(m.SavedQueries());
 }
Пример #13
0
 public ActionResult EditCondition(QueryModel m)
 {
     Response.NoCache();
     m.EditCondition();
     return View(m);
 }
Пример #14
0
 public ActionResult ToXml(Guid? id)
 {
     var m = new QueryModel(id);
     var xml1 = m.TopClause.ToXml();
     return Content(xml1, "text/xml");
 }
Пример #15
0
 public ActionResult Results(QueryModel m)
 {
     var starttime = DateTime.Now;
     DbUtil.LogActivity($"QB Results ({DateTime.Now.Subtract(starttime).TotalSeconds:N1}, {m.TopClause.Id})");
     InitToolbar(m);
     ViewBag.xml = m.TopClause.ToXml();
     return View(m);
 }
Пример #16
0
 public ActionResult Results(int? page, int? size, string sort, string dir, QueryModel m)
 {
     m.Pager.Set("/Query/Results", page, size, sort, dir);
     var starttime = DateTime.Now;
     DbUtil.LogActivity("QB Results ({0:N1}, {1})".Fmt(DateTime.Now.Subtract(starttime).TotalSeconds, m.TopClause.Id));
     InitToolbar(m);
     ViewBag.xml = m.TopClause.ToXml();
     return View(m);
 }
Пример #17
0
 public ActionResult SaveCondition(QueryModel m)
 {
     if (m.Validate(ModelState))
         m.UpdateCondition();
     if (ModelState.IsValid)
         return View("Conditions", m);
     return View("EditCondition", m);
 }
Пример #18
0
 public ActionResult Export()
 {
     var m = new QueryModel();
     Response.ContentType = "text/xml";
     var settings = new XmlWriterSettings { Indent = true, Encoding = new System.Text.UTF8Encoding(false) };
     using (var w = XmlWriter.Create(Response.OutputStream, settings))
         m.TopClause.SendToWriter(w);
     return new EmptyResult();
 }
Пример #19
0
 public ActionResult SelectCondition(QueryModel m)
 {
     m.Comparison = "Equal";
     m.UpdateCondition();
     return View("EditCondition", m);
 }
Пример #20
0
        public ActionResult Index(Guid? id)
        {
            if (!ViewExtensions2.UseNewLook())
                return Redirect("/QueryBuilder2/Main/" + id);
            ViewBag.Title = "QueryBuilder";
            var m = new QueryModel(id);
            m.Pager.Set("/Query/Results/");

            InitToolbar(m);
            var newsearchid = (Guid?)TempData["newsearch"];
            if (m.TopClause.NewMatchAnyId.HasValue)
                newsearchid = m.TopClause.NewMatchAnyId;
            if (newsearchid.HasValue)
                ViewBag.NewSearchId = newsearchid.Value;
            m.TopClause.IncrementLastRun();
            DbUtil.Db.SubmitChanges();
            m.QueryId = m.TopClause.Id;
            ViewBag.xml = m.TopClause.ToXml();
            var sb = new StringBuilder();
            foreach (var c in m.TopClause.AllConditions)
                sb.AppendLine(c.Key.ToString());
            ViewBag.ConditionList = sb.ToString();
            return View(m);
        }
Пример #21
0
 public ContentResult UnTagAll(QueryModel m)
 {
     m.UnTagAll();
     return Content("Add");
 }
Пример #22
0
 public ActionResult InsGroupAbove(QueryModel m)
 {
     m.InsertGroupAbove();
     return View("Conditions", m);
 }
Пример #23
0
 public ActionResult AddNewGroup(QueryModel m)
 {
     m.EditCondition();
     ViewBag.NewId = m.AddGroupToGroup();
     return View("Conditions", m);
 }
Пример #24
0
 public ActionResult MakeTopGroup(QueryModel m)
 {
     m.MakeTopGroup();
     return View("Conditions", m);
 }
Пример #25
0
 public ActionResult ChangeGroup(string comparison, QueryModel m)
 {
     m.Selected.Comparison = comparison;
     m.TopClause.Save(DbUtil.Db);
     return Content("ok");
 }
Пример #26
0
 public ActionResult Paste(QueryModel m)
 {
     m.Paste();
     return View("Conditions", m);
 }
Пример #27
0
 public ActionResult Conditions(QueryModel m)
 {
     return View("Conditions", m);
 }
Пример #28
0
 public ActionResult Reload()
 {
     var m = new QueryModel();
     return View("Conditions", m);
 }
Пример #29
0
 public ActionResult Cut(QueryModel m)
 {
     m.Cut();
     return View("Conditions", m);
 }
Пример #30
0
 public ActionResult RemoveCondition(QueryModel m)
 {
     m.DeleteCondition();
     m.SelectedId = null;
     return View("Conditions", m);
 }