using System.Collections.Generic; using System.Data.Entity.Validation; using System.Linq; using System.Web; using Warehouse.Models.mesModel; using Z.EntityFramework.Plus; using System; using System.Data; namespace Warehouse.DAL.WOFinsihStatus { public class WOFinsihStatus { public List QueryInfo(string wo, string sales, string customer, string bt, string et) { using (var context = new mesModel()) { string sql = @"exec mes_main.dbo.prWOFinishStatus "; sql += string.IsNullOrEmpty(wo) ? " @wo=N''" : " @wo =N'" + wo + "'"; sql += string.IsNullOrEmpty(sales) ? " ,@sales=N''" : " ,@sales=N'" + sales + "'"; sql += string.IsNullOrEmpty(customer) ? " ,@customer=N''" : " ,@customer=N'" + customer + "'"; if (!string.IsNullOrEmpty(bt) && !string.IsNullOrEmpty(et)) { sql += " ,@bt=N'" + bt + "',@et=N'" + et + "'"; } else { sql += " ,@bt=N'',@et=N''"; } var res = context.DynamicListFromSql(sql, null); return res.ToList(); } } } }