public StudentFilterClause ToFilterClause()
 {
     AnvilEntity e = new AnvilEntity(this);
     StudentFilterClause c = new StudentFilterClause();
     e.CopyTo(c);
     return c;
 }
        public void CreateClause(StudentFilterClause c)
        {
            try
            {

                if (c.StudentFilterClauseId.Equals(Guid.Empty))
                    c.StudentFilterClauseId = Guid.NewGuid();

                if (c.FilterId == Guid.Empty)
                    c.FilterId = this.FilterId;

                int count = DbContext.StudentFilterClauses.Where(x => x.FilterId.Equals(c.FilterId)).Count();

                c.SortIndex = count;
                DbContext.StudentFilterClauses.Add(c);
                DbContext.SaveChanges();

                Add(new DynamicStudentClause(c));
            }
            catch (Exception ex)
            {
                throw new Exception("Could not create student clause", ex);
            }
        }
 public StudentFilterClauseModel(StudentFilterClause c)
 {
     AnvilEntity e = new AnvilEntity(c);
     e.CopyTo(this);
 }
        public static StudentFilterClause GetDefaultStudentClause(Guid filterId)
        {
            StudentFilterClause c = new StudentFilterClause();
            c.FilterId = filterId;
            c.ClauseConjunction = DynamicQueryConjunctions.Or;
            c.BuildingConjunction = DynamicQueryConjunctions.And;
            c.InstructionalLevelConjunction = DynamicQueryConjunctions.And;
            c.StatusConjunction = DynamicQueryConjunctions.And;
            c.StudentIdConjunction = DynamicQueryConjunctions.And;
            c.NameConjunction = DynamicQueryConjunctions.And;

            return c;
        }
 public DynamicStudentClause(StudentFilterClause c)
 {
     FromStudentClause(c);
 }
        public void FromStudentClause(StudentFilterClause c)
        {
            base.ClauseConjunction = c.ClauseConjunction;
            base.ClauseId = c.StudentFilterClauseId;
            base.FilterId = c.FilterId;

            if (c.BuildingInclude)
                AddElement(c.BuildingConjunction, fBuildingKey, c.BuildingOperator, c.BuildingValue);

            if (c.InstructionalLevelInclude)
                AddElement(c.InstructionalLevelConjunction, fInstructionalLevelKey, c.InstructionalLevelOperator, c.InstructionalLevelValue);

            if (c.StatusInclude)
                AddElement(c.StatusConjunction, fStatus, c.StatusOperator, Convert.ToInt32( c.StatusValue));

            if (c.NameInclude)
                AddElement(c.NameConjunction, fLastName, c.NameOperator, c.NameValue);

            if (c.StudentIdInclude)
                AddElement(c.StudentIdConjunction, fStudentId, c.StudentIdOperator, c.StudentIdValue);
        }