public List <Attachment> GetSendList() { List <SyncCoreMatch> matchList = SyncCoreMatch.GetMatchList("LemHeader"); string linkIds = StrEx.GetIdListText(matchList.Select(x => x.SourceId).ToList()); string sql = $"select r.*, l.CompanyId, l.MatchId, l.ContextItem_ID, l.TableDotField, l.IdValue, l.Comment from CFS_FileRepository r join CFS_FileLink l on l.FileRepository_ID = r.ID " + $"where TableDotField='{Attachment.LemHeaderId}' and IdValue in ({linkIds}) and (SyncStatus='{EnumRecordSyncStatus.NoSubmit}' or SyncStatus is null)"; DataTable table = MobileCommon.ExecuteDataAdapter(sql); List <Attachment> listLem = table.Select().Select(r => new Attachment(r)).ToList(); listLem.ForEach(x => x.LinkMatchId = matchList.Single(m => m.SourceId == x.LinkMatchId).MatchId); matchList = SyncCoreMatch.GetMatchList("FieldPO"); linkIds = StrEx.GetIdListText(matchList.Select(x => x.SourceId).ToList()); sql = $"select r.*, l.CompanyId, l.MatchId, l.ContextItem_ID, l.TableDotField, l.IdValue, l.Comment from CFS_FileRepository r join CFS_FileLink l on l.FileRepository_ID = r.ID " + $"where TableDotField='{Attachment.FieldPOId}' and IdValue in ({linkIds}) and (SyncStatus='{EnumRecordSyncStatus.NoSubmit}' or SyncStatus is null)"; table = MobileCommon.ExecuteDataAdapter(sql); List <Attachment> listPo = table.Select().Select(r => new Attachment(r)).ToList(); listPo.ForEach(x => x.LinkMatchId = matchList.Single(m => m.SourceId == x.LinkMatchId).MatchId); listLem.AddRange(listPo); return(listLem); }
public List <EquipTimeEntry> GetSendList() // must after sent headers { List <SyncCoreMatch> matchList = SyncCoreMatch.GetMatchList("LemHeader"); string headerIds = StrEx.GetIdListText(matchList.Select(x => x.SourceId).ToList()); string sql = $"select * from EquipTimeEntry where LogHeaderId in ({headerIds}) and (SyncStatus='{EnumRecordSyncStatus.NoSubmit}' or SyncStatus is null) and Deleted=0"; DataTable table = MobileCommon.ExecuteDataAdapter(sql); List <EquipTimeEntry> list = table.Select().Select(r => new EquipTimeEntry(r)).ToList(); list.ForEach(x => x.HeaderId = matchList.Single(m => m.SourceId == x.HeaderId).MatchId); return(list); }
public List <LemAP> GetSendList() { new List <LemAP>(); List <SyncCoreMatch> matchList = SyncCoreMatch.GetMatchList("LemHeader"); string headerIds = StrEx.GetIdListText(matchList.Select(x => x.SourceId).ToList()); string sql = $"select * from LemAP where companyId={CompanyId} and LogHeaderId in ({headerIds}) and (SyncStatus='{EnumRecordSyncStatus.NoSubmit}' or SyncStatus is null)"; DataTable table = MobileCommon.ExecuteDataAdapter(sql); List <LemAP> list = table.Select().Select(r => new LemAP(r)).ToList(); list.ForEach(x => x.HeaderId = matchList.Single(m => m.SourceId == x.HeaderId).MatchId); list.ForEach(x => x.GetDetailList()); list.ForEach(x => x.DetailList.ForEach(d => d.LemAPId = x.MatchId)); return(list); }