Commit 49c649d3 authored by solho's avatar solho

feat:新增WADE角色資訊,EssenToCrm MODEL

fix:revert FeeOfferConfigController 回charles改
parent 2f7db432
using Dapper;
using DapperQueryBuilder;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using WebAPI.Models;
using static WebAPI.Tool.Common;
namespace WebAPI.Controllers
{
public class EssenToCrmController : ApiController
{
HttpResponseMessage result;
CommonResponseMsg response;
String connString;
public EssenToCrmController()
{
result = new HttpResponseMessage(HttpStatusCode.OK);
response = new CommonResponseMsg();
connString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
}
/// <summary>
/// 取得 essen_request_info 資訊
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[Route("Get_essen_request_info")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage Get_essen_request_info(ParamModel param)
{
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
string input = param.Input.ToString();
try
{
JObject obj_input = JObject.Parse(input.ToString());
using (SqlConnection Conn = new SqlConnection(connString))
{
var dysql = Conn.QueryBuilder($@" select eri.request_id,eri.customer_id,invoice_title from essen_request_info eri
left join i_request_info iri on eri.request_id=iri.request_id
/**where**/ ");
if (obj_input["request_id"] != null)
{
dysql.Where( $"eri.request_id = {obj_input["request_id"].ToString()}");
}
if (obj_input["customer_id"] != null)
{
dysql.Where($" eri.customer_id = {obj_input["customer_id"].ToString()}");
}
var results = dysql.Query();
response.Msg = JsonConvert.SerializeObject(results);
response.Code = "1";
}
}
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;
}
}
}
...@@ -271,7 +271,11 @@ namespace WebAPI.Controllers ...@@ -271,7 +271,11 @@ namespace WebAPI.Controllers
var table = ds.Tables[0]; var table = ds.Tables[0];
DataRow drh = table.Rows[0]; DataRow drh = table.Rows[0];
for (int i = 0; i < drh.ItemArray.Length; i++) for (int i = 0; i < drh.ItemArray.Length; i++)
{
string a = drh[i].ToString();
Console.WriteLine(ToTraditional(drh[i].ToString()));
table.Columns[i].ColumnName = ToTraditional(drh[i].ToString()); table.Columns[i].ColumnName = ToTraditional(drh[i].ToString());
}
Dictionary<String, String> ids = new Dictionary<String, String>(), Temps = new Dictionary<String, String>(); Dictionary<String, String> ids = new Dictionary<String, String>(), Temps = new Dictionary<String, String>();
DataRow drRow; DataRow drRow;
......
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.IO;
using System.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Net;
using System.Net.Http;
using System.Web;
using Dapper;
using Dapper.Contrib.Extensions;
using System.Web.Http;
using WebAPI.Models;
using MySql.Data.MySqlClient;
using static WebAPI.Tool.Common;
using System.Text;
namespace WebAPI.Controllers
{
[RoutePrefix("RoleInfo")]
public class RoleInfoController : ApiController
{
HttpResponseMessage result;
CommonResponseMsg response;
String connString;
public RoleInfoController()
{
result = new HttpResponseMessage(HttpStatusCode.OK);
response = new CommonResponseMsg();
connString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
}
/// <summary>
/// 取得角色資訊
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[Route("Get_s_role_info")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage Get_s_role_info(ParamModel param)
{
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
string input = param.Input.ToString();
JObject obj_input = JObject.Parse(input.ToString());
try
{
string JSONString = string.Empty;
using (SqlConnection Conn = new SqlConnection(connString))
{
string sqlstr = @"select c.* from evw_Employee a
left join s_user_role b on a.user_id = b.user_id
left join s_role_info c on b.role_id = c.role_id
where a.user_id = @user_id ";
if (obj_input["role_code"] != null)
{
sqlstr += " and role_code=@role_code";
}
var results = Conn.Query<Get_s_role_infoModel>(sqlstr
, new
{
user_id = obj_input["user_id"] == null ? "" : obj_input["user_id"].ToString(),
role_code = obj_input["role_code"] == null ? "" : obj_input["role_code"].ToString()
}
, commandType: CommandType.Text);
JSONString = JsonConvert.SerializeObject(results);
}
response.Msg = JSONString;
response.Code = "1";
}
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;
}
}
}
using System;
using Dapper.Contrib.Extensions;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
[Table("s_role_info")]
public class s_role_infoModel
{
public String user_id { get; set; }
public String role_id { get; set; }
public String identity_id { get; set; }
}
public class Get_s_role_infoModel
{
public String role_id { get; set; }
public String role_name { get; set; }
public String role_code { get; set; }
public String is_default { get; set; }
public String remark { get; set; }
public String is_show { get; set; }
}
}
\ No newline at end of file
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