Commit 46f2a205 authored by solho's avatar solho

修改為與簡繁欄位比對

parent b8188300
...@@ -9,6 +9,7 @@ using System.Linq; ...@@ -9,6 +9,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Web; using System.Web;
using System.Web.Http; using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models; using WebAPI.Models;
using static WebAPI.Models.CommonModel; using static WebAPI.Models.CommonModel;
...@@ -16,7 +17,8 @@ namespace WebAPI.Controllers ...@@ -16,7 +17,8 @@ namespace WebAPI.Controllers
{ {
public class FeeOfferConfigController : ApiController public class FeeOfferConfigController : ApiController
{ {
String Country = "zh_cn"; String Country1 = "zh_cn";
String Country2 = "zh_tw";
//Message Outmsg; //Message Outmsg;
MessageList Outmsg; MessageList Outmsg;
public FeeOfferConfigController() public FeeOfferConfigController()
...@@ -28,6 +30,8 @@ namespace WebAPI.Controllers ...@@ -28,6 +30,8 @@ namespace WebAPI.Controllers
#region 報價規則 #region 報價規則
[Route("GetFeeOfferConfigList")] [Route("GetFeeOfferConfigList")]
[EnableCors(origins: "http://120.78.73.107:8888,https://ipeasy.purplevineip.com,https://ipeasy.essenptl.com",
headers: "*", methods: "*", SupportsCredentials = true)]
[HttpPost] [HttpPost]
public MessageList GetFeeOfferConfigList(Boolean ischeck) public MessageList GetFeeOfferConfigList(Boolean ischeck)
...@@ -126,7 +130,10 @@ namespace WebAPI.Controllers ...@@ -126,7 +130,10 @@ namespace WebAPI.Controllers
#region MetaData Set #region MetaData Set
FieldName = "案件類型"; AddFieldName = "case_type_id"; FieldValue = drRow[FieldName].ToString(); FieldName = "案件類型"; AddFieldName = "case_type_id"; FieldValue = drRow[FieldName].ToString();
drTemp = MetaData.Tables[0].AsEnumerable().Where(p => p.Field<String>("case_type_" + Country) == ToSimplified(FieldValue)).FirstOrDefault(); drTemp = MetaData.Tables[0].AsEnumerable().Where(p =>
(!string.IsNullOrWhiteSpace(p.Field<String>("case_type_" + Country1)) && p.Field<String>("case_type_" + Country1) == FieldValue)
|| (!string.IsNullOrWhiteSpace(p.Field<String>("case_type_" + Country2)) && p.Field<String>("case_type_" + Country2) == FieldValue)
).FirstOrDefault();
if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString()); if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString());
else else
{ {
...@@ -135,7 +142,10 @@ namespace WebAPI.Controllers ...@@ -135,7 +142,10 @@ namespace WebAPI.Controllers
} }
FieldName = "申請類型"; AddFieldName = "apply_type_id"; FieldValue = drRow[FieldName].ToString(); FieldName = "申請類型"; AddFieldName = "apply_type_id"; FieldValue = drRow[FieldName].ToString();
drTemp = MetaData.Tables[1].AsEnumerable().Where(p => p.Field<String>("apply_type_" + Country) == ToSimplified(FieldValue)).FirstOrDefault(); drTemp = MetaData.Tables[1].AsEnumerable().Where(p =>
(!string.IsNullOrWhiteSpace(p.Field<String>("apply_type_" + Country1)) && p.Field<String>("apply_type_" + Country1) == FieldValue)
|| (!string.IsNullOrWhiteSpace(p.Field<String>("apply_type_" + Country2)) && p.Field<String>("apply_type_" + Country2) == FieldValue)
).FirstOrDefault();
if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString()); if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString());
else else
{ {
...@@ -145,7 +155,13 @@ namespace WebAPI.Controllers ...@@ -145,7 +155,13 @@ namespace WebAPI.Controllers
FieldName = "處理事項"; AddFieldName = "ctrl_proc_id"; FieldValue = drRow[FieldName].ToString(); FieldName = "處理事項"; AddFieldName = "ctrl_proc_id"; FieldValue = drRow[FieldName].ToString();
String case_type_id = ids["case_type_id"]; String case_type_id = ids["case_type_id"];
drTemp = MetaData.Tables[2].AsEnumerable().Where(p => p.Field<String>("ctrl_proc_" + Country) == ToSimplified(FieldValue) && p.Field<String>("case_type_id") == case_type_id).FirstOrDefault(); drTemp = MetaData.Tables[2].AsEnumerable().Where(p =>
(
(!string.IsNullOrWhiteSpace(p.Field<String>("ctrl_proc_" + Country1)) && p.Field<String>("ctrl_proc_" + Country1) == FieldValue)
|| (!string.IsNullOrWhiteSpace(p.Field<String>("ctrl_proc_" + Country2)) && p.Field<String>("ctrl_proc_" + Country2) == FieldValue)
)
&& p.Field<String>("case_type_id") == case_type_id
).FirstOrDefault();
if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString()); if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString());
else else
{ {
...@@ -153,7 +169,10 @@ namespace WebAPI.Controllers ...@@ -153,7 +169,10 @@ namespace WebAPI.Controllers
if (!String.IsNullOrWhiteSpace(FieldValue)) Noticemsg += "(無" + FieldName + ":" + FieldValue + "),"; if (!String.IsNullOrWhiteSpace(FieldValue)) Noticemsg += "(無" + FieldName + ":" + FieldValue + "),";
} }
FieldName = "業務類型"; AddFieldName = "business_type_id"; FieldValue = drRow[FieldName].ToString(); FieldName = "業務類型"; AddFieldName = "business_type_id"; FieldValue = drRow[FieldName].ToString();
drTemp = MetaData.Tables[3].AsEnumerable().Where(p => p.Field<String>("business_type_" + Country) == ToSimplified(FieldValue)).FirstOrDefault(); drTemp = MetaData.Tables[3].AsEnumerable().Where(p =>
(!string.IsNullOrWhiteSpace(p.Field<String>("business_type_" + Country1)) && p.Field<String>("business_type_" + Country1) == FieldValue)
|| (!string.IsNullOrWhiteSpace(p.Field<String>("business_type_" + Country2)) && p.Field<String>("business_type_" + Country2) == FieldValue)
).FirstOrDefault();
if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString()); if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString());
else else
{ {
...@@ -161,7 +180,10 @@ namespace WebAPI.Controllers ...@@ -161,7 +180,10 @@ namespace WebAPI.Controllers
if (!(String.IsNullOrWhiteSpace(FieldValue))) Noticemsg += "(無" + FieldName + ":" + FieldValue + "),"; if (!(String.IsNullOrWhiteSpace(FieldValue))) Noticemsg += "(無" + FieldName + ":" + FieldValue + "),";
} }
FieldName = "程序名稱"; AddFieldName = "fc_cate_id"; FieldValue = drRow[FieldName].ToString(); FieldName = "程序名稱"; AddFieldName = "fc_cate_id"; FieldValue = drRow[FieldName].ToString();
drTemp = MetaData.Tables[4].AsEnumerable().Where(p => p.Field<String>("text_" + Country) == ToSimplified(FieldValue)).FirstOrDefault(); drTemp = MetaData.Tables[4].AsEnumerable().Where(p =>
(!string.IsNullOrWhiteSpace(p.Field<String>("text_" + Country1)) && p.Field<String>("text_" + Country1) == FieldValue)
|| (!string.IsNullOrWhiteSpace(p.Field<String>("text_" + Country2)) && p.Field<String>("text_" + Country2) == FieldValue)
).FirstOrDefault();
if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString()); if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString());
else else
{ {
...@@ -177,7 +199,10 @@ namespace WebAPI.Controllers ...@@ -177,7 +199,10 @@ namespace WebAPI.Controllers
errmsg += "(無" + FieldName + ":" + FieldValue + "),"; errmsg += "(無" + FieldName + ":" + FieldValue + "),";
} }
FieldName = "案件階段"; AddFieldName = "case_status_id"; FieldValue = drRow[FieldName].ToString(); FieldName = "案件階段"; AddFieldName = "case_status_id"; FieldValue = drRow[FieldName].ToString();
drTemp = MetaData.Tables[6].AsEnumerable().Where(p => p.Field<String>("case_status_" + Country) == ToSimplified(FieldValue)).FirstOrDefault(); drTemp = MetaData.Tables[6].AsEnumerable().Where(p =>
(!string.IsNullOrWhiteSpace(p.Field<String>("case_status_" + Country1)) && p.Field<String>("case_status_" + Country1) == FieldValue)
|| (!string.IsNullOrWhiteSpace(p.Field<String>("case_status_" + Country2)) && p.Field<String>("case_status_" + Country2) == FieldValue)
).FirstOrDefault();
if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString()); if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString());
else else
{ {
...@@ -185,7 +210,10 @@ namespace WebAPI.Controllers ...@@ -185,7 +210,10 @@ namespace WebAPI.Controllers
if (!String.IsNullOrWhiteSpace(FieldValue)) Noticemsg += "(無" + FieldName + ":" + FieldValue + "),"; if (!String.IsNullOrWhiteSpace(FieldValue)) Noticemsg += "(無" + FieldName + ":" + FieldValue + "),";
} }
FieldName = "科目"; AddFieldName = "fee_cate_workitem"; FieldValue = drRow[FieldName].ToString(); FieldName = "科目"; AddFieldName = "fee_cate_workitem"; FieldValue = drRow[FieldName].ToString();
drTemp = MetaData.Tables[7].AsEnumerable().Where(p => p.Field<String>("text_" + Country) == ToSimplified(FieldValue)).FirstOrDefault(); drTemp = MetaData.Tables[7].AsEnumerable().Where(p =>
(!string.IsNullOrWhiteSpace(p.Field<String>("text_" + Country1)) && p.Field<String>("text_" + Country1) == FieldValue)
|| (!string.IsNullOrWhiteSpace(p.Field<String>("text_" + Country2)) && p.Field<String>("text_" + Country2) == FieldValue)
).FirstOrDefault();
if (drTemp != null) ids.Add(AddFieldName, drTemp["value"].ToString()); if (drTemp != null) ids.Add(AddFieldName, drTemp["value"].ToString());
else else
{ {
...@@ -194,7 +222,10 @@ namespace WebAPI.Controllers ...@@ -194,7 +222,10 @@ namespace WebAPI.Controllers
} }
FieldName = "稅別"; AddFieldName = "fo_tax_rate_name"; FieldValue = drRow[FieldName].ToString(); FieldName = "稅別"; AddFieldName = "fo_tax_rate_name"; FieldValue = drRow[FieldName].ToString();
drTemp = MetaData.Tables[8].AsEnumerable().Where(p => p.Field<String>("text_"+ Country) == ToSimplified(FieldValue)).FirstOrDefault(); drTemp = MetaData.Tables[8].AsEnumerable().Where(p =>
(!string.IsNullOrWhiteSpace(p.Field<String>("text_" + Country1)) && p.Field<String>("text_" + Country1) == FieldValue)
|| (!string.IsNullOrWhiteSpace(p.Field<String>("text_" + Country2)) && p.Field<String>("text_" + Country2) == FieldValue)
).FirstOrDefault();
if (drTemp != null) ids.Add(AddFieldName, drTemp["value"].ToString()); if (drTemp != null) ids.Add(AddFieldName, drTemp["value"].ToString());
else else
{ {
...@@ -202,7 +233,7 @@ namespace WebAPI.Controllers ...@@ -202,7 +233,7 @@ namespace WebAPI.Controllers
if (!String.IsNullOrWhiteSpace(FieldValue)) Noticemsg += "(無" + FieldName + ":" + FieldValue + "),"; if (!String.IsNullOrWhiteSpace(FieldValue)) Noticemsg += "(無" + FieldName + ":" + FieldValue + "),";
} }
FieldName = "幣別"; AddFieldName = "currency_id"; FieldValue = drRow[FieldName].ToString(); FieldName = "幣別"; AddFieldName = "currency_id"; FieldValue = drRow[FieldName].ToString();
drTemp = MetaData.Tables[9].AsEnumerable().Where(p => p.Field<String>("currency_id") == ToTraditional(FieldValue)).FirstOrDefault(); drTemp = MetaData.Tables[9].AsEnumerable().Where(p => p.Field<String>("currency_id") == FieldValue).FirstOrDefault();
if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString()); if (drTemp != null) ids.Add(AddFieldName, drTemp[AddFieldName].ToString());
else else
{ {
...@@ -210,7 +241,7 @@ namespace WebAPI.Controllers ...@@ -210,7 +241,7 @@ namespace WebAPI.Controllers
errmsg += "(無" + FieldName + ":" + FieldValue + "),"; errmsg += "(無" + FieldName + ":" + FieldValue + "),";
} }
FieldName = "國家(地區)"; AddFieldName = "country_id"; FieldValue = drRow[FieldName].ToString(); FieldName = "國家(地區)"; AddFieldName = "country_id"; FieldValue = drRow[FieldName].ToString();
drTemp = MetaData.Tables[10].AsEnumerable().Where(p => p.Field<String>("country_id") == ToTraditional(FieldValue)).FirstOrDefault(); drTemp = MetaData.Tables[10].AsEnumerable().Where(p => p.Field<String>("country_id") == FieldValue).FirstOrDefault();
if (drTemp != null) ids.Add(AddFieldName, drTemp["country_id"].ToString()); if (drTemp != null) ids.Add(AddFieldName, drTemp["country_id"].ToString());
else else
{ {
...@@ -578,12 +609,12 @@ namespace WebAPI.Controllers ...@@ -578,12 +609,12 @@ namespace WebAPI.Controllers
private DataSet GetMetaData(ref SqlCommand cmd) private DataSet GetMetaData(ref SqlCommand cmd)
{ {
string str = @"SELECT case_type_id,case_type_@Country FROM dbo.i_case_type; SELECT apply_type_id,apply_type_@Country FROM dbo.i_apply_type string str = String.Format(@"SELECT case_type_id,case_type_{0},case_type_{1} FROM dbo.i_case_type; SELECT apply_type_id,apply_type_{0},apply_type_{1} FROM dbo.i_apply_type
SELECT ctrl_proc_id,case_type_id,ctrl_proc_@Country FROM dbo.i_ctrl_proc where is_enabled=1; SELECT ctrl_proc_id,case_type_id,ctrl_proc_{0},ctrl_proc_{1} FROM dbo.i_ctrl_proc where is_enabled=1;
SELECT business_type_id,business_type_@Country FROM dbo.i_business_type where isnull(business_type_@Country,'') <> ''; SELECT fc_cate_id,text_@Country FROM dbo.i_fc_category where is_enabled=1; SELECT business_type_id,business_type_{0},business_type_{1} FROM dbo.i_business_type ; SELECT fc_cate_id,text_{0},text_{1} FROM dbo.i_fc_category where is_enabled=1;
select customer_id,customer_name_en,customer_name from c_customer a where is_enabled=1 and isnull(customer_name,'') <> '';SELECT case_status_id,case_status_@Country FROM i_case_status where isnull(case_status_@Country,'') <> ''; select customer_id,customer_name_en,customer_name from c_customer a where is_enabled=1 and isnull(customer_name,'') <> '';SELECT case_status_id,case_status_{0},case_status_{1} FROM i_case_status;
SELECT dictionary_id,value,text_@Country FROM dbo.s_dictionary WHERE dictionary_name = 'fee_cate_workitem'; SELECT dictionary_id,value,text_@Country FROM dbo.s_dictionary WHERE dictionary_name ='fo_tax_rate_name'; SELECT dictionary_id,value,text_{0},text_{1} FROM dbo.s_dictionary WHERE dictionary_name = 'fee_cate_workitem'; SELECT dictionary_id,value,text_{0},text_{1} FROM dbo.s_dictionary WHERE dictionary_name ='fo_tax_rate_name';
select currency_id,currency_name_@Country from i_currency a;select country_id,country_@Country from i_country a".Replace("@Country", Country); select currency_id,currency_name_{0},currency_name_{1} from i_currency a;select country_id,country_{0},country_{1} from i_country a", Country1, Country2);
cmd.CommandText = str; cmd.CommandText = str;
DataSet MetaData = GetSqlToDs(cmd); DataSet MetaData = GetSqlToDs(cmd);
......
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