ComplianceServer/oldcode/Core.BLL/Wx/Wx_SzzyOrderModuleRefund_BL.cs

40 lines
1.4 KiB
C#

using CRM.Core.DAL;
using CRM.Core.Model;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
namespace CRM.Core.BLL.Wx
{
public class Wx_SzzyOrderModuleRefund_BL : AuditContextRepository<Model.EntityAudit.Wx_SzzyOrderModuleRefund>
{
public List<RefundDto> GetRefund(DateTime ftime)
{
var sql = @"
select CONVERT(DATE_FORMAT(f.refunddate,'%Y%m'), SIGNED INTEGER) fmonth,sum(f.refundprice) refundprice
from wx_szzyordermodulerefund f
where f.refunddate < @arg_ftime
group by DATE_FORMAT(f.refunddate,'%Y%m')";
var param = new List<MySqlParameter> {
new MySqlParameter { ParameterName = "arg_ftime", DbType = DbType.DateTime, Value = ftime }
};
var ds = MySqlDbHelper.DataQueray(ConStringHelper.AuditConn, System.Data.CommandType.Text, sql, param.ToArray());
//return ds.Tables[0].ToList<ModulePriceDto>();
var list = new List<RefundDto>();
foreach (DataRow row in ds.Tables[0].Rows)
{
list.Add(new RefundDto() { fMonth = Convert.ToInt32(row[0]), refundPrice = Convert.ToDecimal(row[1]) });
}
return list;
}
public class RefundDto
{
public int fMonth { get; set; }
public decimal refundPrice { get; set; }
}
}
}