Exemplo n.º 1
0
        public virtual bool Insert(T businessObject)
        {
            string sql = mStoreProcedurePrefix + "AddUpdate";

            businessObject.ID = Extensions.AsLong(DbAdapter1.ExcecuteScalar(sql, true, Take(businessObject)));

            if (businessObject.ID > 0)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public virtual IList <T> GetFilter(List <string> parms, string storeName = "")
        {
            switch (ConnectionName)
            {
            case "Default":
                return(DbAdapter1.ReadList(storeName, Make, true, parms.ToArray()));

            case "Inside":
                return(DbAdapter2.ReadList(storeName, Make, true, parms.ToArray()));

            default:
                return(DbAdapter1.ReadList(storeName, Make, true, parms.ToArray()));
            }
        }
Exemplo n.º 3
0
        public virtual int UpdateCustomField(object[] parms, string sql)
        {
            switch (ConnectionName)
            {
            case "Default":
                return(Convert.ToInt32(DbAdapter1.ExcecuteScalar(sql, false, parms)));

            case "Inside":
                return(Convert.ToInt32(DbAdapter2.ExcecuteScalar(sql, false, parms)));

            default:
                return(Convert.ToInt32(DbAdapter1.ExcecuteScalar(sql, false, parms)));
            }
        }
Exemplo n.º 4
0
        public virtual DataTable GetDataTable(object[] parms, string sql)
        {
            switch (ConnectionName)
            {
            case "Default":
                return(DbAdapter1.ReadDataTable(sql, true, parms));

            case "Inside":
                return(DbAdapter2.ReadDataTable(sql, true, parms));

            default:
                return(DbAdapter1.ReadDataTable(sql, true, parms));
            }
        }
Exemplo n.º 5
0
        public virtual T GetSingleObject(List <string> parms, string storeProcedure)
        {
            switch (ConnectionName)
            {
            case "Default":
                return(DbAdapter1.Read(storeProcedure, Make, true, parms.ToArray()));

            case "Inside":
                return(DbAdapter2.Read(storeProcedure, Make, true, parms.ToArray()));

            default:
                return(DbAdapter1.Read(storeProcedure, Make, true, parms.ToArray()));
            }
        }
Exemplo n.º 6
0
        public virtual object GetSingleData(List <string> parms, string storeProcedure)
        {
            switch (ConnectionName)
            {
            case "Default":
                return(DbAdapter1.ExcecuteScalar(storeProcedure, true, parms.ToArray()));

            case "Inside":
                return(DbAdapter2.ExcecuteScalar(storeProcedure, true, parms.ToArray()));

            default:
                return(DbAdapter1.ExcecuteScalar(storeProcedure, true, parms.ToArray()));
            }
        }
Exemplo n.º 7
0
        public virtual IList <T> GetList(object[] parms)
        {
            string sql = StoreProcedurePrefix + "GetList";

            switch (ConnectionName)
            {
            case "Default":
                return(DbAdapter1.ReadList <T>(sql, Make, true, parms));

            case "Inside":
                return(DbAdapter2.ReadList <T>(sql, Make, true, parms));

            default:
                return(DbAdapter1.ReadList <T>(sql, Make, true, parms));
            }
        }
Exemplo n.º 8
0
        public virtual T GetSingle(long entityID)
        {
            string sql = string.Format(@"SELECT * FROM {0} WHERE {1} = @EntityID", mTableName, mEntityIDName);

            object[] parms = { "@EntityID", entityID };
            switch (ConnectionName)
            {
            case "Default":
                return(DbAdapter1.Read(sql, Make, false, parms));

            case "Inside":
                return(DbAdapter2.Read(sql, Make, false, parms));

            default:
                return(DbAdapter1.Read(sql, Make, false, parms));
            }
        }
Exemplo n.º 9
0
 public int Clear(string tableName = "")
 {
     object[] parms = new object[] { "@tableName", tableName };
     return(Convert.ToInt32(DbAdapter1.ExcecuteScalar("spFieldListAuto_Clear", true, parms)));
 }
Exemplo n.º 10
0
 public virtual IList <T> GetListByCustomDataSource(object[] parms, string dataSource)
 {
     return(DbAdapter1.ReadList(dataSource, Make, true, parms));
 }
Exemplo n.º 11
0
        public virtual int Count()
        {
            string sql = string.Format(@"SELECT count({0}) FROM {1}", mEntityIDName, TableName);

            return(DbAdapter1.ExcecuteScalar(sql, false, null).AsInt());
        }
Exemplo n.º 12
0
        public virtual IList <T> GetAll()
        {
            string sql = Extensions.OrderBy(string.Format(@"SELECT * FROM {0}", TableName), mEntityIDName + " desc");

            return(DbAdapter1.ReadList(sql, Make, false));
        }
Exemplo n.º 13
0
 public virtual DataTable GetDataTable(object[] parms, string sql)
 {
     return(DbAdapter1.ReadDataTable(sql, true, parms));
 }
Exemplo n.º 14
0
 public virtual int UpdateByCustomDataSource(object[] parms, string dataSource)
 {
     return(Convert.ToInt32(DbAdapter1.ExcecuteScalar(dataSource, true, parms)));
 }
Exemplo n.º 15
0
 public virtual T GetSingleByCustomDataSource(object[] parms, string dataSource)
 {
     return(DbAdapter1.Read(dataSource, Make, true, parms));
 }