public CustomerBillingDetailResponse GetCustomerBillingDetailInfo(string customer_id, DateTime from_date, DateTime to_date, string language)
{
CustomerBillingDetailResponse req = new CustomerBillingDetailResponse();
string URL = string.Format("http://113.105.65.104:22224/ctw/msdQueryCtwCusAccount?cuscode={0}&beginDate={1}&endDate={2}", customer_id, from_date.ToString("yyyy-MM-dd"), to_date.ToString("yyyy-MM-dd")); //直接通过URL获取xml
XDocument xdoc = XDocument.Load(URL);
var qurey = from cusaccount in xdoc.Descendants("cusaccount")
select new CustomerBillingDetail
{
cuscodenew = cusaccount.Element("cuscodenew").Value,
accdate = string.IsNullOrEmpty(cusaccount.Element("accdate").Value.ToString()) ? "" : DataTypeHelper.GetDateTime(cusaccount.Element("accdate").Value).ToString("dd-MM-yyyy"),//格式化时间
billcode = cusaccount.Element("billcode").Value,
cno = cusaccount.Element("cno").Value,
description = cusaccount.Element("description").Value,
payin = DataTypeHelper.GetDecimal(cusaccount.Element("payin").Value,0).ToString("N"),
ccp = DataTypeHelper.GetDecimal(cusaccount.Element("ccp").Value,0).ToString("N"),
camount =DataTypeHelper.GetDecimal(cusaccount.Element("camount").Value,0).ToString("N"),
dif = DataTypeHelper.GetDecimal(cusaccount.Element("dif").Value,0).ToString("N"),
totalbalance = DataTypeHelper.GetDecimal(cusaccount.Element("totalbalance").Value,0).ToString("N")
};
req.CustomerBillingDetails = qurey.ToList();//转换成list并放入实体集
return req;
}