12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using LeaRun.Data;
- using LeaRun.Util.WebControl;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace LeaRun.Application.Service.WarehouseManage
- {
- public class WMSupplierTypeService
- {
- SqlHelper sqlHelper = new SqlHelper("InstallDB");
- //获取计量单位
- public String getSupplierTypeList(Pagination pagination)
- {
-
- String sql = "SELECT SupplierTypeId,SupplierCode,SupplierTypeName,CreateDt FROM WM_CalculateUnit";
- DataTable dt;
- StringBuilder sb = new StringBuilder();
- String json = "";
- Char c = ',';
- int total = pagination.records;
- dt = sqlHelper.ExecuteDataTable(sql, "", false, pagination.rows, pagination.page, out total, null);
- pagination.records = total;
- if (dt.Rows.Count > 0)
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- DataRow r = dt.Rows[i];
- #region 拼接sql
- sb.Append("{");
- sb.Append("\"SupplierTypeId\":\"").Append(r["SupplierTypeId"].ToString()).Append("\",");
- sb.Append("\"SupplierCode\":\"").Append(r["SupplierCode"].ToString()).Append("\",");
- sb.Append("\"SupplierTypeName\":\"").Append(r["SupplierTypeName"] != System.DBNull.Value ? r["CalculateUnit"].ToString() : "").Append("\",");
- sb.Append("\"CreateDt\":\"").Append(r["CreateDt"] != System.DBNull.Value ? Convert.ToDateTime(r["CreateDt"]).ToString("yyyy-MM-dd HH:mm:ss") : "").Append("\"");
- sb.Append("},");
- #endregion
- json = "[" + sb.ToString().TrimEnd(c) + "]";
- }
- }
- return json;
- }
- }
- }
|