|
|
@ -9,6 +9,7 @@ using SqlSugar; |
|
|
|
using SqlSugar.Base; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http; |
|
|
|
|
|
|
|
namespace EasyBL.WEBAPP.SYS |
|
|
@ -307,7 +308,7 @@ namespace EasyBL.WEBAPP.SYS |
|
|
|
var rsList = db.Queryable<SETB_SYS_Country>() |
|
|
|
|
|
|
|
.Where(t1 => t1.Effective == "Y" && t1.DelStatus == "N") |
|
|
|
.Where(t1 => t1.LangType == sLanguageID) |
|
|
|
.WhereIF(!string.IsNullOrEmpty(sLanguageID), t1 => t1.LangType == sLanguageID) |
|
|
|
.WhereIF(!string.IsNullOrEmpty(sRegionID), t1 => t1.RegionID == sRegionID) |
|
|
|
.WhereIF(!string.IsNullOrEmpty(sCountryID), t1 => t1.CountryID == sCountryID) |
|
|
|
.ToList(); |
|
|
@ -329,6 +330,184 @@ namespace EasyBL.WEBAPP.SYS |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//國家選單 (英文名稱 + 中文名稱)
|
|
|
|
#region 國家選單
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 城市類別管理(查詢筆數)
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="i_crm"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public Dictionary<string, CountryDTO> QueryCountryList_TW(RequestMessage i_crm) |
|
|
|
{ |
|
|
|
|
|
|
|
var rsCountryDic = new Dictionary<string, CountryDTO>(); |
|
|
|
|
|
|
|
string sMsg = null; |
|
|
|
var db = SugarBase.GetIntance(); |
|
|
|
try |
|
|
|
{ |
|
|
|
do |
|
|
|
{ |
|
|
|
var sRegionID = _fetchString(i_crm, @"RegionID"); |
|
|
|
var sLangType = _fetchString(i_crm, @"LangType"); |
|
|
|
|
|
|
|
//var AllCountryDic = FindAllByIDsAsDictionary("", "", "");
|
|
|
|
//var TW_CountryList = AllCountryDic.Values.Where(w => w.LangType == sLangType).Select(s => new CountryDTO {
|
|
|
|
|
|
|
|
// CountryID = s.CountryID,
|
|
|
|
// CountryName = s.CountryName
|
|
|
|
|
|
|
|
//}).ToList();
|
|
|
|
|
|
|
|
//System.Diagnostics.Debug.WriteLine("TW_CountryList.Count" + ": "+TW_CountryList.Count);
|
|
|
|
|
|
|
|
//var EN_CountryList = AllCountryDic.Values.Where(w => w.LangType == "en-US").Select(s => new CountryDTO
|
|
|
|
//{
|
|
|
|
|
|
|
|
// CountryID = s.CountryID,
|
|
|
|
// CountryName = s.CountryName
|
|
|
|
|
|
|
|
//}).ToList();
|
|
|
|
|
|
|
|
//System.Diagnostics.Debug.WriteLine("EN_CountryList.Count" + ": " + EN_CountryList.Count);
|
|
|
|
|
|
|
|
//var ENCountryDic = new Dictionary<string, CountryDTO>();
|
|
|
|
|
|
|
|
//foreach(var ENCountry in EN_CountryList) {
|
|
|
|
|
|
|
|
// ENCountryDic[ENCountry.CountryID] = ENCountry;
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//foreach (var Country in TW_CountryList) {
|
|
|
|
|
|
|
|
// if (ENCountryDic.ContainsKey(Country.CountryID)) {
|
|
|
|
|
|
|
|
// var ENCountry = ENCountryDic[Country.CountryID];
|
|
|
|
|
|
|
|
// Country.CountryENName = ENCountry.CountryName;
|
|
|
|
|
|
|
|
// rsCountryDic[Country.CountryID] = Country;
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//var saCountryList = db.Queryable<SETB_SYS_Country, SETB_SYS_Country>((t1, t2) => new object[] {
|
|
|
|
// JoinType.Left, t1.OrgID == t2.OrgID && t1.CountryID == t2.CountryID && t2.LangType == "en-US"
|
|
|
|
//})
|
|
|
|
// .OrderBy(o => o.CountryName, OrderByType.Asc)
|
|
|
|
// .Select((t1, t2) => new CountryDTO {
|
|
|
|
|
|
|
|
// CountryID = t1.CountryID,
|
|
|
|
// CountryName = t1.CountryName,
|
|
|
|
// CountryENName = t2.CountryName
|
|
|
|
|
|
|
|
// })
|
|
|
|
// .ToList();
|
|
|
|
|
|
|
|
//foreach (var Country in saCountryList) {
|
|
|
|
|
|
|
|
// rsCountryDic[Country.CountryID] = Country;
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var saCountry_tw = db.Queryable<SETB_SYS_Country>() |
|
|
|
//搜尋條件
|
|
|
|
.Where(x => x.OrgID == i_crm.ORIGID && x.Effective == "Y" && x.DelStatus == "N") |
|
|
|
.WhereIF(!string.IsNullOrEmpty(sRegionID), x => x.RegionID == sRegionID) |
|
|
|
//.WhereIF(!string.IsNullOrEmpty(sLangType), x => x.LangType == "zh-TW")
|
|
|
|
.OrderBy(o => o.CountryName, OrderByType.Asc) |
|
|
|
.Select(t1 => new CountryDTO |
|
|
|
{ //只取DTO要的資料
|
|
|
|
|
|
|
|
CountryID = t1.CountryID, |
|
|
|
CountryName = t1.CountryName |
|
|
|
|
|
|
|
}) |
|
|
|
.ToList(); |
|
|
|
|
|
|
|
var saCountry_en = db.Queryable<SETB_SYS_Country>() |
|
|
|
//搜尋條件
|
|
|
|
.Where(x => x.OrgID == i_crm.ORIGID && x.Effective == "Y" && x.DelStatus == "N") |
|
|
|
.WhereIF(!string.IsNullOrEmpty(sRegionID), x => x.RegionID == sRegionID) |
|
|
|
.WhereIF(!string.IsNullOrEmpty(sLangType), x => x.LangType == "en-US") |
|
|
|
.OrderBy(o => o.CountryName, OrderByType.Asc) |
|
|
|
.Select(t1 => new CountryDTO |
|
|
|
{ |
|
|
|
|
|
|
|
CountryID = t1.CountryID, |
|
|
|
CountryName = t1.CountryName |
|
|
|
|
|
|
|
}) |
|
|
|
.ToList(); |
|
|
|
|
|
|
|
var CountryENDic = new Dictionary<string, CountryDTO>(); //English data DTO
|
|
|
|
|
|
|
|
foreach (var CountryEN in saCountry_en) |
|
|
|
{ |
|
|
|
|
|
|
|
CountryENDic[CountryEN.CountryID] = CountryEN; //將English data以CountryID去重複值,塞入Dic
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
foreach (var name_tw in saCountry_tw) |
|
|
|
{ |
|
|
|
|
|
|
|
if (CountryENDic.ContainsKey(name_tw.CountryID)) |
|
|
|
{ |
|
|
|
name_tw.CountryENName = CountryENDic[name_tw.CountryID].CountryName; |
|
|
|
} |
|
|
|
|
|
|
|
rsCountryDic[name_tw.CountryID] = name_tw; |
|
|
|
|
|
|
|
|
|
|
|
//foreach(var name_en in saCountry_en)
|
|
|
|
//{
|
|
|
|
// if(name_tw.CountryID == name_en.CountryID)
|
|
|
|
// {
|
|
|
|
// Country = name_en.CountryName + " " + name_tw.CountryName;
|
|
|
|
// System.Diagnostics.Debug.WriteLine("Country with data:" + Country);
|
|
|
|
// //saCountry.Add(name_tw.CountryID, Country);
|
|
|
|
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
} |
|
|
|
|
|
|
|
return rsCountryDic; |
|
|
|
|
|
|
|
} while (false); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
sMsg = Util.GetLastExceptionMsg(ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return rsCountryDic; |
|
|
|
} |
|
|
|
|
|
|
|
#endregion 國家選單
|
|
|
|
} |
|
|
|
} |
xxxxxxxxxx