Ejemplo n.º 1
0
 public ContentResult AddContact()
 {
     var m = new AdvancedModel();
     m.LoadScratchPad();
     var cid = CmsData.Contact.AddContact(m.QueryId.Value);
     return Content("/Contact.aspx?id=" + cid);
 }
Ejemplo n.º 2
0
 public ActionResult AddTasks()
 {
     var m = new AdvancedModel();
     m.LoadScratchPad();
     var c = new ContentResult();
     c.Content = Task.AddTasks(m.QueryId.Value).ToString();
     return c;
 }
Ejemplo n.º 3
0
 public ActionResult CopyAsNew(int id)
 {
     var m = new AdvancedModel { SelectedId = id };
     m.LoadScratchPad();
     m.CopyAsNew();
     var c = new ContentResult();
     c.Content = m.QueryId.ToString();
     return c;
 }
Ejemplo n.º 4
0
 public ActionResult AddNewCondition(int id)
 {
     var m = new AdvancedModel { SelectedId = id };
     m.LoadScratchPad();
     m.EditCondition();
     if (m.ConditionName == "Group")
         m.AddConditionToGroup();
     else
         m.AddNewConditionAfterCurrent(id);
     return View("Conditions", m);
 }
Ejemplo n.º 5
0
 public ContentResult UnTagAll()
 {
     var m = new AdvancedModel();
     m.LoadScratchPad();
     m.UnTagAll();
     var c = new ContentResult();
     c.Content = "Add";
     return c;
 }
Ejemplo n.º 6
0
 public ContentResult TagAll(string tagname, bool? cleartagfirst)
 {
     if (!tagname.HasValue())
         return Content("error: no tag name");
     var m = new AdvancedModel();
     m.LoadScratchPad();
     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");
 }
Ejemplo n.º 7
0
 public ActionResult SelectCondition(int id, string conditionName)
 {
     var m = new AdvancedModel { SelectedId = id };
     m.LoadScratchPad();
     m.ConditionName = conditionName;
     m.SetVisibility();
     m.TextValue = "";
     m.IntegerValue = "";
     m.DateValue = "";
     m.CodeValue = "";
     m.CodeValues = new string[0];
     m.Days = "";
     m.Age = "";
     m.Program = 0;
     m.Quarters = "";
     m.StartDate = "";
     m.EndDate = "";
     m.Comparison = "Equal";
     m.UpdateCondition();
     m.SelectedId = id;
     return View("Conditions", m);
 }
Ejemplo n.º 8
0
 public ActionResult Export()
 {
     var m = new AdvancedModel();
     m.LoadScratchPad();
     return new QBExportResult(m.QueryId.Value);
 }
Ejemplo n.º 9
0
 public ActionResult SaveCondition(AdvancedModel m)
 {
     m.LoadScratchPad();
     if (m.Validate(ModelState))
     {
         m.UpdateCondition();
         DbUtil.Db.SubmitChanges();
     }
     return View("Conditions", m);
 }
Ejemplo n.º 10
0
        public ActionResult Results()
        {
            var cb = new SqlConnectionStringBuilder(Util.ConnectionString);
            cb.ApplicationName = "qb";
            DbUtil.Db = new CMSDataContext(cb.ConnectionString);
            var m = new AdvancedModel();
            try
            {
                UpdateModel(m);
            }
            catch (Exception ex)
            {
                return Content("Something went wrong<br><p>" + ex.Message + "</p>");
            }
            m.LoadScratchPad();

            var starttime = DateTime.Now;
            m.PopulateResults();
            DbUtil.LogActivity("QB Results ({0:N1}, {1})".Fmt(DateTime.Now.Subtract(starttime).TotalSeconds, m.QueryId));
            return View(m);
        }
Ejemplo n.º 11
0
 public ActionResult RemoveCondition(int id)
 {
     var m = new AdvancedModel { SelectedId = id };
     m.LoadScratchPad();
     m.DeleteCondition();
     m.SelectedId = null;
     return View("Conditions", m);
 }
Ejemplo n.º 12
0
 public ActionResult Reload()
 {
     var m = new AdvancedModel();
     m.LoadScratchPad();
     return View("Conditions", m);
 }
Ejemplo n.º 13
0
 public ActionResult Main(int? id, int? run)
 {
     if (!DbUtil.Db.UserPreference("newlook3", "false").ToBool()
         || !DbUtil.Db.UserPreference("advancedsearch", "false").ToBool())
         return Redirect(Request.RawUrl.ToLower().Replace("search/advanced", "querybuilder"));
     ViewData["Title"] = "QueryBuilder";
     ViewData["OnQueryBuilder"] = "true";
     ViewData["TagAction"] = "/Search/Advanced/TagAll/";
     ViewData["UnTagAction"] = "/Search/Advanced/UnTagAll/";
     ViewData["AddContact"] = "/Search/Advanced/AddContact/";
     ViewData["AddTasks"] = "/Search/Advanced/AddTasks/";
     var m = new AdvancedModel { QueryId = id };
     DbUtil.LogActivity("QueryBuilder");
     if (run.HasValue)
         m.ShowResults = true;
     m.LoadScratchPad();
     ViewData["queryid"] = m.QueryId;
     ViewBag.AutoRun = (bool?)(TempData["AutoRun"]) == true;
     var newsearchid = (int?)TempData["newsearch"];
     if (newsearchid.HasValue)
     {
         ViewBag.NewSearch = true;
         m.SelectedId = newsearchid.Value;
     }
     return View(m);
 }
Ejemplo n.º 14
0
 public ActionResult InsGroupAbove(int id)
 {
     var m = new AdvancedModel { SelectedId = id };
     m.LoadScratchPad();
     m.InsertGroupAbove();
     var c = new ContentResult();
     c.Content = m.QueryId.ToString();
     return c;
 }
Ejemplo n.º 15
0
 public ActionResult SaveQuery()
 {
     var m = new AdvancedModel();
     UpdateModel(m);
     m.LoadScratchPad();
     m.SaveQuery();
     var c = new ContentResult();
     c.Content = m.Description;
     return c;
 }
Ejemplo n.º 16
0
 public ActionResult DuplicateCondition(int id)
 {
     var m = new AdvancedModel();
     m.LoadScratchPad();
     m.EditCondition();
     m.CopyCurrentCondition(id);
     return View("Conditions", m);
 }
Ejemplo n.º 17
0
 public ActionResult EditCondition(int id)
 {
     var m = new AdvancedModel { SelectedId = id };
     m.LoadScratchPad();
     m.EditCondition();
     return View("Conditions", m);
 }