Browse Source

[WHAT] 會員 Booking Catgory API [WHY] 開發 ShowEasy API

Dev
Janie 2 years ago
parent
commit
1a8b9fc22a
  1. 89
      EuroTran/EasyBL.WEBAPP/ShowEasy/BookingService.cs
  2. 47
      EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_QryService.cs

89
EuroTran/EasyBL.WEBAPP/ShowEasy/BookingService.cs

@ -63,10 +63,10 @@ namespace EasyBL.WEBAPP.SYS
#endregion 類別選單(List 類別選單查詢)
#region 類別選單(List 類別選單查詢)
#region 子類別查詢API (服務有包含該類別才列出)
/// <summary>
/// 類別選單(List 類別選單查詢)
/// 子類別查詢API (服務有包含該類別才列出)
/// </summary>
/// <returns></returns>
///
@ -79,64 +79,67 @@ namespace EasyBL.WEBAPP.SYS
{
do
{
//Alina:有錯誤先注釋掉
////用Account取Member的MemberID
//MemberMaintain_QryService member_qry = new MemberMaintain_QryService();
//var member = member_qry.QueryOneByAccount(Account);
//用Account取Member的MemberID
MemberMaintain_QryService member_qry = new MemberMaintain_QryService();
var member = member_qry.QueryOneByAccount(Account);
////取Member所有的訂單
//BookingMaintain_QryService booking_qry = new BookingMaintain_QryService();
//取Member所有的訂單
BookingMaintain_QryService booking_qry = new BookingMaintain_QryService();
//var allBooking = booking_qry.FindAllByIDsAsDictionary(member.MemberID);
var allBooking = booking_qry.FindAllByIDsAsDictionary(member.MemberID);
//var allBookingServiceList = booking_qry.FindAllByIDsAsDictionary(member.MemberID).Values.ToList().Where(w => !string.IsNullOrEmpty(w.ServiceID)).Select(s => s.ServiceID).ToList();
var allBookingServiceList = booking_qry.FindAllByIDsAsDictionary(member.MemberID).Values.ToList().Where(w => !string.IsNullOrEmpty(w.ServiceID)).Select(s => s.ServiceID).ToList();
////取所有category
//ServiceSubCategoryMaintain_QryService serviceSub_qry = new ServiceSubCategoryMaintain_QryService();
//var subCategory = serviceSub_qry.FindAllByIDsAsDictionary("", LangType);
//取所有category
ServiceSubCategoryMaintain_QryService serviceSub_qry = new ServiceSubCategoryMaintain_QryService();
var subCategory = serviceSub_qry.FindAllByIDsAsDictionary("", LangType);
////取得所有OnSiteService
//ONSiteMaintain_QryService onSiteService_qry = new ONSiteMaintain_QryService();
//var allService = onSiteService_qry.FindAllByIDsAsDictionary("");
//取得所有OnSiteService
ONSiteMaintain_QryService onSiteService_qry = new ONSiteMaintain_QryService();
var allService = onSiteService_qry.FindAllByIDsAsDictionary("");
//var ServiceIDSet = new HashSet<string>(); //去重複值
//var CategoryDic = new Dictionary<string, CategoryDTO>();
var ServiceIDSet = new HashSet<string>(); //去重複值
var CategoryDic = new Dictionary<string, CategoryDTO>();
//foreach (var ServiceID in allBookingServiceList) {
foreach (var ServiceID in allBookingServiceList)
{
// SETB_PDT_ONSiteBaseInfo Service = new SETB_PDT_ONSiteBaseInfo();
SETB_PDT_ONSiteBaseInfo Service = new SETB_PDT_ONSiteBaseInfo();
// if (allService.ContainsKey(ServiceID)) {
// Service = allService[ServiceID];
// }
if (allService.ContainsKey(ServiceID))
{
Service = allService[ServiceID];
}
// var SubCategoryIDList = new List<string>();
var SubCategoryIDList = new List<string>();
// if (!string.IsNullOrEmpty(Service.SubCategoryID)) {
// SubCategoryIDList = JsonConvert.DeserializeObject<List<string>>(Service.SubCategoryID);
// }
if (!string.IsNullOrEmpty(Service.SubCategoryID))
{
SubCategoryIDList = JsonConvert.DeserializeObject<List<string>>(Service.SubCategoryID);
}
// foreach(var subCategoryID in SubCategoryIDList)
// {
foreach (var subCategoryID in SubCategoryIDList)
{
// SETB_SYS_Category category = new SETB_SYS_Category();
SETB_SYS_Category category = new SETB_SYS_Category();
// if (subCategory.ContainsKey(subCategoryID)) {
// category = subCategory[subCategoryID]; //用subCategoryID在subCategory內找
// }
if (subCategory.ContainsKey(subCategoryID))
{
category = subCategory[subCategoryID]; //用subCategoryID在subCategory內找
}
// CategoryDTO categoryDTO = new CategoryDTO();
CategoryDTO categoryDTO = new CategoryDTO();
// categoryDTO.CategoryID = category.CategoryID;
// categoryDTO.CategoryName = category.CategoryName;
categoryDTO.CategoryID = category.CategoryID;
categoryDTO.CategoryName = category.CategoryName;
// CategoryDic[categoryDTO.CategoryID] = categoryDTO; //把categoryDTO.CategoryID當作key,把value(categoryDTO)存進CategoryDic
// //存到Dictionary內會去重複值。不用額外用HashSet
// }
//}
CategoryDic[categoryDTO.CategoryID] = categoryDTO; //把categoryDTO.CategoryID當作key,把value(categoryDTO)存進CategoryDic
//存到Dictionary內會去重複值。不用額外用HashSet
}
}
//srm = new SuccessResponseMessage(null, null);
//srm.DATA.Add(BLWording.REL, CategoryDic.Values.ToList());
srm = new SuccessResponseMessage(null, null);
srm.DATA.Add(BLWording.REL, CategoryDic.Values.ToList());
} while (false);
}
@ -155,7 +158,7 @@ namespace EasyBL.WEBAPP.SYS
}
#endregion 類別選單(List 類別選單查詢)
#endregion 子類別查詢API (服務有包含該類別才列出)
}
}

47
EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_QryService.cs

@ -1942,5 +1942,52 @@ namespace EasyBL.WEBAPP.ShowEasy
}
//QueryALLOnSiteServiceAsDic
public Dictionary<string, SETB_PDT_ONSiteBaseInfo> FindAllByIDsAsDictionary(string ServiceID)
{
string sMsg = null;
var db = SugarBase.GetIntance();
Dictionary<string, SETB_PDT_ONSiteBaseInfo> saServiceDic = new Dictionary<string, SETB_PDT_ONSiteBaseInfo>();
try
{
do
{
var saServiceList = db.Queryable<SETB_PDT_ONSiteBaseInfo>()
.Where(t1 => t1.Effective == "Y")
.WhereIF(!string.IsNullOrEmpty(ServiceID), t1 => t1.ServiceID == ServiceID)
.Select((t1) => new SETB_PDT_ONSiteBaseInfo
{
ServiceID = SqlFunc.GetSelfAndAutoFill(t1.ServiceID)
})
.ToList();
foreach (var service in saServiceList)
{
saServiceDic[service.ServiceID] = service;
}
return saServiceDic;
} while (false);
}
catch (Exception ex)
{
sMsg = Util.GetLastExceptionMsg(ex);
}
return saServiceDic;
}
}
}
Loading…
Cancel
Save