예제 #1
0
 public Page<ActivityInvo> GetActivityList(ActivitySerachCondition searchCondition, int pageNum)
 {
     this.Session["ActivitySerachCondition"] = searchCondition;
     ActivityBLL ybll = new ActivityBLL();
     Page<ActivityInvo> page = new Page<ActivityInvo>();
     return ybll.GetActivityList(searchCondition, pageNum);
 }
예제 #2
0
        public Page<ActivityInvo> GetActivityList(ActivitySerachCondition searchCondition, int pageNum, bool IsPrint)
        {
            ICriteria criteria = this.IActivityManage.NativeHibernateSession.CreateCriteria(typeof(ActivityInvo));
            Page<ActivityInvo> activityInfoPage = new Page<ActivityInvo> {
            CurrentPageIndex = pageNum
            };
            try
            {
            criteria = criteria.Add(Restrictions.Between("CreateDate", searchCondition.CreateBeginDate, searchCondition.CreateEndDate))
                .Add(Restrictions.Or(Restrictions.Or(Restrictions.IsNull("ActivityBeginDate"), Restrictions.Between("ActivityBeginDate", searchCondition.ActivityBeginDate, searchCondition.ActivityEndDate)), Restrictions.Or(Restrictions.IsNull("ActivityEndDate"), Restrictions.Between("ActivityEndDate", searchCondition.ActivityBeginDate, searchCondition.ActivityEndDate))));

            if (searchCondition.ActivityType != "-1")
            {
                criteria.Add(Restrictions.Eq("ActivityType", searchCondition.ActivityType));
            }
            if (searchCondition.ActivityState != "-1")
            {
                criteria.Add(Restrictions.Eq("ActivityStatus", searchCondition.ActivityState));
            }
            if (searchCondition.CustormerContractor != "-1")
            {
                criteria.Add(Restrictions.Eq("CustomerContractor", searchCondition.CustormerContractor));
            }
            if (searchCondition.Operator != "-1")
            {
                criteria.Add(Restrictions.Eq("OperatorContractor", searchCondition.Operator));
            }
            if ((searchCondition.ActivityDesCity != null) && (searchCondition.ActivityDesCity != ""))
            {
                criteria.Add(Restrictions.Eq("ActivityDesCity", searchCondition.ActivityDesCity));
            }
            if ((searchCondition.MemberCode != null) && (searchCondition.MemberCode != ""))
            {
                criteria.Add(Restrictions.Eq("ActivityOrgMemberCode", searchCondition.MemberCode));
            }
            if (searchCondition.ManageRegionId != -1)
            {
                criteria.CreateCriteria("RegionInfo").Add(Restrictions.Eq("RegionId", searchCondition.ManageRegionId));
            }
            if (searchCondition.ActicityDesRegionId != -1)
            {
                criteria.CreateCriteria("ActivityDesRegionInfo").Add(Restrictions.Eq("RegionId", searchCondition.ActicityDesRegionId));
            }
            criteria = this.IActivityManage.GetICriteriaByLgCondition<string, string>("ActivityCode", criteria, searchCondition.ActivityMinCode, searchCondition.ActivityMaxCode);
            activityInfoPage.TotalCount = criteria.SetResultTransformer(CriteriaUtil.DistinctRootEntity).List<ActivityInvo>().Count;
            if (IsPrint)
            {
                activityInfoPage.Data = criteria.SetResultTransformer(CriteriaUtil.DistinctRootEntity).List<ActivityInvo>();
                return activityInfoPage;
            }
            criteria.AddOrder(new Order("CreateDate",false));
            activityInfoPage.Data = criteria.SetResultTransformer(CriteriaUtil.DistinctRootEntity).SetFirstResult((activityInfoPage.CurrentPageIndex - 1) * activityInfoPage.PageSize).SetMaxResults(activityInfoPage.PageSize).List<ActivityInvo>();
            }
            catch (Exception)
            {
            activityInfoPage = null;
            }
            return activityInfoPage;
        }
예제 #3
0
 public Page<ActivityInvo> GetActivityList(ActivitySerachCondition searchCondition, int pageNum)
 {
     return this.GetActivityList(searchCondition, pageNum, false);
 }