Esempio n. 1
0
        protected void InitHotelList()
        {
            EyouSoft.BLL.SupplierStructure.SupplierHotel hotelBll = new EyouSoft.BLL.SupplierStructure.SupplierHotel();
            //搜索条件
            EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo searchInfo = new EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo();
            //省份ID
            searchInfo.ProvinceId = Utils.GetInt(Utils.GetQueryStringValue("ProId"));
            if (searchInfo.ProvinceId == 0)
            {
                searchInfo.ProvinceId = null;
            }
            //城市ID
            searchInfo.CityId = Utils.GetInt(Utils.GetQueryStringValue("CityId"));
            if (searchInfo.CityId == 0)
            {
                searchInfo.CityId = null;
            }
            //酒店名称
            searchInfo.Name = Server.UrlDecode(Utils.GetQueryStringValue("HotelName"));
            //星级
            searchInfo.Star = (EyouSoft.Model.EnumType.SupplierStructure.HotelStar?)Utils.GetInt(Utils.GetQueryStringValue("Star"));
            if (searchInfo.Star == 0)
            {
                searchInfo.Star = null;
            }
            //取得请求结果list
            IList <EyouSoft.Model.SupplierStructure.SupplierHotelInfo> list = hotelBll.GetSiteHotels(companyId, pageSize, pageIndex, ref recordCount, searchInfo);

            //list赋给repeater的数据源
            rptTourList.DataSource = list;
            if (list != null && list.Count > 0)
            {
                //显示分页控件
                this.ExporPageInfoSelect1.Visible = true;
                //repeater绑定数据
                rptTourList.DataBind();
                //分页绑定
                BindExportPage();
                //无数据提示控件隐藏
                this.lblMsg.Visible = false;
            }
            else
            {
                //隐藏分页控件
                this.ExporPageInfoSelect1.Visible = false;
                this.lblMsg.Text = "未查找到相关的酒店信息";
                //显示无数据提示控件
                this.lblMsg.Visible = true;
            }
            //为查询控件赋值
            BindSearch(searchInfo, companyId);
        }
Esempio n. 2
0
        /// <summary>
        /// init hotels
        /// </summary>
        void InitHotels()
        {
            int pageIndex   = Utils.GetInt(Utils.GetQueryStringValue("Page"), 1);
            int recordCount = 0;
            int pageSize    = 10;

            EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo searchInfo = new EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo();

            searchInfo.ProvinceId = Utils.GetIntNull(Utils.GetQueryStringValue("provinceid"));
            searchInfo.CityId     = Utils.GetIntNull(Utils.GetQueryStringValue("cityid"));
            searchInfo.Name       = Server.UrlDecode(Utils.GetQueryStringValue("name"));
            searchInfo.Star       = (EyouSoft.Model.EnumType.SupplierStructure.HotelStar?)Utils.GetEnumValue(typeof(EyouSoft.Model.EnumType.SupplierStructure.HotelStar), Utils.GetQueryStringValue("star"), null);

            if (searchInfo.ProvinceId.HasValue && searchInfo.ProvinceId.Value == 0)
            {
                searchInfo.ProvinceId = null;
            }
            if (searchInfo.CityId.HasValue && searchInfo.CityId.Value == 0)
            {
                searchInfo.CityId = null;
            }

            var items = new EyouSoft.BLL.SupplierStructure.SupplierHotel().GetSiteHotels(Master.CompanyId, pageSize, pageIndex, ref recordCount, searchInfo);

            if (items != null && items.Count > 0)
            {
                rpt.DataSource = items;
                rpt.DataBind();

                divPaging.Visible = true;
                divEmpty.Visible  = false;

                paging.PageLinkURL = Request.ServerVariables["SCRIPT_NAME"].ToString() + "?";
                paging.UrlParams.Add(Request.QueryString);
                paging.intPageSize    = pageSize;
                paging.CurrencyPage   = pageIndex;
                paging.intRecordCount = recordCount;
            }
            else
            {
                divPaging.Visible = false;
                divEmpty.Visible  = true;
            }
        }
Esempio n. 3
0
        protected void BindSearch(EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo searchInfo, int companyId)
        {
            if (searchInfo != null)
            {
                //省份下拉框
                this.ddlPro.SelectedValue = Convert.ToString(searchInfo.ProvinceId);
                EyouSoft.BLL.CompanyStructure.City cityBll = new EyouSoft.BLL.CompanyStructure.City();
                if (ddlPro.SelectedValue != "0")
                {
                    IList <EyouSoft.Model.CompanyStructure.City> list = cityBll.GetList(companyId, (int?)Convert.ToInt32(searchInfo.ProvinceId), null);
                    if (list != null && list.Count > 0)
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            ListItem item = new ListItem();
                            item.Text  = list[i].CityName;
                            item.Value = Convert.ToString(list[i].Id);
                            this.ddlCity.Items.Add(item);
                        }
                    }
                }


                //城市下拉框
                this.ddlCity.SelectedValue = Convert.ToString(searchInfo.CityId);
                //星级下拉框
                if (searchInfo.Star == null)
                {
                    BindStatrs(0);
                }
                else
                {
                    BindStatrs((int)searchInfo.Star);
                }
                //酒店名称
                this.hotelName.Value = searchInfo.Name;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 导出Excel
        /// </summary>
        public void CreateExcel(string FileName)
        {
            province        = Utils.GetInt(Utils.GetQueryStringValue("province"));
            city            = Utils.GetInt(Utils.GetQueryStringValue("city"));
            TxtHotelName    = Utils.GetQueryStringValue("HotelName");
            HotelStartValue = Utils.GetInt(Utils.GetQueryStringValue("HotelStartValue"));
            //列表数据绑定
            Response.Clear();
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName + ".xls");
            Response.ContentEncoding = System.Text.Encoding.Default;
            Response.ContentType     = "application/ms-excel";

            EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo Searchinfo = new EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo();
            if (city == 0)
            {
                Searchinfo.CityId = null;
            }
            else
            {
                Searchinfo.CityId = city;
            }

            Searchinfo.Name = TxtHotelName;

            if (province == 0)
            {
                Searchinfo.ProvinceId = null;
            }
            else
            {
                Searchinfo.ProvinceId = province;
            }
            if (HotelStartValue == 0)
            {
                Searchinfo.Star = null;
            }
            else
            {
                Searchinfo.Star = (EyouSoft.Model.EnumType.SupplierStructure.HotelStar)Enum.Parse(typeof(EyouSoft.Model.EnumType.SupplierStructure.HotelStar), HotelStartValue.ToString());
            }

            //总记录数
            int Count = Utils.GetInt(Utils.GetFormValue("hidRecordCount"));

            if (Count == 0)
            {
                Count = 100;
            }

            IList <EyouSoft.Model.SupplierStructure.SupplierHotelInfo> list = null;

            list = HotelBll.GetHotels(SiteUserInfo.CompanyID, Count, 1, ref RecordCount, Searchinfo);
            //取得数据表各列标题,各标题之间以\t分割,最后一个列标题后加回车符
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\n", "所在地", "单位名称", "星级", "联系人", "电话", "传真", "交易情况");
            foreach (EyouSoft.Model.SupplierStructure.SupplierHotelInfo sh in list)
            {
                sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\n",
                                sh.ProvinceName + " " + sh.CityName, sh.UnitName, sh.Star,
                                sh.SupplierContact == null ? "" : sh.SupplierContact[0].ContactName,
                                sh.SupplierContact == null ? "" : sh.SupplierContact[0].ContactTel,
                                sh.SupplierContact == null ? "" : sh.SupplierContact[0].ContactFax,
                                sh.TradeNum);
            }
            Response.Write(sb.ToString());
            Response.End();
            list = null;
        }
Esempio n. 5
0
        protected void DataInit()
        {
            //初使化条件
            PageIndex       = Utils.GetInt(Utils.GetQueryStringValue("page"), 1);
            province        = Utils.GetIntNull(Utils.GetQueryStringValue("province"));
            city            = Utils.GetIntNull(Utils.GetQueryStringValue("city"));
            TxtHotelName    = Utils.GetQueryStringValue("HotelName");
            HotelStartValue = Utils.GetInt(Utils.GetQueryStringValue("HotelStartValue"));
            if (this.HotelStartList.Items.FindByValue(HotelStartValue.ToString()) != null)
            {
                this.HotelStartList.Items.FindByValue(HotelStartValue.ToString()).Selected = true;
            }

            //查询条件初始化
            EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo Searchinfo = new EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo();
            Searchinfo.Name = TxtHotelName;

            if (city == null || city <= 0)
            {
                Searchinfo.CityId = null;
            }
            else
            {
                Searchinfo.CityId = city;
            }

            if (province == null || province <= 0)
            {
                Searchinfo.ProvinceId = null;
            }
            else
            {
                Searchinfo.ProvinceId = province;
            }

            if (HotelStartValue == 0)
            {
                Searchinfo.Star = null;
            }
            else
            {
                Searchinfo.Star = (EyouSoft.Model.EnumType.SupplierStructure.HotelStar)Enum.Parse(typeof(EyouSoft.Model.EnumType.SupplierStructure.HotelStar), HotelStartValue.ToString());
            }

            IList <EyouSoft.Model.SupplierStructure.SupplierHotelInfo> list = null;

            list = HotelBll.GetHotels(SiteUserInfo.CompanyID, PageSize, PageIndex, ref RecordCount, Searchinfo);
            if (list.Count > 0 && list != null)
            {
                //统计列表
                len = list.Count;
                //列表数据绑定
                this.RepList.DataSource = list;
                this.RepList.DataBind();
                //设置分页
                BindPage();
            }
            else
            {
                this.ExporPageInfoSelect1.Visible = false;
            }
            //初始化查询省份城市
            this.ucProvince1.ProvinceId = Utils.GetInt(province.ToString());
            this.ucCity1.CityId         = Utils.GetInt(city.ToString());
            this.ucCity1.ProvinceId     = Utils.GetInt(province.ToString());
            list = null;
        }
Esempio n. 6
0
        /// <summary>
        /// 获取酒店供应商信息集合(供应商基本信息,图片信息,房型信息。同行登录口适用)
        /// </summary>
        /// <param name="companyId">公司(专线)编号</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="info">查询信息</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.SupplierStructure.SupplierHotelInfo> GetSiteHotels(int companyId, int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo info)
        {
            if (companyId < 1)
            {
                return(null);
            }

            return(dal.GetSiteHotels(companyId, pageSize, pageIndex, ref recordCount, info));
        }
Esempio n. 7
0
        /// <summary>
        /// 获取酒店供应商信息集合(供应商基本信息,图片信息,房型信息。同行登录口适用)
        /// </summary>
        /// <param name="companyId">公司(专线)编号</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="info">查询信息</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.SupplierStructure.SupplierHotelInfo> GetSiteHotels(int companyId, int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo info)
        {
            IList <EyouSoft.Model.SupplierStructure.SupplierHotelInfo> items = new List <EyouSoft.Model.SupplierStructure.SupplierHotelInfo>();

            EyouSoft.Model.SupplierStructure.SupplierHotelInfo tmpModel = null;
            IEnumerable <XElement> xRows = null;
            XElement      xRoot          = null;
            StringBuilder cmdQuery       = new StringBuilder();
            string        tableName      = "tbl_CompanySupplier";
            string        primaryKey     = "Id";
            string        orderByString  = "Id DESC";
            StringBuilder fields         = new StringBuilder();

            #region fields

            fields.Append(" Id,ProvinceId,ProvinceName,CityId,CityName,UnitName,TradeNum,UnitAddress ");
            fields.Append(" ,(select Id,SupplierId,PicName,PicPath from tbl_SupplierAccessory where tbl_SupplierAccessory.SupplierId = tbl_CompanySupplier.Id for xml raw,root('root')) as HotelPics ");
            fields.Append(" ,(select RoomTypeId,SupplierId,Name,SellingPrice,AccountingPrice,IsBreakfast from tbl_SupplierHotelRoomType where tbl_SupplierHotelRoomType.SupplierId = tbl_CompanySupplier.Id for xml raw,root('root')) as HotelRoomTypes ");
            fields.Append(",(SELECT Star,Introduce FROM tbl_SupplierHotel AS B WHERE B.SupplierId=tbl_CompanySupplier.Id for xml raw,root('root')) AS Star");
            #endregion

            #region 拼接查询条件

            cmdQuery.AppendFormat(" CompanyId={0} AND IsDelete='0' AND SupplierType={1} ", companyId, (int)EyouSoft.Model.EnumType.CompanyStructure.SupplierType.酒店);
            info = info ?? new EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo();
            if (info.CityId.HasValue)
            {
                cmdQuery.AppendFormat(" AND CityId={0} ", info.CityId.Value);
            }
            if (!string.IsNullOrEmpty(info.Name))
            {
                cmdQuery.AppendFormat(" AND UnitName LIKE '%{0}%' ", info.Name);
            }
            if (info.ProvinceId.HasValue)
            {
                cmdQuery.AppendFormat(" AND ProvinceId={0} ", info.ProvinceId.Value);
            }
            if (info.Star.HasValue)
            {
                cmdQuery.AppendFormat(" AND EXISTS(SELECT 1 FROM tbl_SupplierHotel AS A WHERE A.SupplierId=tbl_CompanySupplier.Id AND Star={0}) ", (int)info.Star.Value);
            }

            #endregion

            using (IDataReader rdr = DbHelper.ExecuteReader(this._db, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields.ToString(), cmdQuery.ToString(), orderByString))
            {
                while (rdr.Read())
                {
                    tmpModel = new EyouSoft.Model.SupplierStructure.SupplierHotelInfo();

                    if (!rdr.IsDBNull(0))
                    {
                        tmpModel.Id = rdr.GetInt32(0);
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        tmpModel.ProvinceId = rdr.GetInt32(1);
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        tmpModel.ProvinceName = rdr.GetString(2);
                    }
                    if (!rdr.IsDBNull(3))
                    {
                        tmpModel.CityId = rdr.GetInt32(3);
                    }
                    if (!rdr.IsDBNull(4))
                    {
                        tmpModel.CityName = rdr.GetString(4);
                    }
                    if (!rdr.IsDBNull(5))
                    {
                        tmpModel.UnitName = rdr.GetString(5);
                    }
                    if (!rdr.IsDBNull(6))
                    {
                        tmpModel.TradeNum = rdr.GetInt32(6);
                    }
                    if (!rdr.IsDBNull(7))
                    {
                        tmpModel.UnitAddress = rdr.GetString(7);
                    }

                    if (!rdr.IsDBNull(8))
                    {
                        tmpModel.SupplierPic = new List <EyouSoft.Model.SupplierStructure.SupplierPic>();
                        EyouSoft.Model.SupplierStructure.SupplierPic spModel = null;
                        xRoot = XElement.Parse(rdr.GetString(8));
                        if (xRoot != null)
                        {
                            xRows = Utils.GetXElements(xRoot, "row");
                            if (xRows != null && xRows.Count() > 0)
                            {
                                foreach (var t in xRows)
                                {
                                    spModel = new EyouSoft.Model.SupplierStructure.SupplierPic();
                                    //Id,SupplierId,PicName,PicPath
                                    spModel.Id         = Utils.GetInt(Utils.GetXAttributeValue(t, "Id"));
                                    spModel.SupplierId = Utils.GetInt(Utils.GetXAttributeValue(t, "SupplierId"));
                                    spModel.PicName    = Utils.GetXAttributeValue(t, "PicName");
                                    spModel.PicPath    = Utils.GetXAttributeValue(t, "PicPath");

                                    tmpModel.SupplierPic.Add(spModel);
                                }
                            }
                        }
                    }
                    if (!rdr.IsDBNull(9))
                    {
                        tmpModel.RoomTypes = new List <Model.SupplierStructure.SupplierHotelRoomTypeInfo>();
                        Model.SupplierStructure.SupplierHotelRoomTypeInfo shrtModel = null;
                        xRoot = XElement.Parse(rdr.GetString(9));
                        if (xRoot != null)
                        {
                            xRows = Utils.GetXElements(xRoot, "row");
                            if (xRows != null && xRows.Count() > 0)
                            {
                                foreach (var t in xRows)
                                {
                                    shrtModel = new EyouSoft.Model.SupplierStructure.SupplierHotelRoomTypeInfo();
                                    //RoomTypeId,SupplierId,Name,SellingPrice,AccountingPrice,IsBreakfast
                                    shrtModel.RoomTypeId      = Utils.GetInt(Utils.GetXAttributeValue(t, "RoomTypeId"));
                                    shrtModel.Name            = Utils.GetXAttributeValue(t, "Name");
                                    shrtModel.SellingPrice    = Utils.GetDecimal(Utils.GetXAttributeValue(t, "SellingPrice"));
                                    shrtModel.AccountingPrice = Utils.GetDecimal(Utils.GetXAttributeValue(t, "AccountingPrice"));
                                    shrtModel.IsBreakfast     = (Utils.GetXAttributeValue(t, "IsBreakfast") == "1" || Utils.GetXAttributeValue(t, "IsBreakfast").ToLower() == "true") ? true : false;

                                    tmpModel.RoomTypes.Add(shrtModel);
                                }
                            }
                        }
                    }
                    if (!rdr.IsDBNull(10))
                    {
                        xRoot = XElement.Parse(rdr.GetString(10));
                        if (xRoot != null)
                        {
                            xRows = Utils.GetXElements(xRoot, "row");
                            if (xRows != null && xRows.Count() > 0)
                            {
                                foreach (var t in xRows)
                                {
                                    tmpModel.Star      = (EyouSoft.Model.EnumType.SupplierStructure.HotelStar)Utils.GetInt(Utils.GetXAttributeValue(t, "Star"));
                                    tmpModel.Introduce = Utils.GetXAttributeValue(t, "Introduce");

                                    break;
                                }
                            }
                        }
                    }


                    items.Add(tmpModel);
                }
            }

            return(items);
        }
Esempio n. 8
0
        /// <summary>
        /// 获取酒店供应商信息集合
        /// </summary>
        /// <param name="companyId">公司(专线)编号</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="info">查询信息</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.SupplierStructure.SupplierHotelInfo> GetHotels(int companyId, int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo info)
        {
            IList <EyouSoft.Model.SupplierStructure.SupplierHotelInfo> items = new List <EyouSoft.Model.SupplierStructure.SupplierHotelInfo>();

            StringBuilder cmdQuery      = new StringBuilder();
            string        tableName     = "tbl_CompanySupplier";
            string        primaryKey    = "Id";
            string        orderByString = "Id DESC";
            StringBuilder fields        = new StringBuilder();

            #region fields
            fields.Append("Id,ProvinceId,ProvinceName,CityId,CityName,UnitName,TradeNum");
            fields.Append(",(SELECT TOP 1 ContactName,ContactTel,ContactFax,ContactMobile FROM tbl_SupplierContact AS A WHERE A.SupplierId = tbl_CompanySupplier.[Id] FOR XML RAW,ROOT('ROOT')) AS Contacters ");
            fields.Append(",(SELECT Star FROM tbl_SupplierHotel AS B WHERE B.SupplierId=tbl_CompanySupplier.Id) AS Star");
            #endregion

            #region 拼接查询条件
            cmdQuery.AppendFormat(" CompanyId={0} AND IsDelete='0' AND SupplierType={1} ", companyId, (int)EyouSoft.Model.EnumType.CompanyStructure.SupplierType.酒店);
            info = info ?? new EyouSoft.Model.SupplierStructure.SupplierHotelSearchInfo();
            if (info.CityId.HasValue)
            {
                cmdQuery.AppendFormat(" AND CityId={0} ", info.CityId.Value);
            }
            if (!string.IsNullOrEmpty(info.Name))
            {
                cmdQuery.AppendFormat(" AND UnitName LIKE '%{0}%' ", info.Name);
            }
            if (info.ProvinceId.HasValue)
            {
                cmdQuery.AppendFormat(" AND ProvinceId={0} ", info.ProvinceId.Value);
            }
            if (info.Star.HasValue)
            {
                cmdQuery.AppendFormat(" AND EXISTS(SELECT 1 FROM tbl_SupplierHotel AS A WHERE A.SupplierId=tbl_CompanySupplier.Id AND Star={0}) ", (int)info.Star.Value);
            }
            #endregion

            using (IDataReader rdr = DbHelper.ExecuteReader(this._db, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields.ToString(), cmdQuery.ToString(), orderByString))
            {
                while (rdr.Read())
                {
                    items.Add(new EyouSoft.Model.SupplierStructure.SupplierHotelInfo()
                    {
                        Id              = rdr.GetInt32(rdr.GetOrdinal("Id")),
                        ProvinceId      = rdr.GetInt32(rdr.GetOrdinal("ProvinceId")),
                        ProvinceName    = rdr["ProvinceName"].ToString(),
                        CityId          = rdr.GetInt32(rdr.GetOrdinal("CityId")),
                        CityName        = rdr["CityName"].ToString(),
                        UnitName        = rdr["UnitName"].ToString(),
                        TradeNum        = rdr.GetInt32(rdr.GetOrdinal("TradeNum")),
                        SupplierContact = this.GetSupplierContactersByXml(rdr["Contacters"].ToString()),
                        Star            = (EyouSoft.Model.EnumType.SupplierStructure.HotelStar)rdr.GetByte(rdr.GetOrdinal("Star"))
                    });
                }
            }

            return(items);
        }