Exemple #1
0
        public static TAreaEvent DbSelect(this TAreaEvent entity, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TAreaEventProperties.AreaId);
                builder.ComponentSelect.Add(TAreaEventProperties.EventId);
                builder.ComponentSelect.Add(TAreaEventProperties.RoundNum);
            }
            else
            {
                builder.ComponentSelect.Add(TAreaEventProperties.AreaId);
                builder.ComponentSelect.Add(TAreaEventProperties.EventId);
                builder.ComponentSelect.Add(TAreaEventProperties.RoundNum);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.AreaId, entity.AreaId, LocateType.Equal));
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.EventId, entity.EventId, LocateType.Equal));
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.RoundNum, entity.RoundNum, LocateType.Equal));
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).Select <TAreaEvent>(session, query));
        }
Exemple #2
0
        public static bool DbDelete(this TAreaEvent entity, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.AreaId, entity.AreaId, LocateType.Equal));
            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.EventId, entity.EventId, LocateType.Equal));
            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.RoundNum, entity.RoundNum, LocateType.Equal));
            return(IORMProvider.GetQueryOperator(session).Delete <TAreaEvent>(session, query));
        }
Exemple #3
0
        public static bool DbInsert(this TAreaEvent entity, DbSession session)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            InsertBuilder builder = new InsertBuilder();

            builder.ComponentInsert.Add(new ComponentValueOfInsert(TAreaEventProperties.AreaId, entity.AreaId));
            builder.ComponentInsert.Add(new ComponentValueOfInsert(TAreaEventProperties.EventId, entity.EventId));
            builder.ComponentInsert.Add(new ComponentValueOfInsert(TAreaEventProperties.RoundNum, entity.RoundNum));
            query.InsertBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).Insert <TAreaEvent>(session, query));
        }
Exemple #4
0
        public static bool DbUpdate(this TAreaEvent entity, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            UpdateBuilder builder = new UpdateBuilder();

            builder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.AreaId, entity.AreaId, LocateType.Equal));
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.EventId, entity.EventId, LocateType.Equal));
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.RoundNum, entity.RoundNum, LocateType.Equal));
            if (fields == null || fields.Length == 0)
            {
                builder.ComponentSet.Add(new ComponentValueOfSet(TAreaEventProperties.AreaId, entity.AreaId));
                builder.ComponentSet.Add(new ComponentValueOfSet(TAreaEventProperties.EventId, entity.EventId));
                builder.ComponentSet.Add(new ComponentValueOfSet(TAreaEventProperties.RoundNum, entity.RoundNum));
            }
            else
            {
            }
            query.UpdateBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).Update <TAreaEvent>(session, query));
        }
Exemple #5
0
 public static void DbLoad(this TAreaEvent entity, DbSession session, params PDMDbProperty[] fields)
 {
     var result = entity.DbSelect(session, fields);
 }