/// <summary> /// 初始化景区信息 /// </summary> protected void GetSceniceInfo() { EyouSoft.Model.ScenicStructure.MScenicArea Model = EyouSoft.BLL.ScenicStructure.BScenicArea.CreateInstance().GetModel(EditId, CompanyId); if (Model != null) { this.SceniceName.Value = Model.ScenicName; this.EnName.Value = Model.EnName; this.X.InnerText = Model.X; this.jingdu.Value = Model.X; this.Y.InnerText = Model.Y; this.weidu.Value = Model.Y; this.Telephone.Value = Model.Telephone; this.CnAddress.Value = Model.CnAddress; this.EnAddress.Value = Model.EnAddress; this.ScenicLevel.SelectedValue = ((int)Model.ScenicLevel).ToString(); this.ContactOperator.SelectedValue = Model.ContactOperator.ToString(); this.SetYear.Value = Model.SetYear == 0 ? "" : Model.SetYear.ToString(); this.OpenTime.Value = Model.OpenTime; this.txtDescription.Text = Model.Description; this.Traffic.Value = Model.Traffic; this.Facilities.Value = Model.Facilities; this.Notes.Value = Model.Notes; //加载景区主题 BindSceniceThemeId(Model.ThemeId); //加载相关城市的地标区域 BindBinLankIdByCity(Model.CityId, Model.LankId); //省份 城市 if (Model.ProvinceId > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "SetProvince('" + Model.ProvinceId + "');ChangeList('" + this.dropCityId.ClientID + "','" + Model.ProvinceId + "');", true); if (Model.CityId > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "SetCity('" + Model.CityId + "');ChangeCountyList('" + this.dropCountyId.ClientID + "','" + Model.CityId + "','" + this.dropProvinceId.ClientID + "');", true); if (Model.CountyId > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "SetCounty('" + Model.CountyId + "');", true); } } } } Model = null; }
/// <summary> /// 保存或添加景区 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { EyouSoft.Model.ScenicStructure.MScenicArea Model = new EyouSoft.Model.ScenicStructure.MScenicArea(); Model.ContactOperator = Utils.InputText(Utils.GetFormValue(ContactOperator.UniqueID)); Model.Company = new EyouSoft.Model.CompanyStructure.CompanyInfo(); Model.Company.ID = CompanyId; Model.Operator = this.SiteUserInfo.UserName; Model.ScenicName = Utils.InputText(this.SceniceName.Value.Trim()); Model.EnName = Utils.InputText(this.EnName.Value.Trim()); Model.X = Utils.InputText(this.jingdu.Value); Model.Y = Utils.InputText(this.weidu.Value); Model.Telephone = Utils.InputText(this.Telephone.Value.Trim()); Model.CnAddress = Utils.InputText(this.CnAddress.Value.Trim()); Model.EnAddress = Utils.InputText(this.EnAddress.Value.Trim()); Model.ScenicLevel = (ScenicLevel)Utils.GetInt(Utils.GetFormValue(ScenicLevel.UniqueID)); Model.SetYear = Utils.GetInt(this.SetYear.Value.Trim()); Model.OpenTime = Utils.InputText(this.OpenTime.Value); Model.Description = Utils.EditInputText(this.txtDescription.Text); Model.Traffic = Utils.InputText(this.Traffic.Value); Model.Facilities = Utils.InputText(this.Facilities.Value); Model.Notes = Utils.InputText(this.Notes.Value); Model.ProvinceId = EyouSoft.Common.Utils.GetInt(Utils.GetFormValue(dropProvinceId.UniqueID)); Model.CityId = EyouSoft.Common.Utils.GetInt(Utils.GetFormValue(dropCityId.UniqueID)); Model.CountyId = EyouSoft.Common.Utils.GetInt(Utils.GetFormValue(dropCountyId.UniqueID)); #region //Model.ProvinceId = Utils.GetInt(Utils.GetFormValue(this.ProvinceAndCityAndCounty1.FindControl("ddl_ProvinceList").UniqueID)); //Model.CityId = Utils.GetInt(Utils.GetFormValue(this.ProvinceAndCityAndCounty1.FindControl("ddl_CityList").UniqueID)); //Model.CountyId = Utils.GetInt(Utils.GetFormValue(this.ProvinceAndCityAndCounty1.FindControl("ddl_CountyList").UniqueID)); #endregion #region 获取主题 List <MScenicTheme> listi = new List <MScenicTheme>(); foreach (string item in Utils.GetFormValues("ThemeCheck")) { MScenicTheme modelTheme = new MScenicTheme(); modelTheme.ThemeId = Utils.GetInt(item); modelTheme.ThemeName = ""; listi.Add(modelTheme); modelTheme = null; } Model.ThemeId = listi; #endregion #region 获取地标 List <MScenicRelationLandMark> listland = new List <MScenicRelationLandMark>(); foreach (string item in Utils.GetFormValues("LandMark")) { MScenicRelationLandMark ModelLandMard = new MScenicRelationLandMark(); ModelLandMard.LandMarkId = Utils.GetInt(item); ModelLandMard.ScenicId = ""; listland.Add(ModelLandMard); ModelLandMard = null; } #endregion Model.LankId = listland; #region 判断是添加操作还是修改操作 //判断是添加操作还是修改操作! if (EditId != null && EditId != "") { Model.ScenicId = EditId; EyouSoft.Model.ScenicStructure.MScenicArea oldModel = EyouSoft.BLL.ScenicStructure.BScenicArea.CreateInstance().GetModel(EditId); Model.B2B = oldModel.B2B; Model.B2BOrder = oldModel.B2BOrder; Model.B2C = oldModel.B2C; Model.B2COrder = oldModel.B2COrder; bool resut = EyouSoft.BLL.ScenicStructure.BScenicArea.CreateInstance().Update(Model); if (resut) { MessageBox.ResponseScript(this.Page, "alert(\"修改成功!\");parent.Boxy.getIframeDialog('" + Request.QueryString["iframeId"] + "').hide();parent.topTab.url(parent.topTab.activeTabIndex,'/ScenicManage/MyScenice.aspx');"); } else { MessageBox.ResponseScript(this.Page, "alert('修改失败!');"); } } else { Model.B2B = ScenicB2BDisplay.常规; Model.B2C = ScenicB2CDisplay.常规; bool resut = EyouSoft.BLL.ScenicStructure.BScenicArea.CreateInstance().Add(Model); if (resut) { MessageBox.ResponseScript(this.Page, "alert(\"增加成功!\");parent.Boxy.getIframeDialog('" + Request.QueryString["iframeId"] + "').hide();parent.topTab.url(parent.topTab.activeTabIndex,'/ScenicManage/MyScenice.aspx');"); } else { MessageBox.ResponseScript(this.Page, "alert('增加失败!');"); } } #endregion Model = null; }