2019/01/08
Posted hexx
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2019/01/08相关的知识,希望对你有一定的参考价值。
1. 查询条件
/// <summary> /// 查询条件 /// </summary> /// <returns></returns> private List<ConditionHelper.SqlqueryCondition> InquiryCondition() { var wheres = new List<ConditionHelper.SqlqueryCondition>(); string branchname = hidBranchCode.Text; wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Branch, Comparison.Equals, branchname)); if (!string.IsNullOrEmpty(txtEnterpriseName.Text.Trim())) { wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Enterprisename, Comparison.Like, "%" + StringHelper.FilterSql(txtEnterpriseName.Text) + "%")); } if (!string.IsNullOrEmpty(ddlIndustryCode1.SelectedValue) && ddlIndustryCode1.SelectedValue != "-1") { var indusM1 = Basics_industry.SingleOrDefault(x => x.Classcode1 == ddlIndustryCode1.SelectedValue && x.Classgrade == 1); wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Industrycode1, Comparison.Equals, indusM1.Id)); } if (!string.IsNullOrEmpty(ddlIndustryCode2.SelectedValue) && ddlIndustryCode2.SelectedValue != "-1") { var indusM2 = Basics_industry.SingleOrDefault(x => x.Classcode2 == ddlIndustryCode2.SelectedValue); wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Industrycode2, Comparison.Equals, indusM2.Id)); } if (!string.IsNullOrEmpty(ddlIndustryCode3.SelectedValue) && ddlIndustryCode3.SelectedValue != "-1") { var indusM3 = Basics_industry.SingleOrDefault(x => x.Classcode3 == ddlIndustryCode3.SelectedValue); wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Industrycode3, Comparison.Equals, indusM3.Id)); } if (!string.IsNullOrEmpty(ddlIndustryCode4.SelectedValue) && ddlIndustryCode4.SelectedValue != "-1") { var indusM4 = Basics_industry.SingleOrDefault(x => x.Classcode4 == ddlIndustryCode4.SelectedValue); wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Industrycode4, Comparison.Equals, indusM4.Id)); } //省 if (!string.IsNullOrEmpty(ddlProvince.SelectedText.Trim()) && ddlProvince.SelectedText.Trim() != "选择省") { wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Provinceid, Comparison.Equals, StringHelper.FilterSql(ddlProvince.SelectedValue.Trim()))); } //市 if (!string.IsNullOrEmpty(ddlCity.SelectedText.Trim()) && ddlCity.SelectedText.Trim() != "选择市") { wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Cityid, Comparison.Equals, StringHelper.FilterSql(ddlCity.SelectedValue.Trim()))); } //县 if (!string.IsNullOrEmpty(ddlCounty.SelectedText.Trim()) && ddlCounty.SelectedText.Trim() != "选择区县") { wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Countyid, Comparison.Equals, StringHelper.FilterSql(ddlCounty.SelectedValue.Trim()))); } ///审核状态 //if (!string.IsNullOrEmpty(ddlAuditStatus.SelectedValue)) //{ // wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Auditstatus, // Comparison.Equals, StringHelper.FilterSql(ddlAuditStatus.SelectedValue))); //} wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Iszjaj, Comparison.NotEquals, StringHelper.FilterSql("2"))); //wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, V_b_u_chemicalenterpriseTable.Iszjaj, // Comparison.Equals, StringHelper.FilterSql("1"))); return wheres; }
以上是关于2019/01/08的主要内容,如果未能解决你的问题,请参考以下文章