Пример #1
0
 /// <summary>
 /// 单个城市缓存清除
 /// </summary>
 /// <param name="CityId">城市编号</param>
 public void ClearCache(int CityId)
 {
     Model.SystemStructure.SysCity city = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(CityId);
     if (city != null)
     {
         EyouSoft.Cache.Facade.EyouSoftCache.Remove(string.Format(EyouSoft.CacheTag.System.SystemCityInfo, city.DomainName.ToLower()));
         EyouSoft.Cache.Facade.EyouSoftCache.Remove(string.Format(EyouSoft.CacheTag.System.SystemCityInfo, CityId));
     }
 }
Пример #2
0
        /// <summary>
        /// 获取城市名称
        /// </summary>
        /// <param name="cityId">城市编号</param>
        /// <returns></returns>
        internal static string GetCityName(int cityId)
        {
            string cityName = string.Empty;

            if (cityId > 0)
            {
                BLL.SystemStructure.SysCity   bll  = new EyouSoft.BLL.SystemStructure.SysCity();
                Model.SystemStructure.SysCity item = bll.GetSysCityModel(cityId);
                if (item != null)
                {
                    cityName = item.CityName;
                }
            }
            return(cityName);
        }
Пример #3
0
        /// <summary>
        /// 根据城市ID获取城市实体(含该城市下的的线路区域集合以及线路区域公司广告集合)
        /// </summary>
        /// <param name="CityId">城市ID</param>
        /// <returns>系统城市实体</returns>
        public Model.SystemStructure.SysCity GetSysCityModel(int CityId)
        {
            if (CityId <= 0)
            {
                return(null);
            }

            Model.SystemStructure.SysCity city = (Model.SystemStructure.SysCity)EyouSoft.Cache.Facade.EyouSoftCache.GetCache(
                string.Format(EyouSoft.CacheTag.System.SystemCityInfo, CityId));

            if (city != null)
            {
                return(city);
            }
            else
            {
                city = dal.GetModel(CityId, string.Empty);
                if (city != null)
                {
                    EyouSoft.Cache.Facade.EyouSoftCache.Add(string.Format(EyouSoft.CacheTag.System.SystemCityInfo, CityId), city, DateTime.Now.AddHours(1));
                }
                return(city);
            }
        }
Пример #4
0
        /// <summary>
        /// 根据城市域名获取城市实体(含该城市下的的线路区域集合以及线路区域公司广告集合)
        /// </summary>
        /// <param name="DomainName">城市域名</param>
        /// <returns>系统城市实体</returns>
        public Model.SystemStructure.SysCity GetSysCityModel(string DomainName)
        {
            if (string.IsNullOrEmpty(DomainName))
            {
                return(null);
            }

            Model.SystemStructure.SysCity city = (Model.SystemStructure.SysCity)EyouSoft.Cache.Facade.EyouSoftCache.GetCache(
                string.Format(EyouSoft.CacheTag.System.SystemCityInfo, DomainName.ToLower()));

            if (city != null)
            {
                return(city);
            }
            else
            {
                city = dal.GetModel(0, DomainName.ToLower());
                if (city != null)
                {
                    EyouSoft.Cache.Facade.EyouSoftCache.Add(string.Format(EyouSoft.CacheTag.System.SystemCityInfo, DomainName.ToLower()), city, DateTime.Now.AddHours(1));
                }
                return(city);
            }
        }
Пример #5
0
        /// <summary>
        /// 获取城市列表(含该城市下的的线路区域集合以及线路区域公司广告集合)
        /// </summary>
        /// <param name="PageSize">每页条数</param>
        /// <param name="PageIndex">当前页数</param>
        /// <param name="RecordCount">总记录数</param>
        /// <param name="OrderIndex">排序索引(0/1:城市首字母升/降序;2/3:城市ID升/降序;)</param>
        /// <param name="ProvinceId">省份ID</param>
        /// <param name="CityId">城市ID</param>
        /// <param name="IsEnabled">是否停用</param>
        /// <returns>城市列表</returns>
        public virtual IList <EyouSoft.Model.SystemStructure.SysCity> GetCityList(int PageSize, int PageIndex, ref int RecordCount
                                                                                  , int OrderIndex, int ProvinceId, int CityId, bool?IsEnabled)
        {
            IList <EyouSoft.Model.SystemStructure.SysCity> List = new List <EyouSoft.Model.SystemStructure.SysCity>();
            Dictionary <int, string> SiteArea    = new Dictionary <int, string>();
            Dictionary <int, string> AreaCompany = new Dictionary <int, string>();
            string strWhere = " 1 = 1 ";
            string strFiles = " [ID],[ProvinceId],(SELECT ProvinceName FROM tbl_SysProvince WHERE ID = [tbl_SysCity].ProvinceId) as ProvinceName,[CityName],[CenterCityId],[HeaderLetter],[ParentTourCount],[TourCount],[IsSite],[DomainName],[IsEnabled],[RewriteCode],(SELECT AreaId,AreaName,SortId,IsDefaultShow,(SELECT RouteType FROM tbl_SysArea WHERE tbl_SysArea.ID = tbl_SysCityAreaControl.AreaId) as RouteType FROM tbl_SysCityAreaControl WHERE tbl_SysCityAreaControl.CityId = [tbl_SysCity].ID order by SortId for xml auto,root('root')) AS SysAreaByCity,(SELECT AreaId,CompanyId FROM tbl_CompanyCityAd WHERE tbl_CompanyCityAd.CityId = tbl_SysCity.ID for xml auto,root('root')) as AreaCompany ";
            string strOrder = string.Empty;

            switch (OrderIndex)
            {
            case 0: strOrder = " HeaderLetter asc "; break;

            case 1: strOrder = " HeaderLetter desc "; break;

            case 2: strOrder = " ID asc "; break;

            case 3: strOrder = " ID desc "; break;

            default: strOrder = " HeaderLetter asc "; break;
            }
            if (ProvinceId > 0)
            {
                strWhere += string.Format(" and ProvinceId = {0} ", ProvinceId);
            }
            if (CityId > 0)
            {
                strWhere += string.Format(" and ID = {0} ", CityId);
            }
            if (IsEnabled != null)
            {
                strWhere += string.Format(" and IsEnabled = '{0}' ", (bool)IsEnabled ? "1" : "0");
            }

            #region 实体赋值

            using (IDataReader dr = DbHelper.ExecuteReader(base.SystemStore, PageSize, PageIndex, ref RecordCount, "tbl_SysCity", "ID", strFiles, strWhere, strOrder))
            {
                Model.SystemStructure.SysCity model = null;
                while (dr.Read())
                {
                    model = new EyouSoft.Model.SystemStructure.SysCity();
                    if (!dr.IsDBNull(0))
                    {
                        model.CityId = dr.GetInt32(0);
                    }
                    if (!dr.IsDBNull(1))
                    {
                        model.ProvinceId = dr.GetInt32(1);
                    }
                    model.ProvinceName = dr[2].ToString();
                    model.CityName     = dr[3].ToString();
                    if (!dr.IsDBNull(4))
                    {
                        model.CenterCityId = dr.GetInt32(4);
                    }
                    model.HeaderLetter = dr[5].ToString();
                    if (!dr.IsDBNull(6))
                    {
                        model.ParentTourCount = dr.GetInt32(6);
                    }
                    if (!dr.IsDBNull(7))
                    {
                        model.TourCount = dr.GetInt32(7);
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("IsSite")) && dr["IsSite"].Equals("1"))
                    {
                        model.IsSite = true;
                    }
                    else
                    {
                        model.IsSite = false;
                    }
                    model.DomainName = dr["DomainName"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("IsEnabled")) && dr["IsEnabled"].ToString().Equals("1"))
                    {
                        model.IsEnabled = true;
                    }
                    else
                    {
                        model.IsEnabled = false;
                    }
                    model.RewriteCode = dr["RewriteCode"].ToString();

                    List.Add(model);
                    SiteArea.Add(model.CityId, dr["SysAreaByCity"].ToString());
                    AreaCompany.Add(model.CityId, dr["AreaCompany"].ToString());
                }
                model = null;
            }

            if (List == null || List.Count <= 0 || SiteArea == null || SiteArea.Count <= 0)
            {
                return(List);
            }

            int            AreaId                         = 0;
            string         CompanyId                      = string.Empty;
            IList <string> strTmpCompanyId                = null;
            System.Xml.XmlAttributeCollection attList     = null;
            System.Xml.XmlDocument            xml         = null;
            System.Xml.XmlNodeList            XmlNodeList = null;
            foreach (EyouSoft.Model.SystemStructure.SysCity model in List)
            {
                #region 线路区域

                if (string.IsNullOrEmpty(SiteArea[model.CityId]))
                {
                    continue;
                }

                EyouSoft.Model.SystemStructure.SysCityArea SysAreaModel = null;
                if (model.CityAreaControls != null)
                {
                    model.CityAreaControls.Clear();
                }
                if (model.AreaAdvNum != null)
                {
                    model.AreaAdvNum.Clear();
                }

                xml = new System.Xml.XmlDocument();
                xml.LoadXml(SiteArea[model.CityId]);
                XmlNodeList = xml.GetElementsByTagName("tbl_SysCityAreaControl");
                if (XmlNodeList != null)
                {
                    foreach (System.Xml.XmlNode node in XmlNodeList)
                    {
                        SysAreaModel = new EyouSoft.Model.SystemStructure.SysCityArea();
                        attList      = node.Attributes;
                        if (attList == null && attList.Count <= 0)
                        {
                            continue;
                        }

                        if (!string.IsNullOrEmpty(attList["AreaId"].Value))
                        {
                            SysAreaModel.AreaId = int.Parse(attList["AreaId"].Value);
                        }
                        SysAreaModel.AreaName = attList["AreaName"].Value;
                        if (!string.IsNullOrEmpty(attList["SortId"].Value))
                        {
                            SysAreaModel.SortId = int.Parse(attList["SortId"].Value);
                        }
                        if (!string.IsNullOrEmpty(attList["IsDefaultShow"].Value) && attList["IsDefaultShow"].Value.Equals("1"))
                        {
                            SysAreaModel.IsDefaultShow = true;
                        }
                        else
                        {
                            SysAreaModel.IsDefaultShow = false;
                        }
                        if (!string.IsNullOrEmpty(attList["RouteType"].Value))
                        {
                            SysAreaModel.RouteType = (EyouSoft.Model.SystemStructure.AreaType) int.Parse(attList["RouteType"].Value);
                        }

                        model.CityAreaControls.Add(SysAreaModel);
                    }
                }

                #endregion

                #region 线路区域公司广告

                if (string.IsNullOrEmpty(AreaCompany[model.CityId]))
                {
                    continue;
                }

                xml = null;
                xml = new System.Xml.XmlDocument();
                xml.LoadXml(AreaCompany[model.CityId]);
                XmlNodeList = xml.GetElementsByTagName("tbl_CompanyCityAd");
                foreach (System.Xml.XmlNode node in XmlNodeList)
                {
                    attList = node.Attributes;
                    if (attList == null && attList.Count <= 0)
                    {
                        continue;
                    }

                    if (!string.IsNullOrEmpty(attList["AreaId"].Value))
                    {
                        AreaId = int.Parse(attList["AreaId"].Value);
                    }
                    CompanyId = attList["CompanyId"].Value;
                    if (model.AreaAdvNum.ContainsKey(AreaId))
                    {
                        model.AreaAdvNum[AreaId].Add(CompanyId);
                    }
                    else
                    {
                        strTmpCompanyId = new List <string>();
                        strTmpCompanyId.Add(CompanyId);
                        model.AreaAdvNum.Add(AreaId, strTmpCompanyId);
                    }
                }

                #endregion
            }
            if (attList != null)
            {
                attList.RemoveAll();
            }
            attList = null;
            xml     = null;
            if (SiteArea != null)
            {
                SiteArea.Clear();
            }
            SiteArea = null;
            if (AreaCompany != null)
            {
                AreaCompany.Clear();
            }
            AreaCompany = null;

            #endregion

            return(List);
        }
Пример #6
0
        /// <summary>
        /// 获取城市列表
        /// </summary>
        /// <returns>返回城市实体集合</returns>
        public virtual IList <EyouSoft.Model.SystemStructure.SysCity> GetCityList()
        {
            IList <EyouSoft.Model.SystemStructure.SysCity> List = new List <Model.SystemStructure.SysCity>();
            DbCommand dc = base.SystemStore.GetSqlStringCommand(Sql_SysCity_Select);

            #region 实体赋值

            using (IDataReader dr = DbHelper.ExecuteReader(dc, base.SystemStore))
            {
                Model.SystemStructure.SysCity model = null;
                while (dr.Read())
                {
                    model = new EyouSoft.Model.SystemStructure.SysCity();
                    if (!dr.IsDBNull(0))
                    {
                        model.CityId = dr.GetInt32(0);
                    }
                    if (!dr.IsDBNull(1))
                    {
                        model.ProvinceId = dr.GetInt32(1);
                    }
                    model.ProvinceName = dr[2].ToString();
                    model.CityName     = dr[3].ToString();
                    if (!dr.IsDBNull(4))
                    {
                        model.CenterCityId = dr.GetInt32(4);
                    }
                    model.HeaderLetter = dr[5].ToString();
                    if (!dr.IsDBNull(6))
                    {
                        model.ParentTourCount = dr.GetInt32(6);
                    }
                    if (!dr.IsDBNull(7))
                    {
                        model.TourCount = dr.GetInt32(7);
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("IsSite")) && dr["IsSite"].ToString().Equals("1"))
                    {
                        model.IsSite = true;
                    }
                    else
                    {
                        model.IsSite = false;
                    }
                    model.DomainName = dr["DomainName"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("IsEnabled")) && dr["IsEnabled"].ToString().Equals("1"))
                    {
                        model.IsEnabled = true;
                    }
                    else
                    {
                        model.IsEnabled = false;
                    }

                    model.RewriteCode = dr["RewriteCode"].ToString();

                    List.Add(model);
                }
                model = null;
            }

            #endregion

            return(List);
        }