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); } }
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 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); } }
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> 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; }