1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 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 WMCalculateUnitService
- {
- SqlHelper sqlHelper = new SqlHelper("InstallDB");
- public String getInstallUnitList(Pagination pagination)
- {
- String sql = "SELECT [UnitId],[Code],[CalculateUnit],[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("\"UnitId\":\"").Append(r["UnitId"].ToString()).Append("\",");
- sb.Append("\"Code\":\"").Append(r["Code"].ToString()).Append("\",");
- sb.Append("\"CalculateUnit\":\"").Append(r["CalculateUnit"] != 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;
- }
- public void SaveCulcalateUnit(String Code, String CalculateUnit)
- {
- String sql = "Insert into WM_CalculateUnit([Code],[CalculateUnit],[CreateDt]) Values ('" + Code.Trim() + "','" + CalculateUnit + "',GETDATE())";
- try
- {
- sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- //sql = "update INS_Budget SET PaymentName = '" + op + "' ,PaymentTime = GETDATE() where Apply_ID =" + applyId;
- //sqlHelper.ExecuteNoParams(sql, CommandType.Text);
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- }
- }
|