Esempio n. 1
0
        public ActionResult CacheHelper()
        {
            AdminBiz        adminBiz   = AdminBiz.GetInstant();
            TableCountModel tableCount = adminBiz.getTableCount();

            ViewData[typeof(TableCountModel).Name] = tableCount;
            return(View());
        }
Esempio n. 2
0
        public TableCountModel getTableCount()
        {
            TableCountModel tableCount = CACHE_TABLE_COUNT;

            if (tableCount == null || tableCount.isTimeout())
            {
                IQuery iquery = GetNameQuery("procUpdateTableCount");
                iquery.ExecuteUpdate();
                this.OpenSession();
                tableCount = this.session.Load <TableCountModel>("system");
                tableCount.setTimeout(300000);
                this.CloseSession();
            }
            return(tableCount);
        }
Esempio n. 3
0
        private DatagridObject createGuestDatagrid(string status, string type, string qtGuestName, string qvGuestName)
        {
            DatagridObject     datagrid = null;
            ICriteria          icr;
            IList <GuestModel> listHotel;

            icr = BaseZdBiz.CreateCriteria <GuestModel>();


            if (type == "")
            {
                icr.Add(Restrictions.Eq("status", status));
            }
            else
            {
                icr.Add(Restrictions.And(Restrictions.Eq("status", status), Restrictions.Eq("type", type)));
            }

            if (!string.IsNullOrEmpty(qvGuestName) && !string.IsNullOrEmpty(qtGuestName))
            {
                //带条件查询使用集合切割策略进行分页
                if (qtGuestName == "cn")
                {
                    icr.Add(Restrictions.Like("nameCn", "%" + qvGuestName + "%"));
                }
                else if (qtGuestName == "en")
                {
                    icr.Add(Restrictions.Like("nameEn", "%" + qvGuestName + "%"));
                }
                else if (qtGuestName == "idcard")
                {
                    icr.Add(Restrictions.Eq("idNumber", qvGuestName));
                }
                else
                {
                    return(DatagridObject.NewIntanst());
                }

                new GuestModel().setOrderBy(ref icr);
                listHotel = icr.List <GuestModel>();
                PageList <GuestModel> pagerList = new PageList <GuestModel>(listHotel, this.getPager());
                datagrid = DatagridObject.ToDatagridObject <GuestModel>(pagerList);
            }
            else
            {
                //不带条件查询使用分页缓存进行分页
                icr = BaseZdBiz.CreateCriteria <GuestModel>(this.getPager());
                if (type == "")
                {
                    icr.Add(Restrictions.Eq("status", status));
                }
                else
                {
                    icr.Add(Restrictions.And(Restrictions.Eq("status", status), Restrictions.Eq("type", type)));
                }
                // icr.Add(Restrictions.Eq("status", status));
                new GuestModel().setOrderBy(ref icr);
                listHotel = icr.List <GuestModel>();
                AdminBiz        adminBiz   = AdminBiz.GetInstant();
                TableCountModel tableCount = adminBiz.getTableCount();
                datagrid = DatagridObject.ToDatagridObject <GuestModel>(listHotel, tableCount.hotelOk);
            }
            return(datagrid);
        }
Esempio n. 4
0
        private DatagridObject createHotelDatagrid(string status, string isreserve, string qHotelNameType, string qHotelNameVal)
        {
            DatagridObject     datagrid = null;
            ICriteria          icr      = null;
            IList <HotelModel> listHotel;
            bool isQuery = !string.IsNullOrEmpty(qHotelNameVal) && !string.IsNullOrEmpty(qHotelNameType);

            if (isQuery)
            {
                icr = BaseZdBiz.CreateCriteria <HotelModel>();
            }
            else
            {
                icr = BaseZdBiz.CreateCriteria <HotelModel>(this.getPager());
            }

            icr.Add(Restrictions.And(Restrictions.Eq("isreserve", isreserve), Restrictions.Eq("status", status)));

            if (isQuery)
            {
                //带条件查询使用集合切割策略进行分页

                if (qHotelNameType == "cn")
                {
                    icr.Add(Restrictions.Like("hotelName", "%" + qHotelNameVal + "%"));
                }
                else if (qHotelNameType == "en")
                {
                    icr.Add((Restrictions.Like("hotelNameEn", "%" + qHotelNameVal + "%")));
                }
                else
                {
                    return(DatagridObject.NewIntanst());
                }

                //icr.Add(Restrictions.Eq("isreserve", status));
                new HotelModel().setOrderBy(ref icr);

                listHotel = icr.List <HotelModel>();
                PageList <HotelModel> pagerList = new PageList <HotelModel>(listHotel, this.getPager());
                datagrid = DatagridObject.ToDatagridObject <HotelModel>(pagerList);
            }
            else
            {
                //不带条件查询使用分页缓存进行分页


                new HotelModel().setOrderBy(ref icr);

                listHotel = icr.List <HotelModel>();
                AdminBiz        adminBiz   = AdminBiz.GetInstant();
                TableCountModel tableCount = adminBiz.getTableCount();
                int             total      = 0;
                if (isreserve == HotelModel.RESERVE_OK)
                {
                    total = tableCount.hotelOk;
                }
                else if (isreserve == HotelModel.RESERVE_CLOSED)
                {
                    total = tableCount.hotelClosed;
                }
                else if (isreserve == HotelModel.RESERVE_DELETED)
                {
                    total = tableCount.hotelDel;
                }
                datagrid = DatagridObject.ToDatagridObject <HotelModel>(listHotel, total);
            }
            return(datagrid);
        }