diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/CategoryMaintain_QryService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/CategoryMaintain_QryService.cs
index 5b91136..9250377 100644
--- a/EuroTran/EasyBL.WEBAPP/ShowEasy/CategoryMaintain_QryService.cs
+++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/CategoryMaintain_QryService.cs
@@ -365,56 +365,105 @@ namespace EasyBL.WEBAPP.SYS
#endregion 父類別查詢
- #region 類別管理(以ID查詢)
+ #region 類別管理(以ID查詢單筆)
///
- /// 類別管理(以ID查詢)
+ /// 類別管理(以ID查詢單筆)
///
///
///
- public List FindByIDs(RequestMessage i_crm, string sCategoryID, string sLanguage)
+ public SETB_SYS_Category FindOneByIDs(string sCategoryID, string sLanguage)
{
ResponseMessage rm = null;
string sMsg = null;
var db = SugarBase.GetIntance();
- var saCategoryList = new List();
+ var saCategory = new SETB_SYS_Category();
try
{
do
{
- saCategoryList = db.Queryable()
- .Where(x => x.OrgID == i_crm.ORIGID && x.Effective == "Y" && x.DelStatus == "N")
+ saCategory = db.Queryable()
.Where(t1 => t1.CategoryID == sCategoryID)
.Where(t1 => t1.LanguageID == sLanguage)
- .ToList();
+ .Single();
- rm = new SuccessResponseMessage(null, i_crm);
- rm.DATA.Add(BLWording.REL, saCategoryList);
} while (false);
}
catch (Exception ex)
{
sMsg = Util.GetLastExceptionMsg(ex);
- LogAndSendEmail(sMsg + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(CategoryMaintain_QryService), "", "FindByIDs 類別管理(以ID查詢)", "", "", "");
}
finally
{
- if (null != sMsg)
+
+ }
+
+ return saCategory;
+
+ }
+
+ #endregion 類別管理(以ID查詢單筆)
+
+ #region 類別管理(Dictionary 以ID查詢多筆)
+
+ ///
+ /// 類別管理(Dictionary 以ID查詢多筆)
+ ///
+ ///
+ ///
+ public Dictionary FindAllByIDsAsDictionary(string sCategoryType, string sLanguage)
+ {
+
+ ResponseMessage rm = null;
+ string sMsg = null;
+ var db = SugarBase.GetIntance();
+
+ var saCategoryDic = new Dictionary();
+
+ if (string.IsNullOrEmpty(sLanguage)) {
+ sLanguage = WebAppGlobalConstWord.DEFAULT_LANGUAGE;
+ }
+
+ if (string.IsNullOrEmpty(sCategoryType)) {
+ return saCategoryDic;
+ }
+
+ try
+ {
+ do
{
- rm = new ErrorResponseMessage(sMsg, i_crm);
- }
+
+ var saCategoryList = db.Queryable()
+ .Where(t1 => t1.CategoryType == sCategoryType)
+ .Where(t1 => t1.LanguageID == sLanguage)
+ .ToList();
+
+ foreach (var Category in saCategoryList) {
+ saCategoryDic[Category.CategoryID] = Category;
+ }
+
+ } while (false);
+ }
+ catch (Exception ex)
+ {
+ sMsg = Util.GetLastExceptionMsg(ex);
+
+ }
+ finally
+ {
+
}
- return saCategoryList;
+ return saCategoryDic;
}
- #endregion 類別管理(以ID查詢)
+ #endregion 類別管理(Dictionary 以ID查詢多筆)
#region 類別管理(List 查詢所有子類別)
diff --git a/EuroTran/Entity/ShowEasyDtos/CategoryDTO.cs b/EuroTran/Entity/ShowEasyDtos/CategoryDTO.cs
index d3e79d6..11a3ed0 100644
--- a/EuroTran/Entity/ShowEasyDtos/CategoryDTO.cs
+++ b/EuroTran/Entity/ShowEasyDtos/CategoryDTO.cs
@@ -1,4 +1,5 @@
-using System;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -13,11 +14,6 @@ namespace Entity.ShowEasyDtos
///
public string CategoryID { get; set; }
- ///
- ///
- ///
- //public String ParentIDs { get; set; }
-
///
///
///
@@ -26,17 +22,11 @@ namespace Entity.ShowEasyDtos
///
///
///
- //public string CategoryNickname { get; set; }
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public List SubCategoryList = new List();
- ///
- ///
- ///
- //public string CategoryType { get; set; }
-
- ///
- ///
- ///
- //public string IsMainCategory { get; set; }
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ public Dictionary SubCategoryDic = new Dictionary();
}
}