DataTable dt = AuctionOrders.PayCarPrice(uid, payStatus, pageIndex, pageSize);
if (dt.Rows.Count > 0)
{
//新表
DataTable newDt = new DataTable();
List<string> listColums = new List<string>();
//複製表結夠
newDt = dt.Clone();
//新表中的列資料型別為Decmail的改為string
foreach (DataColumn col in newDt.Columns)
listColums.Add(col.ColumnName);
if (col.DataType.FullName == "System.Decimal")
col.DataType = Type.GetType("System.String");
}
foreach (DataRow row in dt.Rows)
DataRow newDtRow = newDt.NewRow();
foreach(DataColumn column in dt.Columns)
if (column.DataType.FullName == "System.Decimal")
newDtRow[column.ColumnName] = (Convert.ToDecimal(row[column.ColumnName]) / 10000).ToString("c") + "萬";
else
newDtRow[column.ColumnName] = row[column.ColumnName];
newDt.Rows.Add(newDtRow);
var obj = new { state = true, message = newDt };
Response.Write(JsonConvert.SerializeObject(obj));
var obj = new { state = false, message = "沒有查詢到資訊" };
DataTable dt = AuctionOrders.PayCarPrice(uid, payStatus, pageIndex, pageSize);
if (dt.Rows.Count > 0)
{
//新表
DataTable newDt = new DataTable();
List<string> listColums = new List<string>();
//複製表結夠
newDt = dt.Clone();
//新表中的列資料型別為Decmail的改為string
foreach (DataColumn col in newDt.Columns)
{
listColums.Add(col.ColumnName);
if (col.DataType.FullName == "System.Decimal")
{
col.DataType = Type.GetType("System.String");
}
}
foreach (DataRow row in dt.Rows)
{
DataRow newDtRow = newDt.NewRow();
foreach(DataColumn column in dt.Columns)
{
if (column.DataType.FullName == "System.Decimal")
{
newDtRow[column.ColumnName] = (Convert.ToDecimal(row[column.ColumnName]) / 10000).ToString("c") + "萬";
}
else
{
newDtRow[column.ColumnName] = row[column.ColumnName];
}
}
newDt.Rows.Add(newDtRow);
}
var obj = new { state = true, message = newDt };
Response.Write(JsonConvert.SerializeObject(obj));
}
else
{
var obj = new { state = false, message = "沒有查詢到資訊" };
Response.Write(JsonConvert.SerializeObject(obj));