|
@@ -4,6 +4,7 @@ using System.Linq;
|
|
|
using MySystem.MainModels;
|
|
|
using Library;
|
|
|
using LitJson;
|
|
|
+using System.Data;
|
|
|
|
|
|
namespace MySystem
|
|
|
{
|
|
@@ -42,6 +43,26 @@ namespace MySystem
|
|
|
db.Dispose();
|
|
|
return editData;
|
|
|
}
|
|
|
+ public Dictionary<string, string> Sum(string field, string condition)
|
|
|
+ {
|
|
|
+ Dictionary<string, string> result = new Dictionary<string, string>();
|
|
|
+ string sumString = "";
|
|
|
+ string[] fieldlist = field.Split(',');
|
|
|
+ foreach(string f in fieldlist)
|
|
|
+ {
|
|
|
+ sumString += "sum(" + f + ") " + f + ",";
|
|
|
+ }
|
|
|
+ sumString = sumString.TrimEnd(',');
|
|
|
+ DataTable dt = CustomerSqlConn.dtable("select " + sumString + " from ConsumerProfit where 1=1" + condition, _conn);
|
|
|
+ if(dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ foreach(string f in fieldlist)
|
|
|
+ {
|
|
|
+ result.Add(f, function.CheckNum(dt.Rows[0][f].ToString()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加数据
|