/// <summary> /// 增加一条数据 /// </summary> public int Add(Tz888.Model.CustomInfoModel model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Tz888.Model.CustomInfoModel model) { dal.Update(model); }
private void SearchInfoSelect() { DataView dv; DataTable dt; DataTable dt1 = (DataTable)this.ViewState["dt"]; DataRow dr = dt1.Rows[0]; string strCustomType = dr["CustomType"].ToString(); //this.ViewState[ "CustomType" ].ToString(); string strCriteria = ""; //对已经取得的查询条件不在取 if (strCustomType.Trim() != "") { //#endregion-- 取条件并组织 ---------------- #region -- 取条件并组织 ---------------- Tz888.Model.CustomInfoModel CustomInfo = new Tz888.Model.CustomInfoModel(); if (dr["Calling"] != null) { CustomInfo.Calling = dr["Calling"].ToString(); } if (dr["CustomType"] != null) { CustomInfo.CustomType = Convert.ToInt32(dr["CustomType"].ToString()); } if (dr["Genre"] != null) { CustomInfo.Genre = dr["Genre"].ToString(); } if (dr["Keyword"] != null) { CustomInfo.Keyword = dr["Keyword"].ToString(); } if (dr["LoginName"] != null) { CustomInfo.LoginName = dr["LoginName"].ToString(); } if (dr["Money"] != null) { CustomInfo.Money = dr["Money"].ToString(); } if (dr["SmallCalling"] != null) { CustomInfo.SmallCalling = dr["SmallCalling"].ToString(); } if (dr["Type"] != null) { CustomInfo.Type = dr["Type"].ToString(); } if (dr["City"] != null) { CustomInfo.City = dr["City"].ToString(); } //if (dr["currency"] != null) //{ // CustomInfo.currency = dr["currency"].ToString().Trim(); //} if (dr["CooperationDemandTypeID"] != null) { CustomInfo.CooperationDemandTypeID = dr["CooperationDemandTypeID"].ToString(); } else { CustomInfo.CooperationDemandTypeID = ""; } #region 政府招商 //招商 政府招商 if (strCustomType == "0") { if (CustomInfo.Type.Trim() != "") //招商类别 { strCriteria = "MerchantTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling != "") //所属行业 { if (strCriteria != "") { strCriteria = strCriteria + " AND ("; } else { strCriteria = " ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "IndustryClassList like '%" + arrType[i] + "%' OR "; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 4) + ")"; } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND KeyWord like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "KeyWord like '%" + CustomInfo.Keyword + "%'"; } } strCriteria = strCriteria + " and AuditStatus =1"; } #endregion #region 政府招商 //招商 政府招商 if (strCustomType == "0") { if (CustomInfo.Type.Trim() != "") //招商类别 { strCriteria = "MerchantTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling != "") //所属行业 { if (strCriteria != "") { strCriteria = strCriteria + " AND ("; } else { strCriteria = " ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "IndustryClassList like '%" + arrType[i] + "%' OR "; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 4) + ")"; } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND KeyWord like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = " title KeyWord '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + " and AuditStatus =1"; } else { strCriteria = strCriteria + " AuditStatus =1"; } } #endregion #region 投资 企业项目 else if (strCustomType == "2") { if (CustomInfo.Money.Trim() != "")//投资金额 { if (strCriteria != "") { strCriteria = strCriteria + " AND CapitalID IN ("; } else { strCriteria = " CapitalID IN ("; } // strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") //投资行业 { if (strCriteria != "") { strCriteria = strCriteria + " AND ("; } else { strCriteria = " ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "IndustryBID like '%" + arrType[i] + "%' OR "; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 4) + ")"; // string[] arrType = CustomInfo.Calling.Split('|'); //string[] arrType = CustomInfo.Calling.Split('|'); //for (int i = 0; i < arrType.Length; i++) //{ // if (arrType[i].Trim() != "" && i == 0) // { // strCriteria = strCriteria + " AND IndustryBID like '%" + arrType[i].Trim() + "%'"; // } // else if (arrType[i].Trim() != "" && i == 0) // { // strCriteria = strCriteria + " or IndustryBID like '%" + arrType[i].Trim() + "%'"; // } //} } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } if (CustomInfo.Type != "") { string typeid = CustomInfo.Type.ToString().Trim(); if (typeid == "0") { typeid = "10"; } if (typeid == "0|1") { typeid = "10"; } else { typeid = "9"; } if (strCriteria != "") { strCriteria = strCriteria + " AND CooperationDemandType like '%" + typeid + "%'"; } else { strCriteria = " title CooperationDemandType '%" + typeid + "%'"; } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND KeyWord like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = " title KeyWord '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + " and AuditStatus =1"; } else { strCriteria = strCriteria + " AuditStatus =1"; } } #endregion #region 融资 资本资源 else if (strCustomType == "1") { if (CustomInfo.Money.Trim() != "") //投资金额 { strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") //投资行业 { string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND IndustryBID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " or IndustryBID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (strCriteria.Trim() != "") { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } else { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND KeyWord like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = " title KeyWord '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + " and AuditStatus =1"; } else { strCriteria = strCriteria + " AuditStatus =1"; } } #endregion #region 资讯 else if (strCustomType == "3") { if (CustomInfo.Type.Trim() != "") //资讯类型 { strCriteria = "NewsTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Title like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + "and NewsLblStatus=1"; } else { strCriteria = strCriteria + " NewsLblStatus=1"; } } #endregion #endregion -- 取条件并组织 ---------------- this.ViewState["Criteria"] = strCriteria; } // Label1.Text = this.ViewState["Criteria"].ToString(); try { Tz888.SQLServerDAL.Conn obj = new Tz888.SQLServerDAL.Conn(); if (strCustomType == "0") { this.Pager1.TableViewName = "MerchantInfo_Viw2"; //政府招商 if (this.ViewState["Criteria"].ToString().Trim() != "") { this.Pager1.StrWhere = this.ViewState["Criteria"].ToString(); } } else if (strCustomType == "1") { this.Pager1.TableViewName = "CapitalInfo_Viw2"; //资本资源 if (this.ViewState["Criteria"].ToString().Trim() != "") { this.Pager1.StrWhere = this.ViewState["Criteria"].ToString(); } } else if (strCustomType == "2") { this.Pager1.TableViewName = "ProjectInfoTab_Viw2"; //企业项目 if (this.ViewState["Criteria"].ToString().Trim() != "") { this.Pager1.StrWhere = this.ViewState["Criteria"].ToString(); } } else if (strCustomType == "3") { this.Pager1.TableViewName = "NewsTab_Viw2"; if (this.ViewState["Criteria"].ToString().Trim() != "") { this.Pager1.StrWhere = this.ViewState["Criteria"].ToString(); } } else { } ////通过session接收搜索条件,判断session["Criteria"] if为空,为空则显示与订阅条件匹配数据else搜索条件匹配数据 //if (Session["customInfo"] != null) //{ // Tz888.Model.CustomInfoModel customInfo = (Tz888.Model.CustomInfoModel)Session["customInfo"]; // this.Pager1.StrWhere = getStrWhere(customInfo); //} this.Pager1.DataBind(); } catch { } }
private void SearchInfoSelect() { DataTable dt1 = obj.GetList("CustomInfoTab", "*", "ID", 1, 1, 0, 1, "ID=" + ID); lblNickName.Text = dt1.Rows[0]["LoginName"].ToString(); DataRow dr = dt1.Rows[0]; string strCustomType = dt1.Rows[0]["CustomType"].ToString().Trim(); string a = dt1.Rows[0]["itemCount"].ToString().Trim() == "" ? "10" : dt1.Rows[0]["itemCount"].ToString().Trim(); itemCount = Convert.ToInt32(a); //对已经取得的查询条件不在取 if (strCustomType.Trim() != "") { #region -- 取条件并组织 ---------------- Tz888.Model.CustomInfoModel CustomInfo = new Tz888.Model.CustomInfoModel(); if (dr["Calling"] != null) { CustomInfo.Calling = dr["Calling"].ToString(); } if (dr["CustomType"] != null) { CustomInfo.CustomType = Convert.ToInt32(dr["CustomType"].ToString()); } if (dr["Genre"] != null) { CustomInfo.Genre = dr["Genre"].ToString(); } if (dr["Keyword"] != null) { CustomInfo.Keyword = dr["Keyword"].ToString(); } if (dr["LoginName"] != null) { CustomInfo.LoginName = dr["LoginName"].ToString(); } if (dr["Money"] != null) { CustomInfo.Money = dr["Money"].ToString(); } if (dr["SmallCalling"] != null) { CustomInfo.SmallCalling = dr["SmallCalling"].ToString(); } if (dr["Type"] != null) { CustomInfo.Type = dr["Type"].ToString(); } if (dr["City"] != null) { CustomInfo.City = dr["City"].ToString(); } if (dr["CooperationDemandTypeID"] != null) { CustomInfo.CooperationDemandTypeID = dr["CooperationDemandTypeID"].ToString(); } else { CustomInfo.CooperationDemandTypeID = ""; } //招商 if (strCustomType == "0") { if (CustomInfo.Type.Trim() != "") { strCriteria = "MerchantTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ("; } else { strCriteria = " ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "IndustryClassList like '%" + arrType[i] + "%' OR "; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 4) + ")"; } if (CustomInfo.City != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProvinceID IN ("; } else { strCriteria = " ProvinceID IN ("; } string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.CooperationDemandTypeID != "") { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); if (arrType[0].Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND CooperationDemandType IN ("; } else { strCriteria = " CooperationDemandType IN ("; } for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Keyword like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Keyword like '%" + CustomInfo.Keyword + "%'"; } } } //投资 else if (strCustomType == "1") { if (CustomInfo.Genre.Trim() != "") { strCriteria = "CapitalTypeID IN("; string[] arrType = CustomInfo.Genre.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Money.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND CapitalID IN ("; } else { strCriteria = " CapitalID IN ("; } strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryBID IN ("; } else { strCriteria = " IndustryBID IN ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.CooperationDemandTypeID != "") { string[] arrType = CustomInfo.CooperationDemandTypeID.Trim().Split('|'); if (arrType[0].Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND CooperationDemandType IN ("; } else { strCriteria = " CooperationDemandType IN ("; } for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } } } //融资 else if (strCustomType == "2") { if (CustomInfo.Money.Trim() != "") { strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryBID IN ("; } else { strCriteria = " IndustryBID IN ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.City != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProvinceID IN ("; } else { strCriteria = " ProvinceID IN ("; } string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.CooperationDemandTypeID != "") { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); if (arrType[0].Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND CooperationDemandType IN ("; } else { strCriteria = " CooperationDemandType IN ("; } for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "") { strCriteria = strCriteria + "'" + arrType[i] + "',"; } } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProjectAbout like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "ProjectAbout like '%" + CustomInfo.Keyword + "%'"; } } } //创业 else if (strCustomType == "3") { if (CustomInfo.Money.Trim() != "") { strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryCarveOutID IN ("; } else { strCriteria = " IndustryCarveOutID IN ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryCarveOutID IN ("; } else { strCriteria = " IndustryCarveOutID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.City != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProvinceID IN ("; } else { strCriteria = " ProvinceID IN ("; } string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Title like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; } } } //商机 else if (strCustomType == "4") { if (CustomInfo.Type.Trim() != "") { strCriteria = "OpportunityType IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryOpportunityID IN ("; } else { strCriteria = " IndustryOpportunityID IN ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryOpportunityID IN ("; } else { strCriteria = " IndustryOpportunityID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.City != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProvinceID IN ("; } else { strCriteria = " ProvinceID IN ("; } string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Title like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; } } } //资讯 else if (strCustomType == "5") { if (CustomInfo.Type.Trim() != "") { strCriteria = "NewsTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Title like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; } } strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; #region #endregion } else { } #endregion -- 取条件并组织 ---------------- } if (strCustomType == "0") { TableViewName = "MerchantInfo_VIW_noindex"; } else if (strCustomType == "1") { TableViewName = "CapitalInfo_VIW_noindex"; } else if (strCustomType == "2") { TableViewName = "ProjectInfo_noindex"; } else if (strCustomType == "3") { TableViewName = "CarveOutInfo_Front_VIW"; } else if (strCustomType == "4") { TableViewName = "OpportunityInfo_Front_VIW"; } else if (strCustomType == "5") { TableViewName = "News_Front_VIW"; } DataTable dt = obj.GetList(TableViewName, "Title,PublishT,LoginName,HtmlFile", "InfoID", itemCount, 1, 0, 1, strCriteria); dgMatching.DataSource = dt; dgMatching.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { ////会员类型 //if (Page.User.IsInRole("GT1001")) //{ // pt.Visible = true; // tft.Visible = false; //} //if (Page.User.IsInRole("GT1002") || Page.User.IsInRole("GT1003")) //{ // tft.Visible = true; // pt.Visible = false; //} //页面跳转 if (Convert.ToString(Request.QueryString["Type"]) != null) { if (Request.QueryString["Type"].ToString() == "3") { Response.Redirect("MachingMessageNews.aspx?type=3"); } } if (!Page.IsPostBack) { this.ViewState["CustomType"] = ""; try { ID = Convert.ToInt32(Request.QueryString["ID"]); //if (ID == 0)//查询进来 //{ // //Session[""]建立dr // ds = (DataSet)Session["CustomInfo"]; // ViewState["dt"] = ds.Tables[0]; //} //else//链接进来 //{ string SelectCol = "*"; string Criteria = " id=" + ID; Tz888.SQLServerDAL.Conn obj = new Tz888.SQLServerDAL.Conn(); DataTable dt = obj.GetList("CustomInfoTab", "*", "ID", 1, 1, 0, 1, Criteria); if (dt.Rows.Count > 0) { ViewState["dt"] = dt; } //} ////显示信息 PagerBase = Pager1; RepeaterBase = dgMatching; if (Session["customInfo"] != null) { Tz888.Model.CustomInfoModel customInfo = (Tz888.Model.CustomInfoModel)Session["customInfo"]; this.Pager1.StrWhere = getStrWhere(customInfo); this.Pager1.DataBind(); } else { SearchInfoSelect(); } } catch { //Tz888.Common.MessageBox.Show(this.Page, "操作超时!"); } } }
//获取搜索条件 public string getStrWhere(Tz888.Model.CustomInfoModel CustomInfo) { string strWhere = ""; DataTable dt1 = (DataTable)this.ViewState["dt"]; string strCriteria = ""; //对已经取得的查询条件不在取 string strCustomType = CustomInfo.CustomType.ToString(); if (strCustomType.Trim() != "") { #region -- 取条件并组织 ---------------- #region 政府招商 //招商 政府招商 if (strCustomType == "0") { if (CustomInfo.Type.Trim() != "") //招商类别 { strCriteria = "MerchantTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling != "") //所属行业 { if (strCriteria != "") { strCriteria = strCriteria + " AND ("; } else { strCriteria = " ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "IndustryClassList like '%" + arrType[i] + "%' OR "; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 4) + ")"; } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND KeyWord like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = " title KeyWord '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + " and AuditStatus =1"; } else { strCriteria = strCriteria + " AuditStatus =1"; } this.Pager1.TableViewName = "MerchantInfo_Viw2"; //政府招商 } #endregion #region 投资 企业项目 else if (strCustomType == "2") { if (CustomInfo.Money.Trim() != "")//投资金额 { if (strCriteria != "") { strCriteria = strCriteria + " AND CapitalID IN ("; } else { strCriteria = " CapitalID IN ("; } // strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") //投资行业 { if (strCriteria != "") { strCriteria = strCriteria + " AND ("; } else { strCriteria = " ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "IndustryBID like '%" + arrType[i] + "%' OR "; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 4) + ")"; // string[] arrType = CustomInfo.Calling.Split('|'); //string[] arrType = CustomInfo.Calling.Split('|'); //for (int i = 0; i < arrType.Length; i++) //{ // if (arrType[i].Trim() != "" && i == 0) // { // strCriteria = strCriteria + " AND IndustryBID like '%" + arrType[i].Trim() + "%'"; // } // else if (arrType[i].Trim() != "" && i == 0) // { // strCriteria = strCriteria + " or IndustryBID like '%" + arrType[i].Trim() + "%'"; // } //} } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } if (CustomInfo.Type != "") { string typeid = CustomInfo.Type.ToString().Trim(); if (typeid == "0") { typeid = "10"; } else { typeid = "9"; } if (strCriteria != "") { strCriteria = strCriteria + " AND CooperationDemandType like '%" + typeid + "%'"; } else { strCriteria = " title CooperationDemandType '%" + typeid + "%'"; } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND KeyWord like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = " title KeyWord '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + " and AuditStatus =1"; } else { strCriteria = strCriteria + " AuditStatus =1"; } } #endregion #region 融资 资本资源 else if (strCustomType == "1") { if (CustomInfo.Money.Trim() != "") //投资金额 { strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") //投资行业 { string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND IndustryBID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " or IndustryBID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (strCriteria.Trim() != "") { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } else { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND KeyWord like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = " title KeyWord '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + " and AuditStatus =1"; } else { strCriteria = strCriteria + " AuditStatus =1"; } this.Pager1.TableViewName = "CapitalInfo_Viw2"; //资本资源 } #endregion #region 资讯 else if (strCustomType == "3") { if (CustomInfo.Type.Trim() != "") //资讯类型 { strCriteria = "NewsTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Title like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + "and NewsLblStatus=1"; } else { strCriteria = strCriteria + " NewsLblStatus=1"; } this.Pager1.TableViewName = "NewsTab_Viw2"; } #endregion #endregion -- 取条件并组织 ---------------- strWhere = strCriteria; } if (strCustomType == "3") { Session["strWhere"] = strWhere; Response.Redirect("MachingMessageNews.aspx?type=3"); } return(strWhere); }
private void SearchInfoSelect() { //判断是否为直接搜索 if (Request.QueryString["type"] != null && Session["strWhere"] != null) { this.Pager1.TableViewName = "NewsTab_Viw2"; this.Pager1.StrWhere = Session["strWhere"].ToString(); this.Pager1.DataBind(); } else { DataView dv; DataTable dt; DataTable dt1 = (DataTable)this.ViewState["dt"]; DataRow dr = dt1.Rows[0]; string strCustomType = dr["CustomType"].ToString(); //this.ViewState[ "CustomType" ].ToString(); string strCriteria = ""; //对已经取得的查询条件不在取 if (strCustomType.Trim() != "") { //#endregion-- 取条件并组织 ---------------- #region -- 取条件并组织 ---------------- Tz888.Model.CustomInfoModel CustomInfo = new Tz888.Model.CustomInfoModel(); if (dr["Calling"] != null) { CustomInfo.Calling = dr["Calling"].ToString(); } if (dr["CustomType"] != null) { CustomInfo.CustomType = Convert.ToInt32(dr["CustomType"].ToString()); } if (dr["Genre"] != null) { CustomInfo.Genre = dr["Genre"].ToString(); } if (dr["Keyword"] != null) { CustomInfo.Keyword = dr["Keyword"].ToString(); } if (dr["LoginName"] != null) { CustomInfo.LoginName = dr["LoginName"].ToString(); } if (dr["Money"] != null) { CustomInfo.Money = dr["Money"].ToString(); } if (dr["SmallCalling"] != null) { CustomInfo.SmallCalling = dr["SmallCalling"].ToString(); } if (dr["Type"] != null) { CustomInfo.Type = dr["Type"].ToString(); } if (dr["City"] != null) { CustomInfo.City = dr["City"].ToString(); } //if (dr["currency"] != null) //{ // CustomInfo.currency = dr["currency"].ToString().Trim(); //} if (dr["CooperationDemandTypeID"] != null) { CustomInfo.CooperationDemandTypeID = dr["CooperationDemandTypeID"].ToString(); } else { CustomInfo.CooperationDemandTypeID = ""; } #region 政府招商 //招商 政府招商 if (strCustomType == "0") { if (CustomInfo.Type.Trim() != "") //招商类别 { strCriteria = "MerchantTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling != "") //所属行业 { if (strCriteria != "") { strCriteria = strCriteria + " AND ("; } else { strCriteria = " ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "IndustryClassList like '%" + arrType[i] + "%' OR "; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 4) + ")"; } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%',"; } } } if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Remark like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Remark like '%" + CustomInfo.Keyword + "%'"; } } strCriteria = strCriteria + " and AuditStatus =1"; } #endregion #region 投资 企业项目 else if (strCustomType == "2") { //if (CustomInfo.Genre.Trim() != "") //{ // strCriteria = "CapitalTypeID IN("; // string[] arrType = CustomInfo.Genre.Split('|'); // for (int i = 0; i < arrType.Length; i++) // { // strCriteria = strCriteria + "'" + arrType[i] + "',"; // } // strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; //} if (CustomInfo.Money.Trim() != "")//投资金额 { if (strCriteria != "") { strCriteria = strCriteria + " AND CapitalID IN ("; } else { strCriteria = " CapitalID IN ("; } // strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") //投资行业 { string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND IndustryBID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " or IndustryBID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } //if (CustomInfo.currency != "") //{ // if (strCriteria != "") // { // strCriteria = strCriteria + " AND currency='" + CustomInfo.currency+"'"; // } // else // { // strCriteria = " currency='" + CustomInfo.currency + "'"; // } //} if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } if (CustomInfo.Keyword != "") { //if (strCriteria != "") //{ // strCriteria = strCriteria + " AND Strategy like '%" + CustomInfo.Keyword + "%'"; //} //else //{ // strCriteria = "Strategy like '%" + CustomInfo.Keyword + "%'"; //} } strCriteria = strCriteria + " and AuditStatus =1"; } #endregion #region 融资 资本资源 else if (strCustomType == "1") { if (CustomInfo.Money.Trim() != "") //投资金额 { strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") //投资行业 { string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND IndustryBID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " or IndustryBID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%',"; } } } if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (strCriteria.Trim() != "") { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } else { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProjectAbout like '%" + CustomInfo.Keyword + "%' and AuditStatus =1"; } else { strCriteria = "ProjectAbout like '%" + CustomInfo.Keyword + "%' and AuditStatus =1"; } } } #endregion //创业 资讯 else if (strCustomType == "3") { if (CustomInfo.Type.Trim() != "") //资讯类型 { strCriteria = "NewsTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Title like '%" + CustomInfo.Keyword + "%' AND NewsTab.NewsLblStatus=1"; } else { strCriteria = "Title like '%" + CustomInfo.Keyword + "%' AND NewsLblStatus=1"; } } } #endregion -- 取条件并组织 ---------------- this.ViewState["Criteria"] = strCriteria; } // Label1.Text = this.ViewState["Criteria"].ToString(); try { Tz888.SQLServerDAL.Conn obj = new Tz888.SQLServerDAL.Conn(); if (strCustomType == "0") { this.Pager1.TableViewName = "MerchantInfo_Viw2"; //政府招商 this.Pager1.StrWhere = this.ViewState["Criteria"].ToString(); } else if (strCustomType == "1") { this.Pager1.TableViewName = "CapitalInfo_Viw2"; //资本资源 this.Pager1.StrWhere = this.ViewState["Criteria"].ToString(); } else if (strCustomType == "2") { this.Pager1.TableViewName = "ProjectInfoTab_Viw2"; //企业项目 this.Pager1.StrWhere = this.ViewState["Criteria"].ToString(); } else if (strCustomType == "3") { this.Pager1.TableViewName = "NewsTab_Viw2"; this.Pager1.StrWhere = this.ViewState["Criteria"].ToString(); } else { } this.Pager1.DataBind(); } catch { } } }
private string SearchInfoSelect(int id) { DataTable dt; string TableViewName = ""; string strCriteria = ""; string Criteria = "LoginName = '" + Page.User.Identity.Name.Trim() + "'"; Tz888.SQLServerDAL.Conn obj = new Conn(); DataTable dt1 = obj.GetList("CustomInfoTab", "*", "ID", 1, 1, 0, 1, "ID=" + id); DataRow dr = dt1.Rows[0]; string strCustomType = dr["CustomType"].ToString(); if (strCustomType.Trim() != "") { #region -- 取条件并组织 ---------------- Tz888.Model.CustomInfoModel CustomInfo = new Tz888.Model.CustomInfoModel(); if (dr["Calling"] != null) { CustomInfo.Calling = dr["Calling"].ToString(); } if (dr["CustomType"] != null) { CustomInfo.CustomType = Convert.ToInt32(dr["CustomType"].ToString()); } if (dr["Genre"] != null) { CustomInfo.Genre = dr["Genre"].ToString(); } if (dr["Keyword"] != null) { CustomInfo.Keyword = dr["Keyword"].ToString(); } if (dr["LoginName"] != null) { CustomInfo.LoginName = dr["LoginName"].ToString(); } if (dr["Money"] != null) { CustomInfo.Money = dr["Money"].ToString(); } if (dr["SmallCalling"] != null) { CustomInfo.SmallCalling = dr["SmallCalling"].ToString(); } if (dr["Type"] != null) { CustomInfo.Type = dr["Type"].ToString(); } if (dr["City"] != null) { CustomInfo.City = dr["City"].ToString(); } //if (dr["currency"] != null) //{ // CustomInfo.currency = dr["currency"].ToString().Trim(); //} if (dr["CooperationDemandTypeID"] != null) { CustomInfo.CooperationDemandTypeID = dr["CooperationDemandTypeID"].ToString(); } else { CustomInfo.CooperationDemandTypeID = ""; } #region 政府招商 //招商 政府招商 if (strCustomType == "0") { if (CustomInfo.Type.Trim() != "") //招商类别 { strCriteria = "MerchantTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling != "") //所属行业 { if (strCriteria != "") { strCriteria = strCriteria + " AND ("; } else { strCriteria = " ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "IndustryClassList like '%" + arrType[i] + "%' OR "; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 4) + ")"; } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%',"; } } } //if (CustomInfo.currency.Trim() != "") //{ // if (strCriteria != "") // { // strCriteria = strCriteria + " AND CapitalCurrency='" + CustomInfo.currency+"'"; // } // else // { // strCriteria = " CapitalCurrency ='" + CustomInfo.currency + "'"; // } //} if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND KeyWord like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "KeyWord like '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + " and AuditStatus =1"; } else { strCriteria = strCriteria + " AuditStatus =1"; } } #endregion #region 投资 企业项目 else if (strCustomType == "2") { //if (CustomInfo.Genre.Trim() != "") //{ // strCriteria = "CapitalTypeID IN("; // string[] arrType = CustomInfo.Genre.Split('|'); // for (int i = 0; i < arrType.Length; i++) // { // strCriteria = strCriteria + "'" + arrType[i] + "',"; // } // strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; //} if (CustomInfo.Money.Trim() != "")//投资金额 { if (strCriteria != "") { strCriteria = strCriteria + " AND CapitalID IN ("; } else { strCriteria = " CapitalID IN ("; } // strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") //投资行业 { string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND IndustryBID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " or IndustryBID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } //if (CustomInfo.currency != "") //{ // if (strCriteria != "") // { // strCriteria = strCriteria + " AND currency='" + CustomInfo.currency+"'"; // } // else // { // strCriteria = " currency='" + CustomInfo.currency + "'"; // } //} if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND KeyWord like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = " title KeyWord '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + " and AuditStatus =1"; } else { strCriteria = strCriteria + " AuditStatus =1"; } } #endregion #region 融资 资本资源 else if (strCustomType == "1") { if (CustomInfo.Money.Trim() != "") //投资金额 { strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") //投资行业 { string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND IndustryBID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " or IndustryBID like '%" + arrType[i].Trim() + "%'"; } } } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.City != "") //投资区域 { string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND ProvinceID like '%" + arrType[i].Trim() + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or ProvinceID like '%" + arrType[i].Trim() + "%',"; } } } if (CustomInfo.CooperationDemandTypeID != "") //合作方式 { string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (strCriteria.Trim() != "") { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " AND CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } else { if (arrType[i].Trim() != "" && i == 0) { strCriteria = strCriteria + " CooperationDemandType like '%" + arrType[i] + "%'"; } else if (arrType[i].Trim() != "" && i != 0) { strCriteria = strCriteria + " or CooperationDemandType like '%" + arrType[i] + "%'"; } } } } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND KeyWord like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = " KeyWord like '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + " and AuditStatus =1"; } else { strCriteria = strCriteria + " AuditStatus =1"; } } #endregion //创业 资讯 #region 资讯 else if (strCustomType == "3") { if (CustomInfo.Type.Trim() != "") //资讯类型 { strCriteria = "NewsTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Title like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; } } if (strCriteria.Trim() != "") { strCriteria = strCriteria + "and NewsLblStatus=1"; } else { strCriteria = strCriteria + " NewsLblStatus=1"; } } #endregion #endregion -- 取条件并组织 ---------------- this.ViewState["Criteria"] = strCriteria; } try { if (strCustomType == "0") { TableViewName = "MerchantInfo_Viw2"; //政府招商 } else if (strCustomType == "1") { TableViewName = "CapitalInfo_Viw2"; //资本资源 } else if (strCustomType == "2") { TableViewName = "ProjectInfoTab_Viw2"; //企业项目 } else if (strCustomType == "3") { TableViewName = "NewsTab_Viw2"; } else { return(""); } Tz888.SQLServerDAL.Conn objCount = new Tz888.SQLServerDAL.Conn(); return(Convert.ToInt32(objCount.GetList(TableViewName, "LoginTime", "InfoID", 1, 1, 1, 1, this.ViewState["Criteria"].ToString()).Rows[0][0]).ToString()); } catch { return("0"); } }
/// <summary> /// /// </summary> /// <param name="dr"></param> /// <returns></returns> private string SetDingYueCondition(DataRow dr) { string strCustomType = dr["CustomType"].ToString(); //this.ViewState[ "CustomType" ].ToString(); //对已经取得的查询条件不再取 string strCriteria = ""; if (strCustomType.Trim() != "") { Tz888.Model.CustomInfoModel CustomInfo = new Tz888.Model.CustomInfoModel(); if (dr["Calling"] != null) { CustomInfo.Calling = dr["Calling"].ToString(); } if (dr["CustomType"] != null) { CustomInfo.CustomType = Convert.ToInt32(dr["CustomType"].ToString()); } if (dr["Genre"] != null) { CustomInfo.Genre = dr["Genre"].ToString(); } if (dr["Keyword"] != null) { CustomInfo.Keyword = dr["Keyword"].ToString(); } if (dr["LoginName"] != null) { CustomInfo.LoginName = dr["LoginName"].ToString(); } if (dr["Money"] != null) { CustomInfo.Money = dr["Money"].ToString(); } if (dr["SmallCalling"] != null) { CustomInfo.SmallCalling = dr["SmallCalling"].ToString(); } if (dr["Type"] != null) { CustomInfo.Type = dr["Type"].ToString(); } if (dr["City"] != null) { CustomInfo.City = dr["City"].ToString(); } if (dr["CooperationDemandTypeID"] != null) { CustomInfo.CooperationDemandTypeID = dr["CooperationDemandTypeID"].ToString(); } else { CustomInfo.CooperationDemandTypeID = ""; } //招商 if (strCustomType == "0") { if (CustomInfo.Type.Trim() != "") { strCriteria = "MerchantTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ("; } else { strCriteria = " ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "IndustryClassList like '%" + arrType[i] + "%' OR "; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 4) + ")"; } if (CustomInfo.City != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProvinceID IN ("; } else { strCriteria = " ProvinceID IN ("; } string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.CooperationDemandTypeID != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND CooperationDemandType IN ("; } else { strCriteria = " CooperationDemandType IN ("; } string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Keyword like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Keyword like '%" + CustomInfo.Keyword + "%'"; } } } //投资 else if (strCustomType == "1") { if (CustomInfo.Genre.Trim() != "") { strCriteria = "CapitalTypeID IN("; string[] arrType = CustomInfo.Genre.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Money.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND CapitalID IN ("; } else { strCriteria = " CapitalID IN ("; } strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryBID IN ("; } else { strCriteria = " IndustryBID IN ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.CooperationDemandTypeID != "") { } if (CustomInfo.Keyword != "") { } } //融资 else if (strCustomType == "2") { if (CustomInfo.Money.Trim() != "") { strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryBID IN ("; } else { strCriteria = " IndustryBID IN ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryMID IN ("; } else { strCriteria = " IndustryMID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.City != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProvinceID IN ("; } else { strCriteria = " ProvinceID IN ("; } string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.CooperationDemandTypeID != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND CooperationDemandType IN ("; } else { strCriteria = " CooperationDemandType IN ("; } string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { if (arrType[i].Trim() != "") { strCriteria = strCriteria + "'" + arrType[i] + "',"; } } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProjectAbout like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "ProjectAbout like '%" + CustomInfo.Keyword + "%'"; } } } //创业 else if (strCustomType == "3") { if (CustomInfo.Money.Trim() != "") { strCriteria = "CapitalID IN("; string[] arrType = CustomInfo.Money.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryCarveOutID IN ("; } else { strCriteria = " IndustryCarveOutID IN ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryCarveOutID IN ("; } else { strCriteria = " IndustryCarveOutID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.City != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProvinceID IN ("; } else { strCriteria = " ProvinceID IN ("; } string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.CooperationDemandTypeID != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND CooperationDemandType IN ("; } else { strCriteria = " CooperationDemandType IN ("; } string[] arrType = CustomInfo.CooperationDemandTypeID.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Title like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; } } } //商机 else if (strCustomType == "4") { if (CustomInfo.Type.Trim() != "") { strCriteria = "OpportunityType IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Calling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryOpportunityID IN ("; } else { strCriteria = " IndustryOpportunityID IN ("; } string[] arrType = CustomInfo.Calling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.SmallCalling.Trim() != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND IndustryOpportunityID IN ("; } else { strCriteria = " IndustryOpportunityID IN ("; } string[] arrType = CustomInfo.SmallCalling.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.City != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND ProvinceID IN ("; } else { strCriteria = " ProvinceID IN ("; } string[] arrType = CustomInfo.City.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Title like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; } } } //资讯 else if (strCustomType == "5") { if (CustomInfo.Type.Trim() != "") { strCriteria = "NewsTypeID IN("; string[] arrType = CustomInfo.Type.Split('|'); for (int i = 0; i < arrType.Length; i++) { strCriteria = strCriteria + "'" + arrType[i] + "',"; } strCriteria = strCriteria.Substring(0, strCriteria.Length - 1) + ")"; } if (CustomInfo.Keyword != "") { if (strCriteria != "") { strCriteria = strCriteria + " AND Title like '%" + CustomInfo.Keyword + "%'"; } else { strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; } } strCriteria = "Title like '%" + CustomInfo.Keyword + "%'"; } } return(strCriteria); }
private void MackUpdateTable() { #region 变量定义 string strCustomType = this.Hidden1.Value.ToString(); //if (this.ViewState["CustomType"] != null) //{ // strCustomType = this.ViewState["CustomType"].ToString(); //} string strTitle = ""; if (this.ViewState["Title"] != null) { strTitle = this.ViewState["Title"].ToString(); } string strType = ""; string strGenre = ""; string strMoney = ""; string strCalling = ""; string strCallingTxt = ""; string strSmallCalling = ""; string strSmallCallingTxt = ""; string strCity = ""; string strCityTxt = ""; string strKeyword = this.txtKey.Text.Trim(); int iValidateTerm = Convert.ToInt32(ddlValidateTerm.SelectedValue.ToString()); string strCurrency = ""; string strCooperationDemandTypeID = ""; //合作类型 int bAccept = 1; //int.Parse(this.ViewState["Accept"].ToString()); int iCustomCyc = Convert.ToInt32(this.ViewState["CustomCyc"]); int iItemCount = Convert.ToInt32(this.ViewState["ItemCount"]); string strEmail = ""; if (this.ViewState["Email"] != null) { strEmail = this.ViewState["Email"].ToString(); } string strStageForenterpriseDevelop = ""; //企业投资阶段 string strfinancingObject = ""; //融资对象 string strtrade = ""; #endregion #region 变量赋值 #region 政府招商 if (strCustomType == "0") //政府招商 { //投资行业 strCalling = hidZfCalling.Value.Trim(); strCallingTxt = hidZfCallingTxt.Value; //投资区域 strCity = hidZfCity.Value.Trim(); strCityTxt = hidZfCityTxt.Value.Trim(); } #endregion #region 资本资源 else if (strCustomType == "1") { //投资方式 for (int i = 0; i < this.chTzfsZb.Items.Count; i++) { if (this.chTzfsZb.Items[i].Selected) { strCooperationDemandTypeID = strCooperationDemandTypeID + this.chTzfsZb.Items[i].Value.Trim() + "|"; } } //单项目可投资金额 for (int i = 0; i < this.chkCapital.Items.Count; i++) { if (this.chkCapital.Items.Count == 0) { strMoney = "0";//默认为不限资金 } if (this.chkCapital.Items[i].Selected) { strMoney = strMoney + this.chkCapital.Items[i].Value.Trim() + "|"; } } if (strMoney.Trim() != "") { strMoney = strMoney.Substring(0, strMoney.Length - 1); } //投资行业 strCalling = hidZyCalling.Value.Trim(); strCallingTxt = hidZyCallingTxt.Value; //投资区域 strCity = hidZyCity.Value.Trim(); strCityTxt = hidZyCityTxt.Value.Trim(); } #endregion #region 企业项目 else if (strCustomType == "2") { //融资类型 for (int i = 0; i < ckRzlxQy.Items.Count; i++) { if (ckRzlxQy.Items[i].Selected) { strType = strType + ckRzlxQy.Items[i].Value + "|"; } } if (strType.Trim() != "") { strType = strType.Substring(0, strType.Length - 1); } //投资行业 strCalling = hidQyCalling.Value.Trim(); strCallingTxt = hidQyCallingTxt.Value; //投资区域 strCity = hidQyCity.Value.Trim(); strCityTxt = hidQyCityTxt.Value.Trim(); //借款金额 for (int i = 0; i < this.ckJkjeQy.Items.Count; i++) { if (this.ckJkjeQy.Items.Count == 0) { strMoney = "0";//默认为不限资金 } if (this.ckJkjeQy.Items[i].Selected) { strMoney = strMoney + this.ckJkjeQy.Items[i].Value.Trim() + "|"; } } if (strMoney.Trim() != "") { strMoney = strMoney.Substring(0, strMoney.Length - 1); } } #endregion #endregion #region 将信添加至session #region 将信添加至model 并存至 session Tz888.Model.CustomInfoModel CustomInfo = new Tz888.Model.CustomInfoModel(); //CustomInfo.ID = int.Parse(ID); CustomInfo.LoginName = "topfo001"; //公共属性 //strGenre = ""; //strCalling = ""; //strCallingTxt = ""; //strSmallCalling = ""; //strSmallCallingTxt = ""; strKeyword = this.txtKey.Text.Trim(); iValidateTerm = Convert.ToInt32(ddlValidateTerm.SelectedValue.ToString());//有效时间 strCurrency = ""; bAccept = 1; iCustomCyc = 2; iItemCount = 10; strEmail = ""; ////strCurrency = ddlCapitalCurrency.SelectedValue.ToString(); CustomInfo.Accept = true; CustomInfo.Email = strEmail; CustomInfo.CustomCyc = Convert.ToInt32(this.ViewState["CustomCyc"]);//Convert.ToInt32(strCustomCyc); CustomInfo.CustomType = Convert.ToInt32(strCustomType); CustomInfo.Type = strType; //类型 CustomInfo.Genre = strGenre; CustomInfo.Money = strMoney; CustomInfo.Calling = strCalling; CustomInfo.SmallCalling = strSmallCalling; CustomInfo.City = strCity; CustomInfo.CallingTxt = strCallingTxt; CustomInfo.SmallCallingTxt = strSmallCallingTxt; CustomInfo.CityTxt = strCityTxt; CustomInfo.Keyword = strKeyword; CustomInfo.currency = strCurrency; CustomInfo.CooperationDemandTypeID = strCooperationDemandTypeID; //合作方式 CustomInfo.Title = strTitle; //新增字段 CustomInfo.StageForenterpriseDevelop = strStageForenterpriseDevelop; CustomInfo.Trade = strtrade; CustomInfo.FinancingObject = strfinancingObject; string na = ViewState["ID"].ToString(); if (Convert.ToString(ViewState["ID"]) != "") { CustomInfo.ID = int.Parse(this.ViewState["ID"].ToString()); } Session["customInfo"] = CustomInfo; Session["title"] = strTitle; #endregion //Session["CustomInfo"] = ds; #endregion }
private void MackAddTable() { #region 变量定义 string strCustomType = this.Hidden1.Value.ToString();// this.ViewState["CustomType"].ToString(); string strCustomTypeName = "政府招商"; switch (strCustomType) { case "0": strCustomTypeName = "政府招商"; break; case "1": strCustomTypeName = "资本项目"; break; case "2": strCustomTypeName = "企业项目"; break; case "3": strCustomTypeName = "资讯信息"; break; default: strCustomTypeName = "资本项目"; break; } /*2010-06-17修改*/ Tz888.BLL.CustomInfoBLL BLL = new Tz888.BLL.CustomInfoBLL(); Tz888.Model.CustomInfoModel customInfo = new Tz888.Model.CustomInfoModel(); //customInfo.Accept 是否接收邮件默认为1 string strTitle = strCustomTypeName + System.DateTime.Now.ToString(); this.ViewState["title"] = strTitle; string strType = ""; string strGenre = ""; string strMoney = "0"; string strCalling = ""; string strCallingTxt = ""; string strSmallCalling = ""; string strSmallCallingTxt = ""; string strCity = ""; string strCityTxt = ""; string strKeyword = ""; int iValidateTerm = 0; //有效时间 string strCurrency = ""; string strCooperationDemandTypeID = ""; //合作类型 byte bAccept = 1; int iCustomCyc = 2; int iItemCount = 10; string strEmail = ""; //投资阶段 string strStageForenterpriseDevelop = ""; //融资对象 string strfinancingObject = ""; string strtrade = ""; //投资行业 #endregion #region 变量赋值 #region 政府招商 if (strCustomType == "0") //政府招商 { //投资行业 strCalling = hidZfCalling.Value.Trim(); strCallingTxt = hidZfCallingTxt.Value; //投资区域 strCity = hidZfCity.Value.Trim(); strCityTxt = hidZfCityTxt.Value.Trim(); } #endregion #region 资本资源 else if (strCustomType == "1") { //单项目可投资金额 for (int i = 0; i < this.chkCapital.Items.Count; i++) { if (this.chkCapital.Items.Count == 0) { strMoney = "0";//默认为不限资金 } if (this.chkCapital.Items[i].Selected) { strMoney = strMoney + this.chkCapital.Items[i].Value.Trim() + "|"; } } if (strMoney.Trim() != "") { strMoney = strMoney.Substring(0, strMoney.Length - 1); } //投资行业 strCalling = hidZyCalling.Value.Trim(); strCallingTxt = hidZyCallingTxt.Value; //投资区域 strCity = hidZyCity.Value.Trim(); strCityTxt = hidZyCityTxt.Value.Trim(); } #endregion #region 企业项目 else if (strCustomType == "2") { //融资类型 for (int i = 0; i < ckRzlxQy.Items.Count; i++) { if (ckRzlxQy.Items[i].Selected) { strType = strType + ckRzlxQy.Items[i].Value + "|"; } } if (strType.Trim() != "") { strType = strType.Substring(0, strType.Length - 1); } //投资行业 strCalling = hidQyCalling.Value.Trim(); strCallingTxt = hidQyCallingTxt.Value; //投资区域 strCity = hidQyCity.Value.Trim(); strCityTxt = hidQyCityTxt.Value.Trim(); //借款金额 for (int i = 0; i < this.ckJkjeQy.Items.Count; i++) { //if (this.ckJkjeQy.Items.Count == 0) //{ // strMoney = "0";//默认为不限资金 //} if (this.ckJkjeQy.Items[i].Selected) { strMoney = strMoney + this.ckJkjeQy.Items[i].Value.Trim() + "|"; } } if (strMoney.Trim() != "") { strMoney = strMoney.Substring(0, strType.Length - 1); } } #endregion #region 将信添加至model 并存至 session Tz888.Model.CustomInfoModel CustomInfo = new Tz888.Model.CustomInfoModel(); //CustomInfo.ID = int.Parse(ID); //公共属性 //strGenre = ""; //strCalling = ""; //strCallingTxt = ""; //strSmallCalling = ""; //strSmallCallingTxt = ""; strKeyword = this.txtKey.Text.Trim(); iValidateTerm = Convert.ToInt32(ddlValidateTerm.SelectedValue.ToString());//有效时间g strCurrency = ""; bAccept = 1; iCustomCyc = 2; iItemCount = 10; strEmail = ""; ////strCurrency = ddlCapitalCurrency.SelectedValue.ToString(); CustomInfo.Accept = true; CustomInfo.Email = strEmail; CustomInfo.CustomCyc = Convert.ToInt32(this.ViewState["CustomCyc"]);//Convert.ToInt32(strCustomCyc); CustomInfo.LoginName = "topfo001"; CustomInfo.CustomType = Convert.ToInt32(strCustomType); CustomInfo.Type = strType; //类型 CustomInfo.Genre = strGenre; CustomInfo.Money = strMoney; CustomInfo.Calling = strCalling; CustomInfo.SmallCalling = strSmallCalling; CustomInfo.City = strCity; CustomInfo.CallingTxt = strCallingTxt; CustomInfo.SmallCallingTxt = strSmallCallingTxt; CustomInfo.CityTxt = strCityTxt; CustomInfo.Keyword = strKeyword; CustomInfo.currency = strCurrency; CustomInfo.CooperationDemandTypeID = strCooperationDemandTypeID; //合作方式 CustomInfo.Title = strTitle; Session["title"] = strTitle; //新增字段 CustomInfo.StageForenterpriseDevelop = strStageForenterpriseDevelop; CustomInfo.Trade = strtrade; CustomInfo.FinancingObject = strfinancingObject; Session["customInfo"] = CustomInfo; #endregion //添加数据至 信息定制表 }