public IList <SupplierConfigInfo> GetSupplierCfgByType(ClientType client, SupplierCfgType cfgType) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("select * from Ecshop_SupplierConfig where type=@type AND Client=@Client ORDER BY DisplaySequence ASC"); this.database.AddInParameter(sqlStringCommand, "type", DbType.Int32, (int)cfgType); this.database.AddInParameter(sqlStringCommand, "Client", DbType.Int32, (int)client); IList <SupplierConfigInfo> result; using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { result = ReaderConvert.ReaderToList <SupplierConfigInfo>(dataReader); } return(result); }
public DataTable GetConfigSupplier(ClientType client, SupplierCfgType cfgType, int userid) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("select A.ImageUrl,B.*,"); stringBuilder.Append("(select count(C1.Id) from Ecshop_SupplierCollect C1 where C1.SupplierId=A.SupplierId) as CollectCount,"); stringBuilder.AppendFormat("case when (select count(C2.SupplierId) from Ecshop_SupplierCollect C2 where C2.SupplierId=A.SupplierId and C2.Userid={0})>0 then 1 else 0 end as IsCollect", userid); stringBuilder.Append(" from Ecshop_SupplierConfig A "); stringBuilder.Append(" inner join Ecshop_Supplier B on A.SupplierId=B.SupplierId "); stringBuilder.AppendFormat(" where A.Client={0} ", (int)client); if ((int)cfgType > 0) { stringBuilder.AppendFormat(" and A.Type={0} ", (int)cfgType); } stringBuilder.Append(" order by A.DisplaySequence "); DbCommand sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString()); return(this.database.ExecuteDataSet(sqlStringCommand).Tables[0]); }
/// <summary> /// 获取配置的商家 /// </summary> /// <param name="client">枚举:客户端</param> /// <param name="cfgType">枚举:配置类型</param> /// <param name="userid"></param> /// <returns></returns> public static DataTable GetConfigSupplier(ClientType client, SupplierCfgType cfgType, int userid) { return(new SupplierConfigDao().GetConfigSupplier(client, cfgType, userid)); }
/// <summary> /// 根据类型获取商家配置列表 /// </summary> /// <param name="client"></param> /// <param name="cfgType"></param> /// <returns></returns> public static IList <SupplierConfigInfo> GetSupplierCfgByType(ClientType client, SupplierCfgType cfgType) { return(new SupplierConfigDao().GetSupplierCfgByType(client, cfgType)); }