Esempio n. 1
0
        public static T ListFirst <T>(this StoredProcedure parameter, IConnectinContext cc) where T : new()
        {
            IList <T> items = cc.ListProc <T>(parameter);

            if (items != null && items.Count > 0)
            {
                return(items[0]);
            }
            return(default(T));
        }
Esempio n. 2
0
        public static object ExecProcToObject(Type type, IConnectinContext cc, object parameter)
        {
            IList items = cc.ListProc(type, parameter);

            if (items != null && items.Count > 0)
            {
                return(items[0]);
            }
            return(null);
        }
Esempio n. 3
0
        public object Execute(IConnectinContext cc, object value, HandlerValueType type)
        {
            string[] orderby  = DBContext.CurrentOrderBy;
            Region   curegion = DBContext.CurrentRegion;

            DBContext.CurrentRegion  = null;
            DBContext.CurrentOrderBy = null;

            switch (type)
            {
            case HandlerValueType.String:
                string str = (string)value;
                if (GetValue.IsSelectSQL(str))
                {
                    return(new SQL(str).List(Type, cc, curegion));
                }
                else
                {
                    Expression exp = new Expression(str);
                    return(exp.List(Type, cc, curegion, orderby));
                }

            case HandlerValueType.SQL:
                return(((SQL)value).List(Type, cc, curegion));

                break;

            case HandlerValueType.PROC:
                return(cc.ListProc(Type, value));

            case HandlerValueType.EXPRESSION:
                return(((Expression)value).List(Type, cc, curegion, orderby));

            default:
                throw new PeanutException("object is not a [SQL,StoredProcedure,Expression]!");
            }
        }
Esempio n. 4
0
 public static IList <T> List <T>(this StoredProcedure parameter, IConnectinContext cc) where T : new()
 {
     return(cc.ListProc <T>(parameter));
 }
Esempio n. 5
0
 public static IList <T> ExecProcToObjects <T>(IConnectinContext cc, object parameter) where T : new()
 {
     return(cc.ListProc <T>(parameter));
 }