From f0bb2d8bd83bc984a78a9ef8c3c7dd4ef821627f Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期四, 29 六月 2023 15:24:14 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/BaseSet/Gy_CurrencyController.cs | 81 ++++++++++++++++++++++++++++++++--------
1 files changed, 64 insertions(+), 17 deletions(-)
diff --git a/WebAPI/Controllers/BaseSet/Gy_CurrencyController.cs b/WebAPI/Controllers/BaseSet/Gy_CurrencyController.cs
index ddb0f3f..a50383f 100644
--- a/WebAPI/Controllers/BaseSet/Gy_CurrencyController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_CurrencyController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -31,6 +32,7 @@
{
try
{
+ List<object> columnNameList = new List<object>();
//缂栬緫鏉冮檺
if (!DBUtility.ClsPub.Security_Log_second("Gy_Currency", 1, false, user))
{
@@ -43,30 +45,30 @@
if (sWhere == null || sWhere.Equals(""))
{
- ds = oCN.RunProcReturn("select * from h_v_Gy_CurrencyList where 绂佺敤鏍囪=''" + sWhere+ " order by 璐у竵浠g爜", "h_v_Gy_CurrencyList");
+ ds = oCN.RunProcReturn("select * from h_v_Gy_CurrencyList where 绂佺敤鏍囪=''" + sWhere + " order by 璐у竵浠g爜", "h_v_Gy_CurrencyList");
}
else
{
string sql1 = "select * from h_v_Gy_CurrencyList where 绂佺敤鏍囪='' ";
- string sql = sql1 + sWhere+ " order by 璐у竵浠g爜";
+ string sql = sql1 + sWhere + " order by 璐у竵浠g爜";
ds = oCN.RunProcReturn(sql, "h_v_Gy_CurrencyList");
}
- if (ds == null || ds.Tables[0].Rows.Count == 0)
+
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
{
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "false锛�";
- objJsonResult.data = null;
- return objJsonResult;
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
}
- else
- {
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "Sucess锛�";
- objJsonResult.data = ds.Tables[0];
- return objJsonResult;
- }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
}
catch (Exception e)
{
@@ -392,6 +394,51 @@
}
}
+ #region 甯佸埆 閲戣澏鍚屾
+ [Route("Gy_Currency/SaveGy_CurrencyListApi")]
+ [HttpPost]
+ public object SaveGy_CurrencyListApi([FromBody] JObject msg)
+ {
+ try
+ {
+ var _value = msg["model"].ToString();
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ ListModels oListModels = new ListModels();
+ List<Model.ClsGy_Currency_Model> lsmain = new List<Model.ClsGy_Currency_Model>();
+ lsmain = oListModels.getObjectByJson_Gy_Currency(_value);
+ string sql = string.Empty;
+ //淇濆瓨
+ oCN.BeginTran();
+ sql = $"delete Gy_Currency where HItemID = {lsmain[0].HItemID}";
+ oCN.RunProc(sql);
+ sql = "set identity_insert Gy_Currency on";
+ oCN.RunProc(sql);
+
+ oCN.RunProc($@"insert into Gy_Currency(HItemID,HNumber,HName,HShortNumber,HParentID
+ ,HLevel,HEndFlag,HStopflag,HRemark,HHelpCode,HScale,HExchangeRate)
+ values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HShortNumber}',{lsmain[0].HParentID},{lsmain[0].HLevel}
+ ,{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) },'{lsmain[0].HRemark}','{lsmain[0].HHelpCode}','{lsmain[0].HScale}','{lsmain[0].HExchangeRate}')", ref DBUtility.ClsPub.sExeReturnInfo);
+ //淇敼涓婄骇涓洪潪鏈骇浠g爜
+ sql = "set identity_insert Gy_Currency off";
+ oCN.RunProc(sql);
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ #endregion
}
}
\ No newline at end of file
--
Gitblit v1.9.1