Commit d468f47a authored by solho's avatar solho

1.架構調整

parent edaf4ddb
......@@ -15,7 +15,7 @@ namespace WebAPI
routes.MapRoute(
name: "Default",
url: "sol/{controller}/{action}/{id}",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
......
......@@ -21,6 +21,13 @@ namespace WebAPI
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
config.Routes.MapHttpRoute(
name: "solApi",
routeTemplate: "sol/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
......@@ -13,7 +13,7 @@ using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models;
using static WebAPI.Models.CommonModel;
using static WebAPI.Tool.Common;
namespace WebAPI.Controllers
{
......
......@@ -12,6 +12,7 @@ using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models;
using static WebAPI.Models.CommonModel;
using static WebAPI.Tool.Common;
namespace WebAPI.Controllers
{
......
......@@ -23,82 +23,5 @@ namespace WebAPI.Models
public class CommonModel
{
#region 共用函式
public static DataSet SqlToDs(SqlCommand cmd)
{
using (DataSet ds = new DataSet())
{
SqlDataAdapter da = new SqlDataAdapter
{
SelectCommand = cmd
};
da.Fill(ds);
return ds;
}
}
public static DataTable SqlToDt(SqlCommand cmd)
{
using (DataTable dt = new DataTable())
{
if (cmd.Connection.State == ConnectionState.Closed)
cmd.Connection.Open();
dt.Load(cmd.ExecuteReader());
cmd.Connection.Close();
return dt;
}
}
public static string EastAsia_Format(string Msg)
{
Match m;
while ((m = Regex.Match(Msg, "\\d+")).Success)
{
int n = int.Parse(m.Value);
string t =
EastAsiaNumericFormatter.FormatWithCulture("Ln", n,
null, new CultureInfo("zh-TW"));
Msg = Msg.Substring(0, m.Index) + t +
Msg.Substring(m.Index + m.Value.Length);
}
return Msg;
}
#region 簡轉繁
internal const int LOCALE_SYSTEM_DEFAULT = 0x0800;
internal const int LCMAP_SIMPLIFIED_CHINESE = 0x02000000;
internal const int LCMAP_TRADITIONAL_CHINESE = 0x04000000;
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern int LCMapString(int Locale, int dwMapFlags, string lpSrcStr, int cchSrc, [Out] string lpDestStr, int cchDest);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int LCMapStringEx(
string lpLocaleName, // LPCWSTR lpLocaleName
uint dwMapFlags, // DWORD dwMapFlags
string lpSrcStr, // LPCWSTR lpSrcStr
int cchSrc, // int cchSrc
[Out]
string lpDestStr, // LPWSTR lpDestStr
int cchDest, // int cchDest
IntPtr lpVersionInformation, // LPNLSVERSIONINFO lpVersionInformation
IntPtr lpReserved, // LPVOID lpReserved
IntPtr sortHandle); // LPARAM sortHandle
public static string ToSimplified(string pSource)
{
String tTarget = new String(' ', pSource.Length);
int tReturn = LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_SIMPLIFIED_CHINESE, pSource, pSource.Length, tTarget, pSource.Length);
return tTarget;
}
public static string ToTraditional(string pSource)
{
String tTarget = new String(' ', pSource.Length);
int tReturn = LCMapStringEx("zh-CN", LCMAP_TRADITIONAL_CHINESE, pSource, pSource.Length, tTarget, pSource.Length, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
return tTarget;
}
#endregion
#endregion
}
}
\ No newline at end of file
......@@ -3,15 +3,15 @@ using System.Collections.Generic;
namespace WebAPI.Models
{
/// <summary>
/// 點數結算流程相關
/// </summary>
public class MessageList_ETF : MessageList
{
public List<Esn_Todos_Flow_his> FlowHislist { get; set; }
public List<Esn_Todos_FlowModel> FlowHislist { get; set; }
}
public class Esn_Todos_Flow_his
public class Esn_Todos_FlowModel
{
public DateTime? ConfirmTime { get; set; }
public String ConfirmUserClass { get; set; }
......@@ -24,4 +24,6 @@ namespace WebAPI.Models
public String Description { get; set; }
public String Create_User_Name { get; set; }
}
}
\ No newline at end of file
using MySql.Data.MySqlClient;
using Microsoft.International.Formatters;
using MySql.Data.MySqlClient;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
......@@ -6,10 +7,14 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using WebAPI.Models;
......@@ -184,5 +189,83 @@ namespace WebAPI.Tool
}
return result;
}
#region 共用函式
public static DataSet SqlToDs(SqlCommand cmd)
{
using (DataSet ds = new DataSet())
{
SqlDataAdapter da = new SqlDataAdapter
{
SelectCommand = cmd
};
da.Fill(ds);
return ds;
}
}
public static DataTable SqlToDt(SqlCommand cmd)
{
using (DataTable dt = new DataTable())
{
if (cmd.Connection.State == ConnectionState.Closed)
cmd.Connection.Open();
dt.Load(cmd.ExecuteReader());
cmd.Connection.Close();
return dt;
}
}
public static string EastAsia_Format(string Msg)
{
Match m;
while ((m = Regex.Match(Msg, "\\d+")).Success)
{
int n = int.Parse(m.Value);
string t =
EastAsiaNumericFormatter.FormatWithCulture("Ln", n,
null, new CultureInfo("zh-TW"));
Msg = Msg.Substring(0, m.Index) + t +
Msg.Substring(m.Index + m.Value.Length);
}
return Msg;
}
#region 簡轉繁
internal const int LOCALE_SYSTEM_DEFAULT = 0x0800;
internal const int LCMAP_SIMPLIFIED_CHINESE = 0x02000000;
internal const int LCMAP_TRADITIONAL_CHINESE = 0x04000000;
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern int LCMapString(int Locale, int dwMapFlags, string lpSrcStr, int cchSrc, [Out] string lpDestStr, int cchDest);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int LCMapStringEx(
string lpLocaleName, // LPCWSTR lpLocaleName
uint dwMapFlags, // DWORD dwMapFlags
string lpSrcStr, // LPCWSTR lpSrcStr
int cchSrc, // int cchSrc
[Out]
string lpDestStr, // LPWSTR lpDestStr
int cchDest, // int cchDest
IntPtr lpVersionInformation, // LPNLSVERSIONINFO lpVersionInformation
IntPtr lpReserved, // LPVOID lpReserved
IntPtr sortHandle); // LPARAM sortHandle
public static string ToSimplified(string pSource)
{
String tTarget = new String(' ', pSource.Length);
int tReturn = LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_SIMPLIFIED_CHINESE, pSource, pSource.Length, tTarget, pSource.Length);
return tTarget;
}
public static string ToTraditional(string pSource)
{
String tTarget = new String(' ', pSource.Length);
int tReturn = LCMapStringEx("zh-CN", LCMAP_TRADITIONAL_CHINESE, pSource, pSource.Length, tTarget, pSource.Length, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
return tTarget;
}
#endregion
#endregion
}
}
\ No newline at end of file
......@@ -177,6 +177,9 @@
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>packages\MySql.Data.8.0.22\lib\net452\Ubiety.Dns.Core.dll</HintPath>
</Reference>
<Reference Include="WebActivator, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\WebActivator.1.0.0.0\lib\WebActivator.dll</HintPath>
</Reference>
<Reference Include="WebGrease">
<Private>True</Private>
<HintPath>.\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
......@@ -196,13 +199,15 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\Esn_Subitem\Esn_todosController.cs" />
<Compile Include="Controllers\DictionaryController.cs" />
<Compile Include="Controllers\Esn_Todos_FlowController.cs" />
<Compile Include="Controllers\Esn_Subitem\Esn_Todos_FlowController.cs" />
<Compile Include="Controllers\FileController.cs" />
<Compile Include="Controllers\InventorController.cs" />
<Compile Include="Controllers\SubProcInfoController.cs" />
<Compile Include="Controllers\ProcInfoController.cs" />
<Compile Include="Models\Esn_Todos_FlowModel.cs" />
<Compile Include="Models\Esn_TodosModel.cs" />
<Compile Include="Models\ParamModel.cs" />
<Compile Include="Models\CommonResponseMsg.cs" />
<Compile Include="Tool\Common.cs" />
......
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