protected void btnSave_Click(object sender, EventArgs e) { EyouSoft.Model.CommunityStructure.ExchangeComment model = new EyouSoft.Model.CommunityStructure.ExchangeComment(); model.CommentId = string.Empty; model.CommentIP = StringValidate.GetRemoteIP(); model.CommentText = Utils.InputText(Utils.GetFormValue("txt_content")); model.CompanyId = base.SiteUserInfo.CompanyID; model.CompanyName = base.SiteUserInfo.CompanyName; model.IsAnonymous = IsAnonymous.Checked; model.IsCheck = false; model.IsDeleted = false; model.IsHasNextLevel = false; model.IssueTime = DateTime.Now; model.OperatorId = base.SiteUserInfo.ID; model.OperatorMQ = base.SiteUserInfo.ContactInfo.MQ; model.OperatorName = base.SiteUserInfo.ContactInfo.ContactName; model.TopicType = EyouSoft.Model.CommunityStructure.TopicType.宾; model.TopicId = hGuestId.Value; int Result = Ibll.AddExchangeComment(model); Ibll = null; model = null; if (Result > 0) { Utils.ShowAndRedirect("发表成功!", Request.RawUrl); } else { Utils.ShowAndRedirect("发表失败!", Request.RawUrl); } }
protected void ibtnSave_Click(object sender, EventArgs e) { if (!IsLogin) { MessageBox.ShowAndReturnBack(this, "请先登录!", 1); return; } string strInfo = Utils.InputText(txtCommentInfo.Value.Trim()); string strTopicId = id; string strCommentId = Utils.GetFormValue("hidCommentId"); if (string.IsNullOrEmpty(strInfo)) { MessageBox.ShowAndReturnBack(this, "回复内容不能为空!", 1); return; } if (strInfo.Length > 500) { MessageBox.ShowAndReturnBack(this, "回复内容应限制在500个字符以内!", 1); return; } EyouSoft.Model.CommunityStructure.ExchangeComment model = new EyouSoft.Model.CommunityStructure.ExchangeComment(); model.CommentId = strCommentId; model.CommentIP = StringValidate.GetRemoteIP(); model.CommentText = strInfo; model.CompanyId = SiteUserInfo.CompanyID; model.CompanyName = SiteUserInfo.CompanyName; model.IsAnonymous = false; model.IsCheck = false; model.IsDeleted = false; model.IsHasNextLevel = false; model.IssueTime = DateTime.Now; model.OperatorId = SiteUserInfo.ID; model.OperatorMQ = SiteUserInfo.ContactInfo == null ? "0" : SiteUserInfo.ContactInfo.MQ; model.OperatorName = SiteUserInfo.ContactInfo == null ? string.Empty : SiteUserInfo.ContactInfo.ContactName; model.TopicId = strTopicId; model.TopicType = EyouSoft.Model.CommunityStructure.TopicType.供求; if (EyouSoft.BLL.CommunityStructure.ExchangeComment.CreateInstance().AddExchangeComment(model) == 1) { MessageBox.ShowAndRedirect(this, "提交评论成功!", Request.RawUrl); return; } else { MessageBox.ShowAndRedirect(this, "提交评论失败!", Request.RawUrl); return; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitExchangeList(); string ClientIP = StringValidate.GetRemoteIP(); if (!string.IsNullOrEmpty(ClientIP)) { EyouSoft.Model.SystemStructure.CityBase model = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetClientCityByIp(ClientIP); if (model != null) { CityId = model.CityId; } model = null; } } }
/// <summary> /// 初始化在线服务 /// </summary> public void InitOlServer() { SeniorOnlineShop.master.SeniorShop cMaster = (SeniorOnlineShop.master.SeniorShop) this.Master; if (cMaster != null) { lbCompanyName.Text = cMaster.DetailCompanyInfo.CompanyName; } cMaster = null; string Remote_IP = StringValidate.GetRemoteIP(); EyouSoft.Model.SystemStructure.CityBase cityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetClientCityByIp(Remote_IP); if (cityModel != null) { EyouSoft.Model.SystemStructure.SysCity thisCityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(cityModel.CityId); if (thisCityModel != null) { lbGuestInfo.Text = string.Format("欢迎您来自{0}省{1}市的朋友有什么可以帮助您的吗?", thisCityModel.ProvinceName, thisCityModel.CityName); } thisCityModel = null; } cityModel = null; }
/// <summary> /// 编辑与添加的公共model部分 /// </summary> protected string CommonModel(MPeerNews Model) { StringBuilder str = new StringBuilder(); string txtTitle = Utils.GetFormValue(this.txtTitle.UniqueID).Trim(); //标题 string[] selectInfo = Utils.GetFormValue("selectInfo").Split('|'); //相关专线、相关地接、相关景区ID string selectInfoName = Utils.GetFormValue("selectInfoName"); //相关专线、相关地接、相关景区Name int ddlType = Utils.GetInt(Utils.GetFormValue(this.ddlType.UniqueID), -1); //分 类 string txtContent = Utils.EditInputText(Request.Form[this.txtContent.UniqueID]); //内容 string[] picPath = Utils.GetFormValue(this.filePic.UniqueID + "$hidFileName").Split(','); //已上传的图片路径 ,多个用逗号隔开 string[] filePath = Utils.GetFormValue(this.files.UniqueID + "$hidFileName").Split(','); //已上传的附件路径 ,多个用逗号隔开 /*数据验证开始*/ if (string.IsNullOrEmpty(txtTitle)) { str.Append("标题不能为空!\\n"); } if (string.IsNullOrEmpty(txtContent)) { str.Append("内容不能为空!\\n"); } if (str.Length > 0) { return(str.ToString()); } /*数据验证结束*/ Model.CompanyId = this.SiteUserInfo.CompanyID; Model.CompanyName = this.SiteUserInfo.CompanyName; Model.Content = txtContent; Model.Ip = StringValidate.GetRemoteIP(); if (this.SiteUserInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.专线) || this.SiteUserInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.地接)) { if (selectInfo.Length == 2) { Model.AreaId = Utils.GetInt(selectInfo[0]); Model.AreaType = (AreaType)Utils.GetInt(selectInfo[1]); } else { Model.AreaId = Utils.GetInt(selectInfo[0]); } } else if (this.SiteUserInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.景区)) { Model.ScenicId = selectInfo[0]; } Model.AreaName = selectInfoName; Model.OperatorId = this.SiteUserInfo.ID; Model.OperatorName = this.SiteUserInfo.UserName; Model.Title = txtTitle; Model.TypeId = (PeerNewType)ddlType; /*文件上传开始*/ List <MPeerNewsAttachInfo> lstFile = new List <MPeerNewsAttachInfo>(); //图片 if (picPath.Length > 0) { for (int i = 0; i < picPath.Length; i++) { if (string.IsNullOrEmpty(picPath[i])) { break; } MPeerNewsAttachInfo picModel = new MPeerNewsAttachInfo(); picModel.FileName = picPath[i].Substring(picPath[i].LastIndexOf('/') + 1); picModel.Path = picPath[i]; picModel.Type = AttachInfoType.图片; lstFile.Add(picModel); } } //附件 if (filePath.Length > 0) { for (int i = 0; i < filePath.Length; i++) { if (string.IsNullOrEmpty(filePath[i])) { break; } MPeerNewsAttachInfo fileModel = new MPeerNewsAttachInfo(); if (filePath[i].IndexOf('|') > 0) { string[] strFileInfo = filePath[i].Split('|'); fileModel.FileName = strFileInfo[0]; fileModel.Path = strFileInfo[1]; } else { fileModel.FileName = filePath[i].Substring(filePath[i].LastIndexOf('/')); fileModel.Path = filePath[i]; } fileModel.Type = AttachInfoType.文件; lstFile.Add(fileModel); } } Model.AttachInfo = lstFile.Count == 0 ? null : lstFile; /*文件上传结束*/ return(str.ToString()); }
protected override void OnInit(EventArgs e) { base.OnInit(e); #region 初始化_IsSeniorShopPage属性 /*if (Request.CurrentExecutionFilePath.ToLower().IndexOf("/seniorshop/") != -1) * { * _IsSeniorShopPage = true; * }*/ this._IsSeniorShopPage = Utils.IsEShopPage(); #endregion #region 取销售城市 _cityId = Utils.GetInt(Request.QueryString["CityId"]); int isCut = Utils.GetInt(Request.QueryString["isCut"]); HttpCookie c*k = Request.Cookies[COOKIE_KEY_CITY]; if (_cityId > 0 && isCut == 1) { //string domainSuffix = Utils.GetDomainSuffix(Utils.AbsoluteWebRoot); //if (!String.IsNullOrEmpty(domainSuffix)) //{ // response.Cookies[LoginCookie_UserName].Domain = domainSuffix; //} //存cookie if (c*k == null) { c*k = new System.Web.HttpCookie(COOKIE_KEY_CITY); c*k.Value = _cityId.ToString(); c*k.Expires = DateTime.Now.AddDays(10); //c*k.Domain = ".tongye114.com"; Response.Cookies.Add(c*k); } else //修改 { Response.Cookies.Remove(COOKIE_KEY_CITY); Response.Cookies[COOKIE_KEY_CITY].Expires = DateTime.Now.AddDays(-1); c*k = new HttpCookie(COOKIE_KEY_CITY); c*k.Value = _cityId.ToString(); c*k.Expires = DateTime.Now.AddDays(10); //c*k.Domain = ".tongye114.com"; Response.Cookies.Add(c*k); } } else { if (_cityId <= 0) { //取cookie int cokV = Utils.GetInt(c*k != null ? c*k.Value : ""); if (cokV > 0) { _cityId = cokV; } else //IP { string Remote_IP = StringValidate.GetRemoteIP(); EyouSoft.Model.SystemStructure.CityBase cityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetClientCityByIp(Remote_IP); if (cityModel != null && cityModel.CityId > 0) { _cityId = cityModel.CityId; } else//默认值(杭州) { //_cityId = 362; _cityId = 0; } cityModel = null; } } } #endregion _imageServerPath = ImageManage.GetImagerServerUrl(1); //如果取不到城市信息,则跳转到 切换城市页面 if (_cityId == 0) { if (IsNeedLinkToCutCityPage() == true) { Response.Redirect(Domain.UserPublicCenter + "/ToCutCity.aspx", true); } } #region 城市Model //如果取不到城市信息,则跳转到 切换城市页面 EyouSoft.Model.SystemStructure.SysCity thisCityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(_cityId); if (thisCityModel != null)//找到 { _cityModel = new EyouSoft.Model.SystemStructure.SysCity(); _cityModel = thisCityModel; } else //没有找到 //_cityId = 362; //EyouSoft.Model.SystemStructure.SysCity hzCityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(CityId); //_cityModel = new EyouSoft.Model.SystemStructure.SysCity(); //_cityModel = hzCityModel; //hzCityModel = null; //判断 是否需要 跳转到 选择城市 页面 { if (IsNeedLinkToCutCityPage() == true)//需要 { Response.Redirect(Domain.UserPublicCenter + "/ToCutCity.aspx", true); } else//不需要 { //如果找不到城市信息,则默认初始化 为 杭州 _cityId = 362; _cityModel = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetSysCityModel(_cityId); } } thisCityModel = null; #endregion }