|
@@ -5,9 +5,8 @@ using System.Data;
|
|
|
|
|
|
namespace MySystem
|
|
|
{
|
|
|
- public class UserTradeDbconn
|
|
|
+ public class UserTradeDbconn
|
|
|
{
|
|
|
- static string _conn = ConfigurationManager.AppSettings["StatSqlConnStr"].ToString();
|
|
|
public readonly static UserTradeDbconn Instance = new UserTradeDbconn();
|
|
|
public UserTradeDbconn()
|
|
|
{ }
|
|
@@ -19,7 +18,7 @@ namespace MySystem
|
|
|
/// <param name="TradeDate">日期/月份(yyyyMMdd或yyyyMM)</param>
|
|
|
/// <param name="fields">字段(多个用逗号隔开)</param>
|
|
|
/// <returns></returns>
|
|
|
- public static Dictionary<string, object> GetTrade(int MerchantId, string TradeDate, string fields)
|
|
|
+ public Dictionary<string, object> GetTrade(int MerchantId, string TradeDate, string fields)
|
|
|
{
|
|
|
Dictionary<string, object> AmtList = new Dictionary<string, object>();
|
|
|
string fieldList = "";
|
|
@@ -27,7 +26,7 @@ namespace MySystem
|
|
|
{
|
|
|
fieldList += "sum(" + fieldList + ") " + fieldList + ",";
|
|
|
}
|
|
|
- DataTable dt = CustomerSqlConn.dtable("select " + fieldList.TrimEnd(',') + " from MerchantTradeSummary" + TradeDate + " where MerchantId=" + MerchantId + " and ", _conn);
|
|
|
+ DataTable dt = CustomerSqlConn.dtable("select " + fieldList.TrimEnd(',') + " from MerchantTradeSummary" + TradeDate + " where MerchantId=" + MerchantId + " and ", AppConfig.Base.StatConnRds);
|
|
|
if(dt.Rows.Count > 0)
|
|
|
{
|
|
|
foreach(string field in fields.Split(','))
|
|
@@ -45,10 +44,10 @@ namespace MySystem
|
|
|
/// <param name="TradeMonth">月份(yyyyMM)</param>
|
|
|
/// <param name="fields">字段(多个用逗号隔开)</param>
|
|
|
/// <returns></returns>
|
|
|
- public static List<Dictionary<string, object>> GetDateTradeList(int MerchantId, string TradeMonth, string fields)
|
|
|
+ public List<Dictionary<string, object>> GetDateTradeList(int MerchantId, string TradeMonth, string fields)
|
|
|
{
|
|
|
List<Dictionary<string, object>> AmtList = new List<Dictionary<string, object>>();
|
|
|
- DataTable dt = CustomerSqlConn.dtable("select " + fields + " from MerchantTradeSummary" + TradeMonth + " where MerchantId=" + MerchantId + " and ", _conn);
|
|
|
+ DataTable dt = CustomerSqlConn.dtable("select " + fields + " from MerchantTradeSummary" + TradeMonth + " where MerchantId=" + MerchantId + " and ", AppConfig.Base.StatConnRds);
|
|
|
if(dt.Rows.Count > 0)
|
|
|
{
|
|
|
Dictionary<string, object> Item = new Dictionary<string, object>();
|
|
@@ -68,7 +67,7 @@ namespace MySystem
|
|
|
/// <param name="TradeMonth">月份(yyyyMM)</param>
|
|
|
/// <param name="fields">字段(多个用逗号隔开)</param>
|
|
|
/// <returns></returns>
|
|
|
- public static List<Dictionary<string, object>> GetMonthTradeList(int MerchantId, string fields)
|
|
|
+ public List<Dictionary<string, object>> GetMonthTradeList(int MerchantId, string fields)
|
|
|
{
|
|
|
List<Dictionary<string, object>> AmtList = new List<Dictionary<string, object>>();
|
|
|
string fieldList = "";
|
|
@@ -79,7 +78,8 @@ namespace MySystem
|
|
|
for(int i = 0; i < 6; i ++)
|
|
|
{
|
|
|
Dictionary<string, object> Item = new Dictionary<string, object>();
|
|
|
- DataTable dt = CustomerSqlConn.dtable("select " + fieldList.TrimEnd(',') + " from MerchantTradeSummary" + DateTime.Now.AddMonths(-i).ToString("yyyyMM") + " where MerchantId=" + MerchantId + " and ", _conn);
|
|
|
+ Item.Add("TradeDate", DateTime.Now.AddMonths(-i).ToString("yyyy-MM"));
|
|
|
+ DataTable dt = CustomerSqlConn.dtable("select " + fieldList.TrimEnd(',') + " from MerchantTradeSummary" + DateTime.Now.AddMonths(-i).ToString("yyyyMM") + " where MerchantId=" + MerchantId + " and ", AppConfig.Base.StatConnRds);
|
|
|
if(dt.Rows.Count > 0)
|
|
|
{
|
|
|
foreach(string field in fields.Split(','))
|