public static EntityData GetV_SupplierMaterialByCode(string code) { EntityData data2; try { SupplierMaterialStrategyBuilder builder = new SupplierMaterialStrategyBuilder(); builder.AddStrategy(new Strategy(SupplierMaterialStrategyName.SupplierMaterialCode, code)); string queryString = builder.BuildQueryViewString(); QueryAgent agent = new QueryAgent(); EntityData data = agent.FillEntityData("SupplierMaterial", queryString); agent.Dispose(); data2 = data; } catch (Exception exception) { throw exception; } return(data2); }
private void BuildSearchString() { string IsEmpty = Request["IsEmpty"] + ""; string MaterialTypeCode = Request["MaterialTypeCode"] + ""; string Unit = Request["Unit"] + ""; string Price0 = Request["Price0"] + ""; string Price1 = Request["Price1"] + ""; string SupplierCode = Request["SupplierCode"] + ""; string SupplierName = Request["SupplierName"] + ""; string Brand = Request["Brand"] + ""; string Model = Request["Model"] + ""; string Spec = Request["Spec"] + ""; string Nation = Request["Nation"] + ""; string AreaCode = Request["AreaCode"] + ""; string SampleID = Request["SampleID"] + ""; string chkSearch = Request["ChkSearch"] + ""; string RootGroupCode = this.txtRootGroupCode.Value; SupplierMaterialStrategyBuilder sb = new SupplierMaterialStrategyBuilder(); if (IsEmpty == "1") { sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.False)); } if (Unit != "") { sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.Unit, "%" + Unit + "%")); } if (Price0.Trim() != "" || Price1.Trim() != "") { ArrayList ar = new ArrayList(); ar.Add(Price0.Trim()); ar.Add(Price1.Trim()); sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.PriceRange, ar)); } if (SupplierCode != "") { sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.SupplierCode, SupplierCode)); } if (SupplierName != "") { sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.SupplierName, "%" + SupplierName + "%")); } if (Brand != "") { sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.Brand, "%" + Brand + "%")); } if (Model != "") { sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.Model, "%" + Model + "%")); } if (Spec != "") { sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.Spec, "%" + Spec + "%")); } if (Nation != "") { sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.Nation, "%" + Nation + "%")); } if (AreaCode != "") { sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.AreaCode, "%" + AreaCode + "%")); } if (SampleID != "") { sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.SampleID, "%" + SampleID + "%")); } if (chkSearch == "1" && (MaterialTypeCode != "")) { ArrayList arS = new ArrayList(); arS.Add(MaterialTypeCode); arS.Add("0"); sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.GroupCodeEx, arS)); } //只显示某个枝条 if (RootGroupCode != "") { ArrayList arS = new ArrayList(); arS.Add(RootGroupCode); arS.Add("0"); sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.GroupCodeEx, arS)); } ArrayList arA = new ArrayList(); arA.Add(user.UserCode); arA.Add(user.BuildStationCodes()); sb.AddStrategy(new Strategy(SupplierMaterialStrategyName.AccessRange, arA)); // sb.AddStrategy( new Strategy( SupplierMaterialStrategyName.SubjectSetCode,subjectSetCode )); //排序 string sortsql = BLL.GridSort.GetSortSQL(ViewState); string sql = sb.BuildQueryViewString(); if (sortsql != "") { //点列标题排序 sql = sql + " order by " + sortsql; } this.ViewState.Add("SqlString", sql); }