/// <summary> /// 行绑定事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void RepeatorList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { System.Text.StringBuilder strTmp = null; EyouSoft.Model.CommunityStructure.ExchangeList Exchange = (EyouSoft.Model.CommunityStructure.ExchangeList)e.Item.DataItem; //初始化标题链接 Literal ltrTitle = (Literal)e.Item.FindControl("ltrTitle"); if (ltrTitle != null && Exchange != null) { string TargetUrl = string.Format("{0}/SupplierInfo/ExchangeInfo.aspx?Id={1}&CityId={2}", Domain.UserPublicCenter, Exchange.ID, CityId); strTmp = new System.Text.StringBuilder(); if (IsLogin) { strTmp.AppendFormat("<a href='{0}' target=\"_blank\">{1}</a>", SiteUserInfo.IsEnable ? GetDesPlatformUrl(TargetUrl): "javascript:;", Utils.GetText(Exchange.ExchangeTitle, 14)); } //else //{ // strLoginUrl = EyouSoft.Security.Membership.UserProvider.BuildLoginAndReturnUrl(Utils.GeneratePublicCenterUrl(string.Format("/SupplierInfo/ExchangeInfo.aspx?Id={0}", Exchange.ID), CityId), string.Empty); // strTmp.AppendFormat("<a target=\"_blank\" href='{0}'>", strLoginUrl); // strTmp.AppendFormat("{0}</a>", Utils.GetText(Exchange.ExchangeTitle, 6)); //} ltrTitle.Text = strTmp.ToString(); strTmp = null; } Exchange = null; } }
/// <summary> /// 添加供求信息 /// </summary> /// <param name="model">供求实体</param> /// <param name="ProvinceIds">发布到的省份数组</param> /// <param name="isCreateOfferId">是否生成供求编号</param> /// <returns>true:成功 false:失败</returns> private bool AddExchangeList(EyouSoft.Model.CommunityStructure.ExchangeList model, int[] ProvinceIds, bool isCreateOfferId) { if (model == null) { return(false); } if (isCreateOfferId) { model.ID = Guid.NewGuid().ToString(); } model.CityContactList = new List <EyouSoft.Model.CommunityStructure.ExchangeCityContact>(); model.CityContactList.Clear(); IList <Model.SystemStructure.SysCity> listCity = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetProvinceCityList(ProvinceIds); if (listCity != null) { foreach (Model.SystemStructure.SysCity CityModel in listCity) { if (CityModel.CityId != model.CityId) { model.CityContactList.Add(new EyouSoft.Model.CommunityStructure.ExchangeCityContact(model.ID, CityModel.ProvinceId, CityModel.CityId)); } } } model.CityContactList.Add(new EyouSoft.Model.CommunityStructure.ExchangeCityContact(model.ID, model.ProvinceId, model.CityId)); return(dal.AddExchangeList(model)); }
/// <summary> /// 命令行事件 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void RepeaterList_ItemCommand(object source, RepeaterCommandEventArgs e) { if (string.IsNullOrEmpty(e.CommandName) || string.IsNullOrEmpty(e.CommandArgument.ToString())) { return; } switch (e.CommandName.ToLower()) { case "del": if (EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().Delete(e.CommandArgument.ToString())) { MessageBox.ShowAndRedirect(this.Page, "删除成功!", Request.RawUrl); } else { MessageBox.ShowAndRedirect(this.Page, "删除失败!", Request.RawUrl); } break; case "edit": EyouSoft.Model.CommunityStructure.ExchangeList exchange = new EyouSoft.Model.CommunityStructure.ExchangeList(); System.Web.UI.WebControls.TextBox title = (System.Web.UI.WebControls.TextBox)e.Item.FindControl("txtTitle"); if (EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().QG_SetQQGroupOfferTitle(e.CommandArgument.ToString(), title.Text)) { MessageBox.ShowAndRedirect(this.Page, "保存成功!", Request.RawUrl); } else { MessageBox.ShowAndRedirect(this.Page, "保存失败!", Request.RawUrl); } break; } }
/// <summary> /// 初始化供求信息 /// </summary> private void InitExchange() { EyouSoft.Model.CommunityStructure.ExchangeList model = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().GetModel(ExchangeId); if (model == null) { MessageBox.ShowAndRedirect(this, "未找到您要查看的信息!", ExchangeListPageUrl); return; } if (model.IsCheck == false) { MessageBox.ShowAndRedirect(this, "您要查看的信息没有通过审核!", ExchangeListPageUrl); return; } //根据供求标题 初始化 页面标题 zxb update 20110118 //(标题)_(类型)_(地区)旅游信息发布 Page.Title = model.ExchangeTitle + "_" + model.ExchangeTag + "_" + CityModel.CityName + "旅游信息发布"; //Page.Title = model.ExchangeTitle + "_同业114供求信息频道"; CurrExchangeType = model.TopicClassID; ltrTitle.Text = model.ExchangeTitle; ltrTime.Text = model.IssueTime.ToString("yyyy年MM月dd日 hh:mm"); ltrCompanyName.Text = model.CompanyName; ltrMQ.Text = Utils.GetMQ(model.OperatorMQ); if (model.WriteBackCount >= 0) { ltrCommentCount.Text = string.Format("已有{0}评论", model.WriteBackCount); } if (model.ViewCount >= 0) { if (string.IsNullOrEmpty(ltrCommentCount.Text)) { ltrViewCount.Text = string.Format("{0}预览", model.ViewCount); } else { ltrViewCount.Text = string.Format("/{0}预览", model.ViewCount); } } rptExchangeImgList.DataSource = model.ExchangePhotoList; rptExchangeImgList.DataBind(); ltrInfo.Text = EyouSoft.Common.Function.StringValidate.TextToHtml(model.ExchangeText); if (!string.IsNullOrEmpty(model.AttatchPath)) { string strFileName = model.AttatchPath.Substring(model.AttatchPath.LastIndexOf("/") + 1, (model.AttatchPath.Length - model.AttatchPath.LastIndexOf("/") - 1)); ltrDownLoad.Text = string.Format("<span class=\"lan14\"><strong>附 件:</strong></span><a target=\"_blank\" href=\"{0}{1}\">{3}<img src=\"{2}/images/UserPublicCenter/baocun.gif\" width=\"14\" height=\"13\" /><img src=\"{2}/images/UserPublicCenter/dakai.gif\" width=\"16\" height=\"14\" /></a>", Domain.FileSystem, model.AttatchPath, Domain.ServerComponents, strFileName); } SetClicks(); if (IsLogin) { SetHistory(); } InitPageData(); }
/// <summary> /// 数据绑定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void rpt_AllSupplyManage_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { EyouSoft.Model.CommunityStructure.ExchangeList model = (EyouSoft.Model.CommunityStructure.ExchangeList)e.Item.DataItem; Literal ltrExchangeTag = (Literal)e.Item.FindControl("ltrExchangeTag"); if (ltrExchangeTag != null && model.ExchangeTagHtml != null) { if ((int)model.ExchangeTag == 0) { ltrExchangeTag.Text = string.Format("<div class=\"gqbiaoqian{0}\">{1}</div>", 1, "无"); } else { ltrExchangeTag.Text = model.ExchangeTagHtml.TagHTML;//string.Format("<div class=\"gqbiaoqian{0}\">{1}</div>", (int)model.ExchangeTag, model.ExchangeTag); } } } }
/// <summary> /// 设置QQ群消息状态 /// </summary> /// <param name="messageId">消息编号</param> /// <param name="status">状态</param> /// <returns></returns> public bool QG_SetQQGroupMessageStatus(string messageId, EyouSoft.Model.CommunityStructure.QQGroupMessageStatus status) { if (string.IsNullOrEmpty(messageId)) { return(true); } bool isToOffer = false; EyouSoft.Model.CommunityStructure.MQQGroupMessageInfo info = QG_GetQQGroupMessageInfo(messageId); if (info != null) { EyouSoft.Model.CommunityStructure.ExchangeList offer = new EyouSoft.Model.CommunityStructure.ExchangeList(); offer.AttatchPath = string.Empty; offer.CityId = 0; offer.CompanyId = string.Empty; offer.CompanyName = string.Empty; offer.ContactName = string.Empty; offer.ContactTel = string.Empty; offer.ExchangeTag = EyouSoft.Model.CommunityStructure.ExchangeTag.无; offer.ExchangeText = info.Content; offer.ExchangeTitle = info.Title; offer.ID = info.MessageId; offer.IssueTime = DateTime.Now; offer.OperatorId = string.Empty; offer.OperatorMQ = string.Empty; offer.OperatorName = string.Empty; offer.ProvinceId = 0; offer.ExchangeCategory = EyouSoft.Model.CommunityStructure.ExchangeCategory.QGroup; offer.TopicClassID = EyouSoft.Model.CommunityStructure.ExchangeType.其他; isToOffer = AddExchangeList(offer, null, false); } if (isToOffer) { return(dal.QG_SetQQGroupMessageStatus(messageId, status)); } return(false); }
protected void Page_Load(object sender, EventArgs e) { ExchangeId = Utils.InputText(Request.QueryString["ID"]); if (!CheckMasterGrant(YuYingPermission.供求信息_管理该栏目)) { Utils.ResponseNoPermit(YuYingPermission.供求信息_管理该栏目, true); return; } if (!IsPostBack) { EyouSoft.Model.CommunityStructure.ExchangeList model = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().GetModel(ExchangeId); if (model == null) { MessageBox.ShowAndClose(this, "未找到对应的供求信息!"); return; } ltrTitle.Text = model.ExchangeTitle; ltrTime.Text = model.IssueTime.ToShortDateString(); ltrCompanyName.Text = model.CompanyName; ltrInfo.Text = model.ExchangeText; System.Text.StringBuilder strImgPath = new System.Text.StringBuilder(); if (model.ExchangePhotoList != null && model.ExchangePhotoList.Count > 0) { foreach (EyouSoft.Model.CommunityStructure.ExchangePhoto item in model.ExchangePhotoList) { strImgPath.AppendFormat("<img src=\"{0}\" />", Domain.FileSystem + item.ImgPath); } } ltrImg.Text = strImgPath.ToString(); if (!string.IsNullOrEmpty(model.AttatchPath)) { string strFileName = model.AttatchPath.Substring(model.AttatchPath.LastIndexOf("/") + 1, (model.AttatchPath.Length - model.AttatchPath.LastIndexOf("/") - 1)); ltrDownLoad.Text = string.Format("<span class=\"lan14\"><strong>附 件:</strong></span><a target=\"_blank\" href=\"{0}{1}\">{3}<img src=\"{2}/images/UserPublicCenter/baocun.gif\" width=\"14\" height=\"13\" /><img src=\"{2}/images/UserPublicCenter/dakai.gif\" width=\"16\" height=\"14\" /></a>", Domain.FileSystem, model.AttatchPath, Domain.ServerComponents, strFileName); } model = null; } }
/// <summary> /// 初始化供求信息 /// </summary> private void Bind() { id = EyouSoft.Common.Utils.GetQueryStringValue("ID"); emodel = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().GetModel(id); if (emodel == null) { Utils.ShowError("未找到当前供求信息", "info"); return; } lastlist = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().GetTopList(5, emodel.TopicClassID, emodel.ExchangeTag, true); otherlist = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().GetTopList(5, emodel.TopicClassID, emodel.ExchangeTag, false); SetClicks(); if (IsLogin) //当前有用户登录 { SetHistory(); //写浏览记录 } string fileName = ""; string filePath = ""; if (!string.IsNullOrEmpty(emodel.AttatchPath)) { if (emodel.AttatchPath.Split('|').Length > 1) { fileName = emodel.AttatchPath.Split('|')[0]; filePath = emodel.AttatchPath.Split('|')[1]; } else { fileName = "查看附件"; filePath = emodel.AttatchPath; } ltrDownLoad.Text = string.Format("<span class=\"lan14\"><strong>附 件:</strong></span><a target=\"_blank\" href=\"{0}{1}\">{3}<img src=\"{2}/images/UserPublicCenter/baocun.gif\" width=\"14\" height=\"13\" /><img src=\"{2}/images/UserPublicCenter/dakai.gif\" width=\"16\" height=\"14\" /></a>", Domain.FileSystem, filePath, Domain.ServerComponents, fileName); } }
/// <summary> /// 修改供求信息 /// </summary> /// <param name="model">供求信息实体</param> /// <param name="ProvinceIds">发布到的省份数组</param> /// <returns>true:成功 false:失败</returns> public bool Update(EyouSoft.Model.CommunityStructure.ExchangeList model, int[] ProvinceIds) { if (model == null) { return(false); } model.CityContactList = new List <EyouSoft.Model.CommunityStructure.ExchangeCityContact>(); model.CityContactList.Clear(); IList <Model.SystemStructure.SysCity> listCity = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetProvinceCityList(ProvinceIds); if (listCity != null) { foreach (Model.SystemStructure.SysCity CityModel in listCity) { if (CityModel.CityId != model.CityId) { model.CityContactList.Add(new EyouSoft.Model.CommunityStructure.ExchangeCityContact(model.ID, CityModel.ProvinceId, CityModel.CityId)); } } } model.CityContactList.Add(new EyouSoft.Model.CommunityStructure.ExchangeCityContact(model.ID, model.ProvinceId, model.CityId)); return(dal.Update(model)); }
/// <summary> /// 添加供求信息 /// </summary> /// <param name="model">供求实体</param> /// <param name="ProvinceIds">发布到的省份数组</param> /// <returns>true:成功 false:失败</returns> public bool AddExchangeList(EyouSoft.Model.CommunityStructure.ExchangeList model, int[] ProvinceIds) { return(AddExchangeList(model, ProvinceIds, true)); }
/// <summary> /// 保存求购 /// </summary> private void btnSave() { #region 验证数据 //int Type = Utils.GetInt(Request.Form["type"], 1); //类型 // = Utils.GetFormValue("seltype"); //标签 //string Title = Utils.GetFormValue("txtTitle", 50); //标题 //string TxtInfo = Utils.GetFormValue("txtInfo", 500); //内容 //string TxtName = Utils.InputText(txtName.Value, 100); //姓名 //string TxtMQ = Utils.InputText(txtMQ.Value, 20); //MQ //string TxtTel = Utils.InputText(txtTel.Value, 50); //联系电话 //string AttatchPath = Utils.GetFormValue("ctl00$ctl00$c1$SupplierBody$SingleFileUpload1$hidFileName", 250); //附件地址 //string[] strProvinceIds = Utils.GetFormValues("ckbProvince"); //发布省份 //if (Title.Trim().Length == 0) //{ // ErrStr += "请输入求购信息标题\\n"; //} //if (TxtInfo.Trim().Length == 0) //{ // ErrStr += "请输入求购信息内容\\n"; //} //if (TxtMQ.Trim().Length == 0) //{ // ErrStr += "请输入MQ号码"; //} //if (!string.IsNullOrEmpty(ErrStr)) //{ // MessageBox.Show(this.Page, ErrStr); // return; //} #endregion EyouSoft.Model.CommunityStructure.ExchangeList model = new EyouSoft.Model.CommunityStructure.ExchangeList(); model.AttatchPath = Utils.GetFormValue("SingleFileUpload1$hidFileName", 250); model.CityId = SiteUserInfo.CityId; model.CompanyId = SiteUserInfo.CompanyID; model.CompanyName = SiteUserInfo.CompanyName; model.ContactName = Utils.GetFormValue("txtname", 100); model.ContactTel = Utils.GetFormValue("txttel", 50); model.ExchangeTag = (EyouSoft.Model.CommunityStructure.ExchangeTag)Utils.GetInt(Request.Form["type"]); model.ExchangeText = Utils.GetFormValue("content"); model.ExchangeTitle = Utils.GetFormValue("title"); model.ID = Guid.NewGuid().ToString(); model.IssueTime = DateTime.Now; model.OperatorId = SiteUserInfo.ID; model.OperatorMQ = Utils.GetFormValue("txtmq", 20); model.OperatorName = SiteUserInfo.ContactInfo.ContactName; model.ProvinceId = SiteUserInfo.ProvinceId; int htype = Utils.GetInt(Request.Form["htype"]); if (htype == 1) { model.ExchangeCategory = EyouSoft.Model.CommunityStructure.ExchangeCategory.求; } else { model.ExchangeCategory = EyouSoft.Model.CommunityStructure.ExchangeCategory.供; } if (model.ExchangeCategory == EyouSoft.Model.CommunityStructure.ExchangeCategory.供) { model.TopicClassID = (EyouSoft.Model.CommunityStructure.ExchangeType)Utils.GetInt(Request.Form["seltype2"]); } else { model.TopicClassID = (EyouSoft.Model.CommunityStructure.ExchangeType)Utils.GetInt(Request.Form["seltype1"]); } model.IsCheck = IsCompanyCheck;//供求审核状态默认等于当前用户所在公司的审核状态 string[] strProvinceIds = Utils.GetFormValues("selprov"); IList <int> ProvinceIds = null; if (strProvinceIds != null && strProvinceIds.Length > 0) { ProvinceIds = new List <int>(); for (int i = 0; i < strProvinceIds.Length; i++) { if (!string.IsNullOrEmpty(strProvinceIds[i]) && StringValidate.IsInteger(strProvinceIds[i])) { ProvinceIds.Add(int.Parse(strProvinceIds[i])); } } } bool Result = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().AddExchangeList(model, ProvinceIds == null ? null : ProvinceIds.ToArray()); if (Result) { Utils.ShowAndClose("发布成功!", EyouSoft.Common.URLREWRITE.SupplierInfo.InfoUrlWrite(model.ID, CityId)); } else { Utils.ShowAndRedirect("发布失败!", Request.RawUrl); } }
protected void btnSave_Click(object sender, EventArgs e) { #region 数据验证 StringBuilder StrErr = new StringBuilder(); if (Utils.GetFormValue(ddlTypes.UniqueID) == "-1") { StrErr.Append("请选择类别\n"); } if (Utils.GetFormValue(ddlTags.UniqueID) == "-1") { StrErr.Append("请选择标签\n"); } if (txtContent.Text.Trim().Length == 0) { StrErr.Append("请输入供求内容"); } if (StrErr.Length > 0) { MessageBox.Show(this.Page, StrErr.ToString()); return; } StrErr = null; #endregion EyouSoft.Model.CommunityStructure.ExchangeList model = new EyouSoft.Model.CommunityStructure.ExchangeList(); model.AttatchPath = string.Empty; model.CityId = SiteUserInfo.CityId; model.CompanyId = SiteUserInfo.CompanyID; model.CompanyName = SiteUserInfo.CompanyName; model.ContactName = SiteUserInfo.ContactInfo.ContactName; model.ContactTel = SiteUserInfo.ContactInfo.Tel; model.ExchangeTag = (EyouSoft.Model.CommunityStructure.ExchangeTag) int.Parse(Utils.GetFormValue(ddlTags.UniqueID)); model.ExchangeText = Utils.GetText(EyouSoft.Common.Utils.InputText(txtContent.Text), 250); model.ExchangeTitle = Utils.GetText(model.ExchangeText, 26); model.ID = Guid.NewGuid().ToString(); model.IssueTime = DateTime.Now; model.OperatorId = SiteUserInfo.ID; model.OperatorMQ = SiteUserInfo.ContactInfo.MQ; model.OperatorName = SiteUserInfo.ContactInfo.ContactName; model.ProvinceId = SiteUserInfo.ProvinceId; model.TopicClassID = (EyouSoft.Model.CommunityStructure.ExchangeType) int.Parse(Utils.GetFormValue(ddlTypes.UniqueID)); model.IsCheck = IsCompanyCheck; model.ExchangeCategory = Utils.GetFormValue("dllCategory") == "1" ? EyouSoft.Model.CommunityStructure.ExchangeCategory.供 : EyouSoft.Model.CommunityStructure.ExchangeCategory.求; IList <int> ProvinceIds = null; string[] strProvinceIds = Utils.GetFormValues("ckbProvince"); if (strProvinceIds != null && strProvinceIds.Length > 0) { ProvinceIds = new List <int>(); for (int i = 0; i < strProvinceIds.Length; i++) { if (!string.IsNullOrEmpty(strProvinceIds[i]) && StringValidate.IsInteger(strProvinceIds[i])) { ProvinceIds.Add(int.Parse(strProvinceIds[i])); } } } bool Result = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().AddExchangeList(model, ProvinceIds == null ? null : ProvinceIds.ToArray()); model = null; if (Result) { MessageBox.ShowAndRedirect(this.Page, "供求发布成功!", Request.RawUrl); } else { MessageBox.ShowAndRedirect(this.Page, "供求发布失败!", Request.RawUrl); } }
/// <summary> /// 保存供求信息 /// </summary> private void Save() { model = new EyouSoft.Model.CommunityStructure.ExchangeList(); //供求信息标签 if (!string.IsNullOrEmpty(Request.Form["rbtExchangeTag"])) { model.ExchangeTag = (EyouSoft.Model.CommunityStructure.ExchangeTag)Enum.Parse(typeof(EyouSoft.Model.CommunityStructure.ExchangeTag), Request.Form["rbtExchangeTag"].ToString(), true); } else { Response.Clear(); Response.Write("[{isSuccess:false,ErrorMessage:'标签必须选择一个,请选择!'}]"); Response.End(); return; } model.ExchangeCategory = (EyouSoft.Model.CommunityStructure.ExchangeCategory)Utils.GetInt(Request.Form["applycat"], 1); //供求信息类别 if (model.ExchangeCategory == EyouSoft.Model.CommunityStructure.ExchangeCategory.求) { model.TopicClassID = (EyouSoft.Model.CommunityStructure.ExchangeType)Enum.Parse(typeof(EyouSoft.Model.CommunityStructure.ExchangeType), Request.Form["rbtExchangeTypeq"], true); } if (model.ExchangeCategory == EyouSoft.Model.CommunityStructure.ExchangeCategory.供) { model.TopicClassID = (EyouSoft.Model.CommunityStructure.ExchangeType)Enum.Parse(typeof(EyouSoft.Model.CommunityStructure.ExchangeType), Request.Form["rbtExchangeTypeg"], true); } string exchangeText = Utils.EditInputText(Request.Form["AddSupplyInfo_ExchangeText"]);//供求信息 if (exchangeText == "") { Response.Clear(); Response.Write("[{isSuccess:false,ErrorMessage:'供求信息不能为空!'}]"); Response.End(); return; } if (Utils.GetFormValue("applytitle") == "" || Utils.GetFormValue("applytitle") == "请填写供应信息标题" || Utils.GetFormValue("applytitle") == "请填写求购信息标题") { Response.Clear(); Response.Write("[{isSuccess:false,ErrorMessage:'标题不能为空!'}]"); Response.End(); return; } //对供求信息的内容进行过滤,只允许添加tongye114.com的站内链接 exchangeText = removeHref.Replace(exchangeText, ""); model.ExchangeTitle = Utils.GetFormValue("applytitle"); model.ProvinceId = this.SiteUserInfo.ProvinceId; model.CityId = this.SiteUserInfo.CityId; model.OperatorName = this.SiteUserInfo.UserName; model.OperatorId = this.SiteUserInfo.ID; model.CompanyName = this.SiteUserInfo.CompanyName; model.OperatorMQ = this.SiteUserInfo.ContactInfo.MQ; model.ID = Guid.NewGuid().ToString(); model.CompanyId = this.SiteUserInfo.CompanyID; ExchangeID = Utils.GetFormValue("ExchangeID"); model.ExchangeText = exchangeText; model.IsCheck = this.IsCompanyCheck; if (model.ExchangeTitle.Length > 26) { model.ExchangeTitle = model.ExchangeTitle.Substring(0, 26); } else { model.ExchangeTitle = model.ExchangeTitle; } model.ContactName = Utils.GetFormValue("AddSupplyInfo_UserName"); model.ContactTel = Utils.GetFormValue("AddSupplyInfo_Tel"); //附件地址 string path = Utils.GetFormValue("ctl00$ContentPlaceHolder1$AttatchPathFileUpload1$hidFileName"); if (path.Length > 1) { model.AttatchPath = path; } if (string.IsNullOrEmpty(model.AttatchPath)) { model.AttatchPath = Utils.GetFormValue("AttatchPath"); } #region 城市,供求管理信息集合 string[] ProvinceList_forSupply = Utils.GetFormValues("ProvinceList_forSupply"); int[] provinceIds = new int[ProvinceList_forSupply.Length]; for (int m = 0; m < ProvinceList_forSupply.Length; m++) { if (!string.IsNullOrEmpty(ProvinceList_forSupply[m])) { provinceIds[m] = int.Parse(ProvinceList_forSupply[m]); } } #endregion #region 供求图片集合 //IList<EyouSoft.Model.CommunityStructure.ExchangePhoto> PhotoLists = new List<EyouSoft.Model.CommunityStructure.ExchangePhoto>(); //EyouSoft.Model.CommunityStructure.ExchangePhoto photoModel = null; //for (int i = 1; i <= 4; i++) //{ // photoModel = new EyouSoft.Model.CommunityStructure.ExchangePhoto(); // photoModel.ImgPath = Utils.GetFormValue("ctl00$ContentPlaceHolder1$Upload_SupplyInfoImge" + i.ToString() + "$hidFileName"); // if (string.IsNullOrEmpty(photoModel.ImgPath)) // { // photoModel.ImgPath = Utils.GetFormValue("hid_MyOwenerShop_Upload_ProductInfo" + i.ToString()); // } // photoModel.ImgId = Utils.GetFormValue("hidImageId" + i.ToString()); // photoModel.ExchangeId = ExchangeID; // PhotoLists.Add(photoModel); // photoModel = null; //} //model.ExchangePhotoList = PhotoLists; //PhotoLists = null; #endregion bool isTrue = false; if (ActionType == "add") { isTrue = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().AddExchangeList(model, provinceIds); } else { model.ID = ExchangeID; isTrue = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().UpdateExchangeList(model, provinceIds); } model = null; if (isTrue) { Response.Clear(); Response.Write("[{isSuccess:true,ErrorMessage:'保存成功!'}]"); Response.End(); return; } else { Response.Clear(); Response.Write("[{isSuccess:false,ErrorMessage:'保存失败!'}]"); Response.End(); return; } }
/// <summary> /// 初始化 /// </summary> private void InitPage() { model = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().GetModel(ExchangeID); int proCount = 0; if (model != null) { Tel = model.ContactTel; ConnectName = model.ContactName; MQ = model.OperatorMQ; ExchangeText = model.ExchangeText; string fileName = ""; string filePath = ""; if (model.AttatchPath.Split('|').Length > 1) { fileName = model.AttatchPath.Split('|')[0]; filePath = model.AttatchPath.Split('|')[1]; } else { filePath = model.AttatchPath; } AttatchPath = filePath; AttatchPathFileUpload1.LastDocFile = filePath; //if (model.ExchangePhotoList != null && model.ExchangePhotoList.Count > 0) //{ // for (int j = 0; j < model.ExchangePhotoList.Count; j++) // { // switch (j) // { // case 0: // SupplyInfoImgePath1 = model.ExchangePhotoList[j].ImgPath; // imgId1 = model.ExchangePhotoList[j].ImgId; // break; // case 1: // SupplyInfoImgePath2 = model.ExchangePhotoList[j].ImgPath; // imgId2 = model.ExchangePhotoList[j].ImgId; // break; // case 2: // SupplyInfoImgePath3 = model.ExchangePhotoList[j].ImgPath; // imgId3 = model.ExchangePhotoList[j].ImgId; // break; // case 3: // SupplyInfoImgePath4 = model.ExchangePhotoList[j].ImgPath; // imgId4 = model.ExchangePhotoList[j].ImgId; // break; // } // } //} } else { ConnectName = this.SiteUserInfo.ContactInfo.ContactName; MQ = this.SiteUserInfo.ContactInfo.MQ; Tel = this.SiteUserInfo.ContactInfo.Tel; if (string.IsNullOrEmpty(Tel)) { Tel = this.SiteUserInfo.ContactInfo.Mobile; } } #region 绑定标签枚举 string[] strExchangeTag = Enum.GetNames(typeof(EyouSoft.Model.CommunityStructure.ExchangeTag)); if (strExchangeTag != null && strExchangeTag.Length > 0) { int Tag = 1; if (model != null) { Tag = (int)model.ExchangeTag; } if (Tag == 0) { Tag = 1; } for (int i = 1; i <= strExchangeTag.Length; i++) { if (Tag == ((int)(EyouSoft.Model.CommunityStructure.ExchangeTag)Enum.Parse(typeof(EyouSoft.Model.CommunityStructure.ExchangeTag), strExchangeTag[i - 1]))) { ExchangeTagHtml += string.Format("<div class=\"gqbqx\"><input type=\"radio\" checked=\"checked\" id=\"gqbiaoqian{0}\" name=\"rbtExchangeTag\" value=\"{0}\" /></div><div class=\"gqbiaoqian{0}\"><label for=\"gqbiaoqian{0}\">{1}</label></div>", i, strExchangeTag[i - 1]); } else { ExchangeTagHtml += string.Format("<div class=\"gqbqx\"><input type=\"radio\" id=\"gqbiaoqian{0}\" name=\"rbtExchangeTag\" value=\"{0}\" /></div><div class=\"gqbiaoqian{0}\"><label for=\"gqbiaoqian{0}\">{1}</label></div>", i, strExchangeTag[i - 1]); } } } #endregion #region 绑定类别枚举 IList <EyouSoft.Common.EnumObj> listg = GetExchangeTypeListByCat(EyouSoft.Model.CommunityStructure.ExchangeCategory.供); IList <EyouSoft.Common.EnumObj> listq = GetExchangeTypeListByCat(EyouSoft.Model.CommunityStructure.ExchangeCategory.求); EyouSoft.Model.CommunityStructure.ExchangeCategory curr = EyouSoft.Model.CommunityStructure.ExchangeCategory.供; if (model != null) { curr = model.ExchangeCategory; } if (listg != null && listg.Count > 0) { ExchangeTypeHtmlg += string.Format("<select name=\"rbtExchangeTypeg\" id=\"ExchangeTypeg\" {0}>", curr == EyouSoft.Model.CommunityStructure.ExchangeCategory.求 ? "style=\"display:none;\"" : ""); foreach (EyouSoft.Common.EnumObj e in listg) { ExchangeTypeHtmlg += string.Format("<option value=\"{0}\" {2}>{1}</option>", e.Value, e.Text, model == null ? "" : (e.Value == model.TopicClassID.ToString() ? "selected='selected'" : "")); } ExchangeTypeHtmlg += "</select>"; } if (listq != null && listq.Count > 0) { ExchangeTypeHtmlq += string.Format("<select name=\"rbtExchangeTypeq\" id=\"ExchangeTypeq\" {0}>", curr == EyouSoft.Model.CommunityStructure.ExchangeCategory.供 ? "style=\"display:none;\"" : ""); foreach (EyouSoft.Common.EnumObj e in listq) { ExchangeTypeHtmlq += string.Format("<option value=\"{0}\" {2}>{1}</option>", e.Value, e.Text, model == null ? "" : (e.Value == model.TopicClassID.ToString() ? "selected='selected'" : "")); } ExchangeTypeHtmlq += "</select>"; } #endregion #region 绑定省份 IList <EyouSoft.Model.SystemStructure.SysProvince> ProvinceList = EyouSoft.BLL.SystemStructure.SysProvince.CreateInstance().GetProvinceList(); if (ProvinceList != null && ProvinceList.Count > 0) { if (model != null && model.CityContactList != null) { proCount = model.CityContactList.Count; } int[] ProLists = new int[proCount]; if (model != null && model.CityContactList != null) { for (int k = 0; k < model.CityContactList.Count; k++) { if (!ProLists.Contains(model.CityContactList[k].ProvinceId)) { ProLists[k] = model.CityContactList[k].ProvinceId; } } } else { if (model != null) { ProLists[0] = model.ProvinceId; } } ((List <EyouSoft.Model.SystemStructure.SysProvince>)ProvinceList).ForEach(item => { if (model != null && model.CityContactList != null) { if (ProLists.Contains(item.ProvinceId)) { ExchangeProvinceHtml += string.Format("<input id=\"ProvinceList_{0}\" type=\"checkbox\" name=\"ProvinceList_forSupply\" value=\"{0}\" {2} /><label for=\"ProvinceList_{0}\">{1}</label>", item.ProvinceId, item.ProvinceName, "checked=\"checked\""); } else { ExchangeProvinceHtml += string.Format("<input id=\"ProvinceList_{0}\" type=\"checkbox\" name=\"ProvinceList_forSupply\" value=\"{0}\" {2} /><label for=\"ProvinceList_{0}\">{1}</label>", item.ProvinceId, item.ProvinceName, ""); } } else { ExchangeProvinceHtml += string.Format("<input id=\"ProvinceList_{0}\" type=\"checkbox\" name=\"ProvinceList_forSupply\" value=\"{0}\" {2} /><label for=\"ProvinceList_{0}\">{1}</label>", item.ProvinceId, item.ProvinceName, ""); } }); } ProvinceList = null; #endregion }
private void Post() { //同业中心编号 int SuperID = EyouSoft.Common.Utils.GetInt(EyouSoft.Common.Utils.GetQueryStringValue("SuperID")); //同心中心所选省份 EyouSoft.Model.MQStructure.IMSuperCluster IMSuperCluster = EyouSoft.BLL.MQStructure.IMSuperCluster.CreateInstance().GetSuperClusterByID(SuperID); System.Collections.Generic.IList <int> ProvinceIds = null; if (IMSuperCluster != null) { if (IMSuperCluster.SelectType == EyouSoft.Model.MQStructure.SelectType.择省市) { string[] strProvinceIds = IMSuperCluster.SelectValue.Split(','); if (strProvinceIds != null && strProvinceIds.Length > 0) { ProvinceIds = new System.Collections.Generic.List <int>(); for (int i = 0; i < strProvinceIds.Length; i++) { if (!string.IsNullOrEmpty(strProvinceIds[i]) && EyouSoft.Common.Function.StringValidate.IsInteger(strProvinceIds[i])) { ProvinceIds.Add(int.Parse(strProvinceIds[i])); } } } } } EyouSoft.Model.CommunityStructure.ExchangeList model = new EyouSoft.Model.CommunityStructure.ExchangeList(); if (content.Value.Length == 0) { EyouSoft.Common.Function.MessageBox.ResponseScript(this, "document.getElementById(\"showMsg\").innerHTML=\"请输入求购内容\";"); return; } if (content.Value.Length > 500) { EyouSoft.Common.Function.MessageBox.ResponseScript(this, "document.getElementById(\"showMsg\").innerHTML=\"求购内容最多500字\";"); return; } if (content.Value.Length > 15) { model.ExchangeTitle = content.Value.Substring(0, 15); } else { model.ExchangeTitle = content.Value; } model.CityId = SiteUserInfo.CityId; model.CompanyId = SiteUserInfo.CompanyID; model.CompanyName = SiteUserInfo.CompanyName; model.ContactName = SiteUserInfo.ContactInfo.ContactName; model.ContactTel = SiteUserInfo.ContactInfo.Tel; model.ExchangeCategory = EyouSoft.Model.CommunityStructure.ExchangeCategory.求; model.ExchangeTag = EyouSoft.Model.CommunityStructure.ExchangeTag.无; model.ExchangeText = content.Value; model.IsCheck = IsCompanyCheck; model.IssueTime = DateTime.Now; model.IsTop = false; model.OperatorId = SiteUserInfo.ID; model.OperatorMQ = SiteUserInfo.ContactInfo.MQ; model.OperatorName = SiteUserInfo.ContactInfo.ContactName; model.ProvinceId = SiteUserInfo.ProvinceId; model.AttatchPath = ""; model.TopicClassID = EyouSoft.Model.CommunityStructure.ExchangeType.业MQ; bool Result = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().AddExchangeList(model, ProvinceIds == null ? null : ProvinceIds.ToArray()); if (Result) { content.Value = ""; EyouSoft.Common.Function.MessageBox.ResponseScript(this, "document.getElementById(\"showMsg\").innerHTML=\"发布成功\";"); } else { EyouSoft.Common.Function.MessageBox.ResponseScript(this, "document.getElementById(\"showMsg\").innerHTML=\"发布失败\";"); } }
/// <summary> /// 行绑定事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void RepeatorList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { System.Text.StringBuilder strTmp = null; EyouSoft.Model.CommunityStructure.ExchangeList Exchange = (EyouSoft.Model.CommunityStructure.ExchangeList)e.Item.DataItem; EyouSoft.Model.SystemStructure.SysProvince modelP = null; Literal ltr = (Literal)e.Item.FindControl("ltrTagHtml"); if (ltr != null && Exchange != null && Exchange.ExchangeTagHtml != null) { ltr.Text = Exchange.ExchangeTagHtml.TagHTML; } //初始化省份链接 Literal ltrProvince = (Literal)e.Item.FindControl("ltrProvince"); if (ltrProvince != null && Exchange != null) { strTmp = new System.Text.StringBuilder(); modelP = new EyouSoft.Model.SystemStructure.SysProvince(); modelP = EyouSoft.BLL.SystemStructure.SysProvince.CreateInstance().GetProvinceModel(Exchange.ProvinceId); if (IsLogin) { strTmp.AppendFormat("<a href='{0}'>", EyouSoft.Common.URLREWRITE.SupplierInfo.InfoListWrite(Exchange.ProvinceId, CityId)); //strTmp.AppendFormat("<a href='{0}'>", Utils.GeneratePublicCenterUrl(string.Format("/SupplierInfo/ExchangeList.aspx?PId={0}", Exchange.ProvinceId), CityId)); strTmp.AppendFormat("{0}</a>", modelP == null ? "" : "【" + modelP.ProvinceName + "】"); } else { strTmp.AppendFormat("<a href='{0}'>", EyouSoft.Common.URLREWRITE.SupplierInfo.InfoListWrite(Exchange.ProvinceId, CityId)); //strTmp.AppendFormat("<a href='{0}'>", Utils.GeneratePublicCenterUrl(string.Format("/SupplierInfo/ExchangeList.aspx?PId={0}", Exchange.ProvinceId), CityId)); strTmp.AppendFormat("{0}</a>", modelP == null ? "" : "【" + modelP.ProvinceName + "】"); } ltrProvince.Text = strTmp.ToString(); modelP = null; strTmp = null; } //初始化标题链接 Literal ltrTitle = (Literal)e.Item.FindControl("ltrTitle"); if (ltrTitle != null && Exchange != null) { strTmp = new System.Text.StringBuilder(); if (IsLogin) { strTmp.AppendFormat("<a href='{0}' title=\"{2}\">{1}</a>", SiteUserInfo.IsEnable? EyouSoft.Common.URLREWRITE.SupplierInfo.InfoUrlWrite(Exchange.ID, CityId) :"javascript:alert('您的账户还没有启用,请联系管理员!');return false;", Utils.GetText(Exchange.ExchangeTitle, 26), Exchange.ExchangeTitle); } else { //strLoginUrl = EyouSoft.Security.Membership.UserProvider.BuildLoginAndReturnUrl( //EyouSoft.Common.URLREWRITE.SupplierInfo.InfoUrlWrite(Exchange.ID, CityId), // "你目前进行的操作,需要“登录”后才能继续……"); //strTmp.AppendFormat("<a href='{0}' title=\"{1}\">", strLoginUrl, Exchange.ExchangeTitle); strTmp.AppendFormat("<a href='{0}' title=\"{1}\">", EyouSoft.Common.URLREWRITE.SupplierInfo.InfoUrlWrite(Exchange.ID, CityId), Exchange.ExchangeTitle); strTmp.AppendFormat("{0}</a>", Utils.GetText(Exchange.ExchangeTitle, 26)); } ltrTitle.Text = strTmp.ToString(); strTmp = null; } //初始化MQ链接 Literal ltrMQ = (Literal)e.Item.FindControl("ltrMQ"); if (ltrMQ != null && Exchange != null) { ltrMQ.Text = Utils.GetMQ(Exchange.OperatorMQ); } Exchange = null; } }
protected void btnSave_Click(object sender, EventArgs e) { #region 验证数据 string ErrStr = string.Empty; string[] Tags = Utils.GetFormValues("radioTag"); string[] Types = Utils.GetFormValues("radioType"); string AttatchPath = Utils.GetFormValue("ctl00$ctl00$Main$SupplierMain$SingleFileUpload1$hidFileName"); if (Tags.Length == 0) { ErrStr += "请选择标签\\n"; } if (Types.Length == 0) { ErrStr += "请选择类别\\n"; } if (txtInfo.Value.Trim().Length == 0) { ErrStr += "请输入供求信息内容\\n"; } if (txtMQ.Value.Trim().Length == 0) { ErrStr += "请输入MQ号码"; } if (!string.IsNullOrEmpty(ErrStr)) { MessageBox.Show(this.Page, ErrStr); return; } #endregion EyouSoft.Model.CommunityStructure.ExchangeList model = new EyouSoft.Model.CommunityStructure.ExchangeList(); model.AttatchPath = AttatchPath; model.CityId = SiteUserInfo.CityId; model.CompanyId = SiteUserInfo.CompanyID; model.CompanyName = SiteUserInfo.CompanyName; model.ContactName = Utils.InputText(txtName.Value); model.ContactTel = Utils.InputText(txtTel.Value); model.ExchangeTag = (EyouSoft.Model.CommunityStructure.ExchangeTag) int.Parse(Tags[0]); model.ExchangeText = Utils.InputText(txtInfo.Value); model.ExchangeTitle = Utils.GetText(model.ExchangeText, 26); model.ID = Guid.NewGuid().ToString(); model.IssueTime = DateTime.Now; model.OperatorId = SiteUserInfo.ID; model.OperatorMQ = Utils.InputText(txtMQ.Value); model.OperatorName = SiteUserInfo.ContactInfo.ContactName; model.ProvinceId = SiteUserInfo.ProvinceId; model.TopicClassID = (EyouSoft.Model.CommunityStructure.ExchangeType) int.Parse(Types[0]); model.IsCheck = IsCompanyCheck;//供求审核状态默认等于当前用户所在公司的审核状态 IList <int> ProvinceIds = null; string[] strProvinceIds = Utils.GetFormValues("ckbProvince"); if (strProvinceIds != null && strProvinceIds.Length > 0) { ProvinceIds = new List <int>(); for (int i = 0; i < strProvinceIds.Length; i++) { if (!string.IsNullOrEmpty(strProvinceIds[i]) && StringValidate.IsInteger(strProvinceIds[i])) { ProvinceIds.Add(int.Parse(strProvinceIds[i])); } } } bool Result = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().Add(model, ProvinceIds == null ? null : ProvinceIds.ToArray()); model = null; txtInfo.Value = ""; if (Result) { Utils.ShowAndRedirect("供求发布成功!", Request.RawUrl); } else { Utils.ShowAndRedirect("供求发布失败!", Request.RawUrl); } }
/// <summary> /// 保存供应 /// </summary> private void sbtnSave() { #region 验证数据 string ErrStr = string.Empty; int Type = Utils.GetInt(Request.Form["schooseType"], 1); //类型 string[] Tags = Utils.GetFormValues("sradioTag"); //标签 string Title = Utils.GetFormValue("stxtTitle", 50); //标题 string TxtInfo = Utils.GetFormValue("stxtInfo", 500); //内容 string TxtName = Utils.InputText(stxtName.Value, 100); //姓名 string TxtMQ = Utils.InputText(stxtMQ.Value, 20); //MQ string TxtTel = Utils.InputText(stxtTel.Value, 50); //联系电话 string AttatchPath = Utils.GetFormValue("ctl00$ctl00$c1$SupplierBody$SingleFileUpload2$hidFileName", 250); //附件地址 string[] strProvinceIds = Utils.GetFormValues("sckbProvince"); //发布省份 if (Title.Trim().Length == 0) { ErrStr += "请输入求购信息标题\\n"; } if (TxtInfo.Trim().Length == 0) { ErrStr += "请输入求购信息内容\\n"; } if (TxtMQ.Trim().Length == 0) { ErrStr += "请输入MQ号码"; } if (!string.IsNullOrEmpty(ErrStr)) { MessageBox.Show(this.Page, ErrStr); return; } #endregion EyouSoft.Model.CommunityStructure.ExchangeList model = new EyouSoft.Model.CommunityStructure.ExchangeList(); model.AttatchPath = AttatchPath; model.CityId = SiteUserInfo.CityId; model.CompanyId = SiteUserInfo.CompanyID; model.CompanyName = SiteUserInfo.CompanyName; model.ContactName = TxtName; model.ContactTel = TxtTel; model.ExchangeTag = (EyouSoft.Model.CommunityStructure.ExchangeTag) int.Parse(Tags[0]); model.ExchangeText = TxtInfo; model.ExchangeTitle = Title; model.ID = Guid.NewGuid().ToString(); model.IssueTime = DateTime.Now; model.OperatorId = SiteUserInfo.ID; model.OperatorMQ = TxtMQ; model.OperatorName = SiteUserInfo.ContactInfo.ContactName; model.ProvinceId = SiteUserInfo.ProvinceId; model.TopicClassID = (EyouSoft.Model.CommunityStructure.ExchangeType)(Type); model.IsCheck = IsCompanyCheck;//供求审核状态默认等于当前用户所在公司的审核状态 model.ExchangeCategory = EyouSoft.Model.CommunityStructure.ExchangeCategory.供; IList <int> ProvinceIds = null; if (strProvinceIds != null && strProvinceIds.Length > 0) { ProvinceIds = new List <int>(); for (int i = 0; i < strProvinceIds.Length; i++) { if (!string.IsNullOrEmpty(strProvinceIds[i]) && StringValidate.IsInteger(strProvinceIds[i])) { ProvinceIds.Add(int.Parse(strProvinceIds[i])); } } } bool Result = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance().AddExchangeList(model, ProvinceIds == null ? null : ProvinceIds.ToArray()); if (Result) { Utils.ShowAndRedirect("供应发布成功!", EyouSoft.Common.URLREWRITE.SupplierInfo.InfoUrlWrite(model.ID, CityId)); } else { Utils.ShowAndRedirect("供应发布失败!", Request.RawUrl); } model = null; }