예제 #1
0
        public List <ReservationsInfo> GetReservationsPagerByRule(ReservationsSearchEntity serach, PagerInfo pager)
        {
            List <ReservationsInfo> result = new List <ReservationsInfo>();


            StringBuilder builder = new StringBuilder();

            if (serach.CustomerID > 0)
            {
                builder.Append(" AND CustomerID=@CustomerID ");
            }
            if (!string.IsNullOrEmpty(serach.RType))
            {
                builder.Append(" AND RType =@RType ");
            }
            if (!string.IsNullOrEmpty(serach.PayType))
            {
                builder.Append(" AND PayType=@PayType ");
            }
            if (serach.Status > -2)
            {
                builder.Append(" AND Status=@Status ");
            }

            string sql = ReservationsStatement.GetReservationPagerHeader + builder.ToString() + ReservationsStatement.GetReservationPagerFooter;

            DataCommand command = new DataCommand(ConnectionString, GetDbCommand(sql, "Text"));

            if (serach.CustomerID > 0)
            {
                command.AddInputParameter("@CustomerID", DbType.Int64, serach.CustomerID);
            }
            if (!string.IsNullOrEmpty(serach.RType))
            {
                command.AddInputParameter("@RType", DbType.Int32, serach.RType);
            }
            if (!string.IsNullOrEmpty(serach.PayType))
            {
                command.AddInputParameter("@PayType", DbType.String, serach.PayType);
            }
            if (serach.Status > -2)
            {
                command.AddInputParameter("@Status", DbType.Int32, serach.Status);
            }
            command.AddInputParameter("@PageIndex", DbType.Int32, pager.PageIndex);
            command.AddInputParameter("@PageSize", DbType.Int32, pager.PageSize);
            command.AddInputParameter("@recordCount", DbType.Int32, pager.SumCount);

            result = command.ExecuteEntityList <ReservationsInfo>();


            return(result);
        }
예제 #2
0
        public int GetReservationsCount(ReservationsSearchEntity serach)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(ReservationsStatement.GetReservationCount);
            if (serach.CustomerID > 0)
            {
                builder.Append(" AND CustomerID=@CustomerID ");
            }
            if (!string.IsNullOrEmpty(serach.RType))
            {
                builder.Append(" AND RType =@RType ");
            }
            if (!string.IsNullOrEmpty(serach.PayType))
            {
                builder.Append(" AND PayType=@PayType ");
            }

            DataCommand command = new DataCommand(ConnectionString, GetDbCommand(builder.ToString(), "Text"));

            if (serach.CustomerID > 0)
            {
                command.AddInputParameter("@CustomerID", DbType.Int64, serach.CustomerID);
            }
            if (!string.IsNullOrEmpty(serach.RType))
            {
                command.AddInputParameter("@RType", DbType.String, serach.RType);
            }
            if (!string.IsNullOrEmpty(serach.PayType))
            {
                command.AddInputParameter("@PayType", DbType.String, serach.PayType);
            }


            var o = command.ExecuteScalar <object>();

            return(Convert.ToInt32(o));
        }