Commit ce2f36e8 authored by solho's avatar solho

feat:處理事項新增取得期限變更歷史 功能

parent 77c119b3
......@@ -1128,5 +1128,51 @@ namespace WebAPI.Controllers
}
return dt;
}
/// <summary>
/// 取得期限變更歷史資料
/// </summary>
/// <param name="param">取得JSON</param>
/// <returns></returns>
[Route("ProcInfo/Get_p_case_status_history_topcus_due_date")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage Get_p_case_status_history_topcus_due_date(ParamModel param)
{
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
CommonResponseMsg response = new CommonResponseMsg();
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
string input = param.Input.ToString();
JObject obj_input = JObject.Parse(input.ToString());
try
{
SqlServerHelper sql_server_helper = new SqlServerHelper();
DataTable dt;
using (SqlCommand sqlcmd=new SqlCommand())
{
sqlcmd.CommandText = @"select top 1 cus_due_date_old from p_case_status_history a where a.case_id=@proc_id and isnull(a.cus_due_date_old,'')!=''
order by cus_due_date_old";
sqlcmd.Parameters.AddWithValue("@proc_id", obj_input["proc_id"].ToString());
dt= sql_server_helper.GetTable(sqlcmd);
}
response.Code = "1";
response.Msg = dt;
}
catch (Exception e)
{
response.Code = "0";
response.Msg = "Exception:" + e.StackTrace;
}
}
else
{
response.Code = "0";
response.Msg = "no input or format error";
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
}
}
\ No newline at end of file
......@@ -155,6 +155,35 @@ namespace WebAPI.Tool
return dataTable;
}
/// <summary>
/// 通过sql语句获取数据表
/// </summary>
/// <param name="selectSqlCommand">获取表的select语句</param>
/// <returns>获取到的数据表</returns>
public DataTable GetTable(SqlCommand selectSqlCommand)
{
if (selectSqlCommand ==null)
throw new Exception("要执行的selectSqlCommand不能为空");
OpenConnection();
selectSqlCommand.Connection = SqlCnt;
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(selectSqlCommand);
DataTable dataTable = new DataTable();
try
{
sqlDataAdapter.Fill(dataTable); //通过SqlDataAdapter填充DataTable对象
}
catch (Exception e)
{
LogHelper.WriteErrorLog(string.Format(@"{0}", selectSqlCommand), e, this.GetType().Name + ":" + MethodBase.GetCurrentMethod().Name);
throw new Exception("select语句有错或者数据表不存在:" + e);
}
finally
{
CloseConnection();
}
return dataTable;
}
public DataSet GetDataSet(string selectSqlCommand, Hashtable ht = null)
{
if (string.IsNullOrEmpty(selectSqlCommand))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment