Example #1
0
        /// <summary>
        /// 执行数据对象修改
        /// </summary>
        /// <param name="tablebase">数据对象</param>
        /// <param name="where">条件对像</param>
        public virtual int Update(TableBase tablebase, TableBase where)
        {
            if (tablebase.TableCondition.IsStoredProcedure)
            {
                return(Execute(tablebase.TableCondition.TableName, true, CreateParameter(tablebase)));
            }
            TableToSQL ts = this.CreateTableToSQL(tablebase);

            return(Execute(ts.GetUpdate(where), false, ts.GetPartemter));
        }
Example #2
0
        /// <summary>
        /// 获取第一行第一列的数据
        /// </summary>
        /// <typeparam name="T">对象类型</typeparam>
        /// <param name="tablebase">对象</param>
        public virtual T GetScalar <T>(TableBase tablebase)
        {
            if (tablebase.TableCondition.IsStoredProcedure)
            {
                return(GetScalar <T>(tablebase.TableCondition.TableName, true, CreateParameter(tablebase)));
            }
            TableToSQL ts = this.CreateTableToSQL(tablebase);

            return(GetScalar <T>(ts.GetSelect(), false, ts.GetPartemter));
        }
Example #3
0
        /// <summary>
        /// 返回一个数据对象
        /// </summary>
        /// <typeparam name="T">对象类型</typeparam>
        /// <param name="tablebase">查询对象</param>
        public T GetOnlyRow <T>(TableBase tablebase)
        {
            if (tablebase.TableCondition.IsStoredProcedure)
            {
                return(GetOnlyRow <T>(tablebase.TableCondition.TableName, true, CreateParameter(tablebase)));
            }
            tablebase.TableCondition.Size = 1;
            TableToSQL ts = this.CreateTableToSQL(tablebase);

            return(GetOnlyRow <T>(ts.GetSelect(), false, ts.GetPartemter));
        }
Example #4
0
        /// <summary>
        /// 获取指定对象的记录数
        /// </summary>
        /// <param name="tablebase">对象</param>
        public virtual int GetCount(TableBase tablebase)
        {
            if (tablebase.TableCondition.IsStoredProcedure)
            {
                return(GetScalar <int>(tablebase.TableCondition.TableName, true, CreateParameter(tablebase)));
            }

            tablebase.TableCondition.Size  = 1;
            tablebase.TableCondition.Field = "COUNT(*)";
            TableToSQL ts = this.CreateTableToSQL(tablebase);

            return(Convert.ToInt32(GetScalar(ts.GetSelect(), false, ts.GetPartemter)));
        }