@ -60,7 +60,23 @@ namespace Tiobon.Core.Services
var StaffGroupDetail = await _ StaffGroupDetailServices . Query ( x = > x . StaffGroupID = = body . id ) ;
var StaffGroupDetail = await _ StaffGroupDetailServices . Query ( x = > x . StaffGroupID = = body . id ) ;
result . result . DT_TableDataT1 [ 0 ] . StaffGroupDetail = StaffGroupDetail . OrderBy ( x = > x . SortNo ) . ToList ( ) ;
result . result . DT_TableDataT1 [ 0 ] . StaffGroupDetail = StaffGroupDetail . OrderBy ( x = > x . SortNo ) . ToList ( ) ;
result . result . DT_TableDataT1 [ 0 ] . StaffGroupDetail . ForEach ( ( x ) = >
{
if ( x . FieldValue ! = null )
{
if ( JsonHelper . IsJson ( x . FieldValue . ToString ( ) ) )
{
try
{
x . FieldValue = JsonHelper . JsonToObj < List < int > > ( x . FieldValue . ToString ( ) ) ;
}
catch ( Exception )
{
x . FieldValue = JsonHelper . JsonToObj < List < string > > ( x . FieldValue . ToString ( ) ) ;
}
}
}
} ) ;
if ( body . doType = = "Copy" )
if ( body . doType = = "Copy" )
{
{
result . result . DT_TableDataT1 [ 0 ] . StaffGroupNo = null ;
result . result . DT_TableDataT1 [ 0 ] . StaffGroupNo = null ;
@ -72,17 +88,19 @@ namespace Tiobon.Core.Services
{
{
var result = await base . QueryFilterPage ( filter , condition , IsEnable ) ;
var result = await base . QueryFilterPage ( filter , condition , IsEnable ) ;
//var a = await _StaffGroupDetailServices.Query();
//result.result.DT_TableDataT1.ForEach(async x =>
result . result . DT_TableDataT1 . ForEach ( async x = >
//{
{
// x.DetailInfo = (await _StaffGroupDetailServices.Query(a => a.StaffGroupID == x.Id))
x . DetailInfo = Db . Ado . SqlQuerySingle < string > ( $ @ "select stuff((select distinct ',' + (select top 1 dbo.FLangKeyToValue(MKey,1,StaffInfoColumnName) from Ghra_StaffInfoColumn where IsEnable=1 and StaffInfoGroupId = 1 and IsRelease = 1 and StaffInfoColumnNo=a.StaffField)
// .Select(a => a.StaffField).ToString();
from Ghra_StaffGroupDetail a
//});
where StaffGroupID = { x . Id }
for XML path ( ' ' ) , type ) . value ( '.' , ' nvarchar ( max ) ' ) , 1 , 1 , ' ' ) ");
} ) ;
return result ;
return result ;
}
}
public async Task < ServiceResult < object > > GetStaffInfoColumnData ( )
public async Task < ServiceResult < object > > GetStaffInfoColumnData ( )
{
{
string sql = @ $ "select StaffInfoColumnNo,
string sql = @ $ "select StaffInfoColumnNo,
dbo . FLangKeyToValue ( MKey , 1 , StaffInfoColumnName ) StaffInfoColumnName ,
dbo . FLangKeyToValue ( MKey , 1 , StaffInfoColumnName ) StaffInfoColumnName ,
@ -92,7 +110,7 @@ namespace Tiobon.Core.Services
else ' ' end dataSourceType ,
else ' ' end dataSourceType ,
dbo . FS_GetdataSourceBySet ( ' ' , DataSourceType , DataSource ) dataSource ,
dbo . FS_GetdataSourceBySet ( ' ' , DataSourceType , DataSource ) dataSource ,
case when ColumnType in ( ' OrgTreeSelect ',' ApiSelect ',' StaffSelect ' ) then 1
case when ColumnType in ( ' OrgTreeSelect ',' ApiSelect ',' StaffSelect ' ) then 1
else 0 end multipleSelect ,
else 0 end multipleSelectInt ,
( select ParaDetailNo operatorNo , ParaDetailName operatorDesc , SqlFunction operatorIcon , SortNo
( select ParaDetailNo operatorNo , ParaDetailName operatorDesc , SqlFunction operatorIcon , SortNo
from Ghrs_ParaDetail where IsEnable = 1
from Ghrs_ParaDetail where IsEnable = 1
and ParaDetailNo in ( select value from dbo . Fs1_GHR30_SplitString ( case when ColumnType in ( ' OrgTreeSelect ',' ApiSelect ',' StaffSelect ' )
and ParaDetailNo in ( select value from dbo . Fs1_GHR30_SplitString ( case when ColumnType in ( ' OrgTreeSelect ',' ApiSelect ',' StaffSelect ' )
@ -117,7 +135,7 @@ namespace Tiobon.Core.Services
and StaffInfoColumnNo ! = ' AttachmentIDs ' ";
and StaffInfoColumnNo ! = ' AttachmentIDs ' ";
var result = Db . Ado . SqlQuery < StaffInfoColumn > ( sql ) ;
var result = Db . Ado . SqlQuery < StaffInfoColumn > ( sql ) ;
result . ForEach ( x = >
result . ForEach ( x = >
{
{
x . operatorData = JsonConvert . DeserializeObject < List < OperatorData > > ( x . OperatorDataStr ) ;
x . operatorData = JsonConvert . DeserializeObject < List < OperatorData > > ( x . OperatorDataStr ) ;
} ) ;
} ) ;
@ -126,13 +144,14 @@ namespace Tiobon.Core.Services
public class StaffInfoColumn ( )
public class StaffInfoColumn ( )
{
{
public string StaffInfoColumnNo { get ; set ; }
public string StaffInfoColumnNo { get ; set ; }
public string StaffInfoColumnName { get ; set ; }
public string StaffInfoColumnName { get ; set ; }
public string elementType { get ; set ; }
public string elementType { get ; set ; }
public string dataType { get ; set ; }
public string dataSourceType { get ; set ; }
public string dataSourceType { get ; set ; }
public string dataSource { get ; set ; }
public string dataSource { get ; set ; }
public int multipleSelect { get ; set ; }
public int multipleSelectInt { get ; set ; }
public bool multipleSelect = > multipleSelectInt = = 1 ? true : false ;
public string OperatorDataStr { get ; set ; }
public string OperatorDataStr { get ; set ; }
public List < OperatorData > operatorData { get ; set ; }
public List < OperatorData > operatorData { get ; set ; }
}
}