From 76b910b41b112207aca4c4c1945f51396f3b2bee Mon Sep 17 00:00:00 2001
From: Janie <109517022+Janie06@users.noreply.github.com>
Date: Mon, 26 Dec 2022 16:39:24 +0800
Subject: [PATCH] =?UTF-8?q?[WHAT]=20=E5=B1=95=E9=A4=A8=E7=AE=A1=E7=90=86?=
 =?UTF-8?q?=20[WHY]=20=E5=A2=9E=E5=8A=A0=E5=A4=9A=E8=AA=9E=E7=B3=BB=20[HOW?=
 =?UTF-8?q?]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

展館管理:
1. 增加多語系
2. 功能修正

地區模組:
1. 排版樣式調整
---
 .../ShowEasy/VenueMaintain_UpdService.cs      | 58 ++-----------------
 .../pages/ShowEasy/CityMaintain_Qry.js        | 11 ++--
 .../pages/ShowEasy/CountryMaintain_Qry.js     | 10 ++--
 .../pages/ShowEasy/CountryMaintain_Upd.js     |  9 ++-
 .../pages/ShowEasy/RegionMaintain_Qry.js      |  6 +-
 .../pages/ShowEasy/VenueMaintain_Qry.js       |  6 +-
 .../pages/ShowEasy/VenueMaintain_Upd.js       | 48 +++++++--------
 7 files changed, 47 insertions(+), 101 deletions(-)

diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/VenueMaintain_UpdService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/VenueMaintain_UpdService.cs
index 3ec11dd..4e14de0 100644
--- a/EuroTran/EasyBL.WEBAPP/ShowEasy/VenueMaintain_UpdService.cs
+++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/VenueMaintain_UpdService.cs
@@ -226,8 +226,7 @@ namespace EasyBL.WEBAPP.WSM
                         var sLangType = _fetchString(i_crm, @"LangType");
                         var iExsitChild = db.Queryable<SETB_ORG_Venue>().Count(x => x.OrgID == i_crm.ORIGID && x.VenueID == sVenueID);
                         var oEntity = db.Queryable<SETB_ORG_Venue>().Single(x => x.OrgID == i_crm.ORIGID && x.VenueID == sVenueID && x.LangType == sLangType);
-                        //var iRel = db.Updateable<SETB_ORG_Venue>().Where(x => x.OrgID == i_crm.ORIGID && x.VenueID == iVenueID).ExecuteCommand();
-                        var iRel = db.Updateable<SETB_ORG_Venue>().UpdateColumns(x => new SETB_ORG_Venue { DelStatus = "Y" }).Where(x => x.OrgID == i_crm.ORIGID && x.VenueID == sVenueID && x.LangType == sLangType).ExecuteCommand();
+                        var iRel = db.Updateable<SETB_ORG_Venue>().UpdateColumns(x => new SETB_ORG_Venue { DelStatus = "Y" }).Where(x => x.OrgID == i_crm.ORIGID && x.VenueID == sVenueID).ExecuteCommand();
                         var iRelUp = db.Updateable<SETB_ORG_Venue>()
                                        .UpdateColumns(x => new SETB_ORG_Venue { OrderByValue = x.OrderByValue - 1 })
                                        .Where(x => x.OrgID == oEntity.OrgID && x.OrderByValue > oEntity.OrderByValue)
@@ -272,12 +271,14 @@ namespace EasyBL.WEBAPP.WSM
             {
                 do
                 {
+
+
                     var iVenue = _fetchString(i_crm, @"VenueID");
                     var sCityID = _fetchString(i_crm, @"CityID");
                     var sCountryID = _fetchString(i_crm, @"CountryID");
                     var sVenueName = _fetchString(i_crm, @"VenueName");
                     var sLangType = _fetchString(i_crm, @"LangType");
-                    var iCout = db.Queryable<SETB_ORG_Venue>()
+                   var iCout = db.Queryable<SETB_ORG_Venue>()
                         .Where(x => x.OrgID == i_crm.ORIGID && x.DelStatus == "N")
                         .WhereIF(!string.IsNullOrEmpty(iVenue), x => x.VenueID == iVenue)
                         .WhereIF(!string.IsNullOrEmpty(sCountryID),x => x.CountryID == sCountryID)
@@ -484,56 +485,5 @@ namespace EasyBL.WEBAPP.WSM
 
         #endregion 語言管理 (List 查詢)
 
-        #region 所有區域(多筆)
-
-        /// <summary>
-        /// 所有區域(多筆)
-        /// </summary>
-        /// <param name="i_crm"></param>
-        /// <returns></returns>
-        public ResponseMessage getLocation(RequestMessage i_crm)
-        {
-            ResponseMessage rm = null;
-            string sMsg = null;
-            var db = SugarBase.GetIntance();
-            try
-            {
-                do
-                {
-                    var saRegion = db.Queryable<SETB_SYS_Region>()
-                                            .Where(x => x.OrgID == i_crm.ORIGID && x.Effective == "Y" && x.DelStatus == "N")
-                                            .OrderBy(x => x.OrderByValue)
-                                            .ToList();
-                    var saCountry = db.Queryable<SETB_SYS_Country>()
-                                            .Where(x => x.OrgID == i_crm.ORIGID && x.Effective == "Y" && x.DelStatus == "N")
-                                            .OrderBy(x => x.OrderByValue)
-                                            .ToList();
-                    var saCity = db.Queryable<SETB_UTL_City>()
-                                            .Where(x => x.OrgID == i_crm.ORIGID && x.Effective == "Y" && x.DelStatus == "N")
-                                            .OrderBy(x => x.OrderByValue)
-                                            .ToList();
-                    rm = new SuccessResponseMessage(null, i_crm);
-                    rm.DATA.Add("region", saRegion);
-                    rm.DATA.Add("country", saCountry);
-                    rm.DATA.Add("city", saCity);
-                } while (false);
-            }
-            catch (Exception ex)
-            {
-                sMsg = Util.GetLastExceptionMsg(ex);
-                LogAndSendEmail(sMsg + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(VenueMaintain_UpdService), "", "QueryList(參數類別(多筆))", "", "", "");
-            }
-            finally
-            {
-                if (null != sMsg)
-                {
-                    rm = new ErrorResponseMessage(sMsg, i_crm);
-                }
-            }
-            return rm;
-        }
-
-        #endregion 所有區域(多筆)
-
     }
 }
\ No newline at end of file
diff --git a/EuroTran/WebApp/Scripts/pages/ShowEasy/CityMaintain_Qry.js b/EuroTran/WebApp/Scripts/pages/ShowEasy/CityMaintain_Qry.js
index 206590c..b79aec6 100644
--- a/EuroTran/WebApp/Scripts/pages/ShowEasy/CityMaintain_Qry.js
+++ b/EuroTran/WebApp/Scripts/pages/ShowEasy/CityMaintain_Qry.js
@@ -9,12 +9,11 @@ var fnPageInit = function () {
             //Grid欄位設置(可以是 function)
             gridFields: [
                 { name: "RowIndex", title: 'common.RowNumber', align: 'center', width: 50, sorting: false },
-                { name: "RegionName", title: 'CityMaintain_Qry.RegionName', width: 180 },
-                { name: "CountryName", title: 'CityMaintain_Qry.CountryID', width: 100 },
-                { name: "LangType", title: 'CityMaintain_Qry.LangType', width: 100 },
-                { name: "CityName", title: 'CityMaintain_Qry.CityName', width: 180 },
-                { name: "CityName_EN", title: 'CityMaintain_Qry.CityName_EN', width: 180 },
-                { name: "SlugName", title: 'CityMaintain_Qry.SlugName', width: 180 },
+                { name: "LangType", title: 'CityMaintain_Qry.LangType', width: 166 },
+                { name: "RegionName", title: 'CityMaintain_Qry.RegionName', width: 166 },
+                { name: "CountryName", title: 'CityMaintain_Qry.CountryID', width: 166 },
+                { name: "CityName", title: 'CityMaintain_Qry.CityName', width: 166 },
+                { name: "SlugName", title: 'CityMaintain_Qry.SlugName', width: 166 },
                 {
                     name: "Effective", title: 'common.Status', width: 100, align: 'center', itemTemplate: function (val) {
                         return val === 'Y' ? i18next.t('common.Enable') : i18next.t('common.Disable');
diff --git a/EuroTran/WebApp/Scripts/pages/ShowEasy/CountryMaintain_Qry.js b/EuroTran/WebApp/Scripts/pages/ShowEasy/CountryMaintain_Qry.js
index 9175db5..3a484ed 100644
--- a/EuroTran/WebApp/Scripts/pages/ShowEasy/CountryMaintain_Qry.js
+++ b/EuroTran/WebApp/Scripts/pages/ShowEasy/CountryMaintain_Qry.js
@@ -10,11 +10,11 @@ var fnPageInit = function () {
         //Grid欄位設置(可以是 function)
         gridFields: [
             { name: "RowIndex", title: 'common.RowNumber', align: 'center', width: 50, sorting: false },
-            { name: "LangType", title: 'CountryMaintain_Qry.LangType', width: 180 },
-            { name: "RegionName", title: 'CountryMaintain_Qry.RegionName', width: 180 },
-            { name: "CountryName", title: 'CountryMaintain_Qry.CountryName', width: 180 },
-            { name: "CountrySlug", title: 'CountryMaintain_Qry.CountrySlug', width: 180 },
-            { name: "Country_ENCode", title: 'CountryMaintain_Qry.Country_ENCode', width: 180 },
+            { name: "LangType", title: 'CountryMaintain_Qry.LangType', width: 200 },
+            { name: "RegionName", title: 'CountryMaintain_Qry.RegionName', width: 200 },
+            { name: "CountryName", title: 'CountryMaintain_Qry.CountryName', width: 200 },
+            { name: "CountrySlug", title: 'CountryMaintain_Qry.CountrySlug', width: 200 },
+            { name: "Country_ENCode", title: 'CountryMaintain_Qry.Country_ENCode', width: 200 },
             {
                 name: "Effective", title: 'common.Status', width: 100, align: 'center', itemTemplate: function (val) {
                     return val === 'Y' ? i18next.t('common.Enable') : i18next.t('common.Disable');
diff --git a/EuroTran/WebApp/Scripts/pages/ShowEasy/CountryMaintain_Upd.js b/EuroTran/WebApp/Scripts/pages/ShowEasy/CountryMaintain_Upd.js
index f0356f3..a7dbe95 100644
--- a/EuroTran/WebApp/Scripts/pages/ShowEasy/CountryMaintain_Upd.js
+++ b/EuroTran/WebApp/Scripts/pages/ShowEasy/CountryMaintain_Upd.js
@@ -105,10 +105,10 @@ var fnPageInit = function () {
             };
         },
 
-        getoneback: function (pargs, data) {
-            var ores = data;
-            ores.contactors = $.parsejson(ores.contactors || '[]');
-            disableinput(pargs._form, '#countryid', false);
+        getOneBack: function (pargs, data) {
+            var oRes = data;
+            oRes.Contactors = $.parseJSON(oRes.Contactors || '[]');
+            disableInput(pargs._form, '#CountryID', false);
         },
 
         /**頁面初始化
@@ -139,7 +139,6 @@ var fnPageInit = function () {
                 }
             });
             $('#LangType').select2();
-            console.log("select2")
             $('#RegionID').select2();
         }
     }),
diff --git a/EuroTran/WebApp/Scripts/pages/ShowEasy/RegionMaintain_Qry.js b/EuroTran/WebApp/Scripts/pages/ShowEasy/RegionMaintain_Qry.js
index c4cebb0..cee3ea2 100644
--- a/EuroTran/WebApp/Scripts/pages/ShowEasy/RegionMaintain_Qry.js
+++ b/EuroTran/WebApp/Scripts/pages/ShowEasy/RegionMaintain_Qry.js
@@ -12,9 +12,9 @@ var fnPageInit = function () {
         gridFields: [
             { name: "RowIndex", title: 'common.RowNumber', align: 'center', width: 50, sorting: false },
             //{ name: "RegionID", title: 'RegionMaintain_Qry.RegionID', editing: false, width: 100, sorting: false },
-            { name: "LangType", title: 'RegionMaintain_Qry.LangType', width: 300 },
-            { name: "RegionName", title: 'RegionMaintain_Qry.RegionName', width: 300 },
-            { name: "SlugName", title: 'RegionMaintain_Qry.SlugName', width: 300 },
+            { name: "LangType", title: 'RegionMaintain_Qry.LangType', width: 333 },
+            { name: "RegionName", title: 'RegionMaintain_Qry.RegionName', width: 333 },
+            { name: "SlugName", title: 'RegionMaintain_Qry.SlugName', width: 333 },
             {
                 name: "Effective", title: 'common.Status', width: 100, align: 'center', itemTemplate: function (val) {
                     return val === 'Y' ? i18next.t('common.Enable') : i18next.t('common.Disable');
diff --git a/EuroTran/WebApp/Scripts/pages/ShowEasy/VenueMaintain_Qry.js b/EuroTran/WebApp/Scripts/pages/ShowEasy/VenueMaintain_Qry.js
index 578964c..0f957a2 100644
--- a/EuroTran/WebApp/Scripts/pages/ShowEasy/VenueMaintain_Qry.js
+++ b/EuroTran/WebApp/Scripts/pages/ShowEasy/VenueMaintain_Qry.js
@@ -1,4 +1,8 @@
 'use strict';
+var DEFAULT_LANGUAGEID = "zh-TW";
+
+var LanguageMap = new Map();
+
 var fnPageInit = function () {
     var canDo = new CanDo({
         sortField: 'OrderByValue',
@@ -74,7 +78,6 @@ var fnPageInit = function () {
                                 fnSetRegionIDdrop();
                             }
                         }).select2();
-
                     }
                 });
         },
@@ -133,6 +136,7 @@ var fnPageInit = function () {
                                 fnCountryDrop();           //選取不同的洲別,國家下拉選單也會出現相應的國家,如選擇亞洲,國家下拉選單內都會是亞洲的國家
                             }
                         });
+
                     }
                 });
         };
diff --git a/EuroTran/WebApp/Scripts/pages/ShowEasy/VenueMaintain_Upd.js b/EuroTran/WebApp/Scripts/pages/ShowEasy/VenueMaintain_Upd.js
index f6f70cf..69e1a7e 100644
--- a/EuroTran/WebApp/Scripts/pages/ShowEasy/VenueMaintain_Upd.js
+++ b/EuroTran/WebApp/Scripts/pages/ShowEasy/VenueMaintain_Upd.js
@@ -11,7 +11,7 @@ var fnPageInit = function () {
         paramKeys: ['VenueID', 'LangType'],
 
         /**客製化驗證規則
-         * @param  {Object} pargs CanDo 對象*/
+        // * @param  {Object} pargs CanDo 對象*/
         validRulesCus: function (pargs) {
             $.validator.addMethod("venueidrule", function (value) {
                 var bRetn = true;
@@ -104,11 +104,11 @@ var fnPageInit = function () {
             };
         },
 
-        //getOneBack: function (pargs, data) {
-        //    var oRes = data;
-        //    oRes.Contactors = $.parseJSON(oRes.Contactors || '[]');
-        //    disableInput(pargs._form, '#VenueID', false);
-        //},
+        getoneback: function (pargs, data) {
+            var oRes = data;
+            oRes.Contactors = $.parseJSON(oRes.Contactors || '[]');
+            disableInput(pargs._form, '#VenueID', false);
+        },
 
         /**頁面初始化
          * @param  {Object} pargs CanDo 對象*/
@@ -122,27 +122,27 @@ var fnPageInit = function () {
             $.whenArray(postArray).done(function (res) {
                 if (pargs.action === 'upd' && res[0].RESULT) {
                     var oRes = res[0].DATA.rel;
+
                     pargs._setFormVal(oRes);
+                    //pargs._getPageVal();//緩存頁面值,用於清除
+
                     if (oRes.LangType) {
                         $('#LangType').val(oRes.LangType);
-                        fnSetRegionIDdrop().done(function () {
+                    }
+                    fnSetRegionIDdrop().done(function () {
+                        if (oRes.RegionID) {
                             $('#RegionID').val(oRes.RegionID);
                             fnCountryDrop().done(function () {
                                 $('#CountryID').val(oRes.CountryID);
                                 fnSetCityValueDrop().done(function () {
                                     $('#CityID').val(oRes.CityID);
-                                    fnSetOrderByValueDrop.done(function () {
+                                    fnSetOrderByValueDrop().done(function () {
                                         $('#OrderByValue').val(oRes.OrderByValue);
                                     });
                                 });
                             });
-                        });
-                        pargs._setFormVal(oRes);
-                    }
-                    else {
-                        pargs._setFormVal(oRes);
-                    }
-
+                        }
+                    });
                 }
             });
             $('#LangType').select2();
@@ -161,10 +161,9 @@ var fnPageInit = function () {
                     if (res.RESULT) {
                         var saList = res.DATA.rel;
                         $('#LangType').html(createOptions(saList, 'LanguageID', 'LanguageName', false)).on('change', function () {
-                            if ($('#LangType').val()) {     //監聽RegionID,若RegionID值改變,執行fnSetOrderByValueDrop()
+                            if ($('#LangType').val()) {     
                                 fnSetRegionIDdrop();
                             }
-
                         });
                     }
                 });
@@ -172,7 +171,6 @@ var fnPageInit = function () {
 
         //國家下拉選單  
         fnCountryDrop = function () {
-            if ($('#RegionID').val()) {
                 return g_api.ConnectLite(canDo.ProgramId, "GetCountry", {
                     LangType: $("#LangType").val(),
                     RegionID: $('#RegionID').val()
@@ -190,7 +188,6 @@ var fnPageInit = function () {
                             }
                         }
                     });
-            }
 
         },
 
@@ -219,7 +216,7 @@ var fnPageInit = function () {
             },
                 function (res) {
                     if (res.RESULT) {
-                        var regionList = res.DATA.rel;;
+                        var regionList = res.DATA.rel;
                         $('#RegionID').html(createOptions(regionList, 'RegionID', 'RegionName', false)).on('change', function () {
                             $('#CountryID').empty();
                             $('#CityID').empty();
@@ -230,16 +227,13 @@ var fnPageInit = function () {
         },
 
         fnSetOrderByValueDrop = function () {
-            var data = {
-                LangType: $("LangType").val(),
-                CityID: $("CityID").val()
-            };
-            return g_api.ConnectLite(canDo.ProgramId, canDo._api.getcout, data,
+            return g_api.ConnectLite(canDo.ProgramId, "QueryCout", {
+                LangType: $("#LangType").val(),
+                CityID: $("#CityID").val()
+            },
                 function (res) {
                     if (res.RESULT) {
-
                         var iCount = res.DATA.rel;
-                        console.log("Order:" + iCount);
                         if (canDo.action === 'add') {
                             iCount++;
                         }