Example #1
0
        public DataSet GetBBPackageList(Common.Entities.Enum.PackageClientType packageClientType, string unitCode, int is_webapp)
        {
            string sql         = "select * from smc_packageext where 1=1 and pe_usefulststus=1";
            string sClientType = EnumTranslator.TransPackageClientTypeToString(packageClientType);

            if (packageClientType != Common.Entities.Enum.PackageClientType.All)
            {
                sql += " and pe_clienttype='" + sClientType + "' and pe_isbb=1";
            }
            if (!String.IsNullOrEmpty(unitCode))
            {
                sql += " and pe_UnitCode='" + unitCode + "'";
            }
            if (is_webapp > 0)
            {
                sql += " and tablename='webapplication'";
            }
            else if (is_webapp < 0)
            {
                sql += " and tablename<>'webapplication'";
            }
            DataSet ds = this.ExecuteDataset(sql, CommandType.Text);

            return(ds);
        }
Example #2
0
        public DataSet SearchPackageList(string keyword, string category, string unitCode, Common.Entities.Enum.PackageClientType clientType, Common.Entities.Enum.PackageTrait trait, int page, int pageSize, out int pageCount, out int recordCount, string uid, int is_webapp)
        {
            if (pageSize == 0)
            {
                pageSize = 10;
            }
            string sClientType = EnumTranslator.TransPackageClientTypeToString(clientType);
            string sql         = "select * from smc_packageext where 1=1";

            sql += " and pe_usefulststus=1";
            if (!String.IsNullOrEmpty(keyword))
            {
                sql += " and pe_Name like '%" + keyword + "%'";
            }

            if (!String.IsNullOrEmpty(category))
            {
                sql += " and pe_CategoryID like '%" + category + "%'";
            }

            if (!String.IsNullOrEmpty(unitCode))
            {
                sql += " and pe_UnitCode = '" + unitCode + "'";
            }

            if (!String.IsNullOrEmpty(sClientType))
            {
                sql += " and pe_ClientType = '" + sClientType + "'";
            }

            if (is_webapp > 0)
            {
                sql += " and tablename='WebApplication' ";
            }
            else if (is_webapp < 0)
            {
                sql += " and tablename <>'WebApplication' ";
            }

            if (trait != Common.Entities.Enum.PackageTrait.All)
            {
                if (trait == Common.Entities.Enum.PackageTrait.Bibei)
                {
                    sql += " and pe_Isbb=1";
                }
                else if (trait == Common.Entities.Enum.PackageTrait.Tuijian)
                {
                    sql += " and pe_IsTJ=1";
                }
            }

            string order = "pe_CreatedTime desc";

            if (trait == Common.Entities.Enum.PackageTrait.Sc)
            {
                sql   = "select ext.* from smc_collect c join smc_packageext ext on ext.pe_id=c.pe_id where c.uid='" + uid + "'";
                sql  += " and ext.pe_usefulststus=1";
                order = "ext.pe_CreatedTime desc";
            }

            string tableName = SmartBox.Console.Common.StoredProcedureHelper.GetTableName(sql);
            string columns   = SmartBox.Console.Common.StoredProcedureHelper.GetColumns(sql);

            string where = SmartBox.Console.Common.StoredProcedureHelper.GetWhere(sql);

            if (trait == Common.Entities.Enum.PackageTrait.ZX)
            {
                columns = " top 20 " + columns;
            }


            string table = sql;

            SqlParameter[] pars = new SqlParameter[] {
                new SqlParameter("@TableName", tableName),
                new SqlParameter("@Columns", columns),
                new SqlParameter("@CurrentPageIndex", page),
                new SqlParameter("@PageSize", pageSize),
                new SqlParameter("@RecordCount", 0),
                new SqlParameter("@PAGECOUNT", 0),
                new SqlParameter("@OrderByColumns", order),
                new SqlParameter("@Where", where),
                new SqlParameter("@WITH", "")
            };
            pars[4].Direction = ParameterDirection.InputOutput;
            pars[5].Direction = ParameterDirection.InputOutput;
            DataSet ds = this.ExecuteDataset("Select_Pagination_ex", CommandType.StoredProcedure, pars);

            pageCount   = Convert.ToInt32(pars[5].Value);
            recordCount = Convert.ToInt32(pars[4].Value);

            return(ds);
        }