Пример #1
0
        public Guid AddGroupToGroup()
        {
            var g  = Selected.AddNewGroupClause();
            var nc = g.AddNewClause();

            TopClause.Save(Db);
            return(nc.Id);
        }
Пример #2
0
        public void MakeTopGroup()
        {
            Selected.Description = TopClause.Description;
            var conditions = Selected.Conditions.ToList();

            foreach (var c in conditions)
            {
                c.ParentId = TopClause.Id;
            }
            Selected.Id       = TopClause.Id;
            Selected.ParentId = null;
            TopClause         = Selected;
            TopClause.Save(DbUtil.Db);
        }
Пример #3
0
        public void InsertGroupAbove()
        {
            var g = new Condition
            {
                Id            = Guid.NewGuid(),
                ConditionName = QueryType.Group.ToString(),
                Comparison    = CompareType.AnyTrue.ToString(),
                AllConditions = Selected.AllConditions
            };

            if (Selected.IsFirst)
            {
                Selected.ParentId = g.Id;
                g.ParentId        = null;
            }
            else
            {
                var list = Selected.Parent.Conditions.Where(cc => cc.Order >= Selected.Order).ToList();
                g.ParentId = Selected.ParentId;
                foreach (var c in list)
                {
                    c.ParentId = g.Id;
                }
                g.Order = Selected.MaxClauseOrder();
            }
            Selected.AllConditions.Add(g.Id, g);
            if (g.IsFirst)
            {
                // g will now becojme the new TopClause
                g.Description = TopClause.Description;

                // swap TopClauseId with the new GroupId so the saved query will have the same id
                var tcid       = TopClause.Id;
                var gid        = g.Id;
                var conditions = TopClause.Conditions.ToList();
                TopClause.Id = gid;
                foreach (var c in conditions)
                {
                    c.ParentId = gid;
                }
                g.Id = tcid;
                TopClause.ParentId = g.Id;
                TopClause          = g;
                TopClause.Save(DbUtil.Db);
            }
            TopClause.Save(DbUtil.Db, increment: true);
        }
Пример #4
0
 public void UpdateCondition()
 {
     this.CopyPropertiesTo(Selected);
     TopClause.Save(DbUtil.Db, increment: true);
 }
Пример #5
0
 public void DeleteCondition()
 {
     Selected.DeleteClause();
     TopClause.Save(DbUtil.Db, increment: true);
 }
Пример #6
0
 public void Cut()
 {
     HttpContext.Current.Session["QueryClipboard"] = Selected.ToXml();
     Selected.DeleteClause();
     TopClause.Save(DbUtil.Db, increment: true);
 }
Пример #7
0
 public void Cut()
 {
     Util.QueryClipboard = Selected.ToXml();
     Selected.DeleteClause();
     TopClause.Save(Db, increment: true);
 }