public void SetVerifyTest() { MockRepository mocks = new MockRepository(); DJ_TourEnterprise ent = new DJ_TourEnterprise(); DALDJEnterprise dalEnt = mocks.StrictMock<DALDJEnterprise>(); Expect.Call(delegate { dalEnt.Save(ent); }); blldjs.dalEnt = dalEnt; Area area = new Area(); area.Code = "330100"; ent.Area = area; blldjs.SetVerify(ent, RewardType.已纳入); Assert.AreEqual(RewardType.已纳入, ent.CityVeryfyState); Assert.AreEqual((RewardType)0, ent.CountryVeryfyState); Assert.AreEqual((RewardType)0, ent.ProvinceVeryfyState); Area newArea = new Area(); newArea.Code = "330301"; ent.Area = newArea; blldjs.SetVerify(ent, RewardType.纳入后移除); Assert.AreEqual(RewardType.纳入后移除, ent.CountryVeryfyState); Assert.AreEqual( RewardType.已纳入 , ent.CityVeryfyState); Assert.AreEqual((RewardType)0, ent.ProvinceVeryfyState); }
public void GetLevelTest() { var area = new Area(); area.Code = "330000"; Assert.AreEqual(AreaLevel.省, area.Level); area.Code = "330100"; Assert.AreEqual(AreaLevel.市, area.Level); area.Code = "330103"; Assert.AreEqual(AreaLevel.区县, area.Level); }
public AreaUpdate(Area entity = null) { InitializeComponent(); cmbAddress.DataSource = this.DbContext.Addresses.Where(a => !a.IsDeleted).ToList(); if (entity == null) { this.Text = "Alta de Áreas"; } else { this.Text = "Modificación de Área \"" + entity.Description + "\""; cmbAddress.SelectedValue = entity.AddressID; txtDescription.Text = entity.Description; } this.Result = entity ?? new Area(); }
//区域--级别页面 public static BatchSeoData GetSeoData_Home(Area area, Area countyarea, int level, Topic topic, int pageIndex) { BLL.BLLArea bllarea = new BLLArea(); int areaId = area == null ? 0 : area.Id; int countyareaId = countyarea == null ? 0 : countyarea.Id; string topicid = topic == null ? string.Empty : topic.Id.ToString(); BatchSeoData seoData = new BatchSeoData(); TemplateType tt = TemplateType.Home; //改用异或的方式查询,种类太多,ifelse不清晰 SST. //if (areaId > 0)//含区域 //{ // if (level > 0)//含区域&等级 // { // tt = TemplateType.AreaAndLevel; // } // else//含区域 !等级 // { // tt = TemplateType.OnlyArea; // } //} //else//不含区域 //{ // if (level > 0) { tt = TemplateType.OnlyLevel; } //} //将上述方法改用异或的方式查询,种类太多,ifelse不清晰 SST. //area=4(100), topic=2(10), level=1(1) int xorarea = areaId == 0 ? 0 : 4; int xortopic = topicid == string.Empty ? 0 : 2; int xorlevel = level > 0 ? 1 : 0; int xorcounty = countyareaId > 0 ? 8 : 0; int xoresult = xorarea ^ xortopic ^ xorlevel^xorcounty; switch (xoresult) { case 1: tt = TemplateType.OnlyLevel; break; case 2: tt = TemplateType.OnlyTopic; break; case 3: tt = TemplateType.OnlyTopic; break; case 4: tt = TemplateType.OnlyArea; break; case 5: tt = TemplateType.AreaAndLevel; break; case 6: tt = TemplateType.AreaAndTopic; break; case 7: tt = TemplateType.AreaAndTopic; break; case 13: tt = TemplateType.Area_CountyAndLevel; break; case 12: tt = TemplateType.OnlyArea_County; break; case 14: tt = TemplateType.Area_CountyAndTopic; break; case 15: tt = TemplateType.Area_CountyAndTopic; break; } string title = string.Empty; string keyword = string.Empty; string description = string.Empty; string h1text = string.Empty; switch (tt) { /* 城市+景区级别的页面title按照下列规则统一生成,省略keyword和description,如: http://www.tourol.cn/hangzhou/5a/ Title:杭州5a景区门票_杭州5a景点门票_杭州5a景点门票价格 - 中国旅游在线 */ case TemplateType.AreaAndLevel: title = string.Format(AreaAndLEvelKeywordFormat, area.Name, level + "A"); //keyword = string.Format(AreaAndLEvelKeywordFormat, area.Name, level + "A"); //description = bllarea.GetAreaByAreaid(area.Id).MetaDescription; h1text = string.Format("{0}{1}景点门票",area.Name,level+"A级"); break; case TemplateType.AreaAndTopic: title = string.Format(AreaAndTopicTitleFormat, area.Name, topic.Name); //keyword = string.Format(AreaAndTopicTitleFormat, area.Name, topic.Name); //description = bllarea.GetAreaByAreaid(area.Id).MetaDescription; h1text = string.Format("{0}{1}景点门票", area.Name, topic.Name ); break; case TemplateType.OnlyArea: title = string.Format(AreaTitleFormat, area.Name); keyword = string.Format(AreaKeywordFormat, area.Name); description = bllarea.GetAreaByAreaid(area.Id).MetaDescription; h1text = string.Format("{0}景点门票", area.Name); break; case TemplateType.OnlyTopic: title = string.Format(TopicTitleFormat, topic.Name); keyword = string.Format(TopicTitleFormat, topic.Name); description = "中国旅游在线官网提供浙江省内各旅游景点门票在线预订服务,是本省最权威的旅游景点门票授权机构,全面塑造“诗画江南,山水浙江”的旅游总体形象,全面推动本省旅游业的发展"; h1text = string.Format("浙江{0}景点门票", topic.Name); break; case TemplateType.OnlyLevel: title = string.Format(LevelTitleFormat, level + "A"); keyword = string.Format(LevelKeywordFormat, level + "A"); description = string.Format(LevelDescriptionFormat,level); h1text = string.Format("浙江{0}景点门票", level+"A级"); break; case TemplateType.Area_CountyAndLevel: title = string.Format(Area_CountyAndLEvelTitleFormat, area.Name, countyarea.Name, level + "A"); keyword = string.Format(Area_CountyAndLEvelKeywordFormat, area.Name, countyarea.Name, level + "A"); description = bllarea.GetAreaByAreaid(countyarea.Id).MetaDescription; h1text = string.Format("{0}{1}景点门票", countyarea.Name, level + "A级"); break; case TemplateType.OnlyArea_County: title = string.Format(Area_CountyTitleFormat, area.Name, countyarea.Name); keyword = string.Format(Area_CountyKeywordFormat, area.Name, countyarea.Name); description = bllarea.GetAreaByAreaid(countyarea.Id).MetaDescription; h1text = string.Format("{0}景点门票", countyarea.Name); break; case TemplateType.Area_CountyAndTopic: title = string.Format(Area_CountyAndTopicTitleFormat, area.Name, countyarea.Name, topic.Name); h1text = string.Format("{0}{1}景点门票",countyarea.Name,topic.Name); break; default: title = HomeTitle; keyword = HomeKeyword; description = "中国旅游在线官网提供浙江省内各旅游景点门票在线预订服务,是本省最权威的旅游景点门票授权机构,全面塑造“诗画江南,山水浙江”的旅游总体形象,全面推动本省旅游业的发展"; h1text = "浙江旅游景点门票"; break; } if (pageIndex > 0) { title += string.Format("(第{0}页)", pageIndex); } seoData.KeyWord = keyword; seoData.Title = title; seoData.Description = description; seoData.H1Text = h1text; return seoData; }
public IList<Model.Scenic> GetTicketByAreaIdAndLevel(Area area, int level, string topic, int pageIndex, int pageSize, out int totalRecord) { return Iticket.GetTicketByAreaIdAndLevel(area, level, topic, pageIndex - 1, pageSize, out totalRecord); }
public void SetVerify(Area area, string entName, RewardType targetType, EnterpriseType entType, out string errMsg) { errMsg = string.Empty; IList<DJ_TourEnterprise> ents = GetDJS8name(entName); DJ_TourEnterprise ent = new DJ_TourEnterprise(); if (ents.Count > 0) { if (ents.Count > 1) { TourLog.LogError(this.GetType() + ":" + ents.Count + "个企业重名:" + entName); } ent = ents[0]; ; } else if (ents.Count == 0) { ent.Name = entName; ent.Area = area; ent.Type = entType; Save(ent); } SetVerify(ent, targetType); }
public virtual RewardType GetRewart(Area area) { RewardType t = 0; switch (area.Level) { case AreaLevel.区县: t = CountryVeryfyState; break; case AreaLevel.省: t = ProvinceVeryfyState; break; case AreaLevel.市: t = CityVeryfyState; break; } return t; }