Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("search"))
            {
                m_Filter = UserGetPropFilter.GetFromForm();

                m_Filter.Apply("filter", "page");
            }

            m_Filter = UserGetPropFilter.GetFromFilter("filter");

            int page = _Request.Get <int>("page", 0);

            m_Collection = LogManager.GetUserGetPropCollection(Filter, page);
            m_TotalCount = m_Collection.TotalRecords;
        }
Пример #2
0
 public static UserGetPropCollection GetUserGetPropCollection(UserGetPropFilter filter, int page)
 {
     return(OperationLogDao.Instance.GetUserGetPropCollection(filter, page));
 }
Пример #3
0
        public override UserGetPropCollection GetUserGetPropCollection(UserGetPropFilter filter, int pageNumber)
        {
            using (SqlQuery query = new SqlQuery())
            {
                StringBuilder condition = new StringBuilder();

                string SordField;

                switch (filter.Order)
                { 
                    case UserGetPropFilter.OrderBy.CreateDate:
                        SordField = "CreateDate";
                        break;
                    case UserGetPropFilter.OrderBy.PropID:
                        SordField = "PropID";
                        break;
                    case UserGetPropFilter.OrderBy.UserID:
                        SordField = "UserID";
                        break;
                    default: 
                        SordField = ""; 
                        break;
                }

                if (filter.UserID != null)
                {
                    condition.Append(" AND UserID=@UserID");
                    query.CreateParameter<int>("@UserID", filter.UserID.Value, SqlDbType.Int);
                }

                if (false == string.IsNullOrEmpty(filter.Username))
                {
                    condition.Append(" AND Username=@Username");
                    query.CreateParameter<string>("@Username", filter.Username, SqlDbType.NVarChar, 50);
                }

                if (filter.PropID != null)
                {
                    condition.Append(" AND PropID=@PropID");
                    query.CreateParameter<int>("@PropID", filter.PropID.Value, SqlDbType.Int);
                }

                if (filter.GetPropType != null)
                {
                    condition.Append(" AND GetPropType=@GetPropType");
                    query.CreateParameter<byte>("@GetPropType", (byte)filter.GetPropType.Value, SqlDbType.TinyInt);
                }

                if (filter.BeginDate != null)
                {
                    condition.Append(" AND OperationDate>=@BeginDate");
                    query.CreateParameter<DateTime>("@BeginDate", filter.BeginDate.Value, SqlDbType.DateTime);
                }

                if (filter.EndDate != null)
                {
                    condition.Append(" AND OperationDate<=@EndDate");
                    query.CreateParameter<DateTime>("@EndDate", filter.EndDate.Value, SqlDbType.DateTime);
                }

                query.Pager.TableName = "bx_UserGetPropLogs";
                query.Pager.IsDesc = filter.IsDesc;
                query.Pager.PageSize = filter.PageSize;
                query.Pager.PageNumber = pageNumber;
                query.Pager.PrimaryKey = "LogID";
                query.Pager.SelectCount = true;
                query.Pager.SortField = SordField;

                if (condition.Length > 0)
                {
                    query.Pager.Condition = condition.ToString().Substring(4);
                }

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    UserGetPropCollection collection = new UserGetPropCollection(reader);
                    if (reader.NextResult())
                    {
                        if (reader.Next)
                        collection.TotalRecords = (int)reader[0];
                    }
                    return collection;
                }
            }
        }
Пример #4
0
 public static UserGetPropCollection GetUserGetPropCollection(UserGetPropFilter filter, int page)
 {
     return OperationLogDao.Instance.GetUserGetPropCollection(filter, page);
 }
Пример #5
0
 public abstract UserGetPropCollection GetUserGetPropCollection(UserGetPropFilter filter, int pageNumber);
Пример #6
0
        public override UserGetPropCollection GetUserGetPropCollection(UserGetPropFilter filter, int pageNumber)
        {
            using (SqlQuery query = new SqlQuery())
            {
                StringBuilder condition = new StringBuilder();

                string SordField;

                switch (filter.Order)
                {
                case UserGetPropFilter.OrderBy.CreateDate:
                    SordField = "CreateDate";
                    break;

                case UserGetPropFilter.OrderBy.PropID:
                    SordField = "PropID";
                    break;

                case UserGetPropFilter.OrderBy.UserID:
                    SordField = "UserID";
                    break;

                default:
                    SordField = "";
                    break;
                }

                if (filter.UserID != null)
                {
                    condition.Append(" AND UserID=@UserID");
                    query.CreateParameter <int>("@UserID", filter.UserID.Value, SqlDbType.Int);
                }

                if (false == string.IsNullOrEmpty(filter.Username))
                {
                    condition.Append(" AND Username=@Username");
                    query.CreateParameter <string>("@Username", filter.Username, SqlDbType.NVarChar, 50);
                }

                if (filter.PropID != null)
                {
                    condition.Append(" AND PropID=@PropID");
                    query.CreateParameter <int>("@PropID", filter.PropID.Value, SqlDbType.Int);
                }

                if (filter.GetPropType != null)
                {
                    condition.Append(" AND GetPropType=@GetPropType");
                    query.CreateParameter <byte>("@GetPropType", (byte)filter.GetPropType.Value, SqlDbType.TinyInt);
                }

                if (filter.BeginDate != null)
                {
                    condition.Append(" AND OperationDate>=@BeginDate");
                    query.CreateParameter <DateTime>("@BeginDate", filter.BeginDate.Value, SqlDbType.DateTime);
                }

                if (filter.EndDate != null)
                {
                    condition.Append(" AND OperationDate<=@EndDate");
                    query.CreateParameter <DateTime>("@EndDate", filter.EndDate.Value, SqlDbType.DateTime);
                }

                query.Pager.TableName   = "bx_UserGetPropLogs";
                query.Pager.IsDesc      = filter.IsDesc;
                query.Pager.PageSize    = filter.PageSize;
                query.Pager.PageNumber  = pageNumber;
                query.Pager.PrimaryKey  = "LogID";
                query.Pager.SelectCount = true;
                query.Pager.SortField   = SordField;

                if (condition.Length > 0)
                {
                    query.Pager.Condition = condition.ToString().Substring(4);
                }

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    UserGetPropCollection collection = new UserGetPropCollection(reader);
                    if (reader.NextResult())
                    {
                        if (reader.Next)
                        {
                            collection.TotalRecords = (int)reader[0];
                        }
                    }
                    return(collection);
                }
            }
        }