public static void SqlDelete(int id) { var curr = LemHeader.GetLogHeader(id); if (curr.MatchId != -1) { string sql = $"update LemHeader set deleted=1 where id={id}"; MobileCommon.ExecuteNonQuery(sql); DeleteHistory.SqlInsert(DeleteHistory.LemHeader, curr.MatchId); var labourList = LabourTimeEntry.GetLabourEntryList(id); labourList.ForEach(x => LabourTimeEntry.DeleteEntry(x.Id)); var equipList = EquipTimeEntry.GetEquipEntryList(id); equipList.ForEach(x => EquipTimeEntry.DeleteEntry(x.Id)); var attachList = Attachment.GetAttachList(Attachment.LemHeaderId, id); attachList.ForEach(x => Attachment.DeleteAttach(DeleteHistory.LemHeaderAttach, x.RepositoryId)); } else { SqlForceDelete(id); } }
public static void DeleteEntry(int id) { LabourTimeEntry curr = LabourTimeEntry.GetLabourEntry(id); if (curr.MatchId != -1) { MobileCommon.ExecuteNonQuery($"update LabourTimeEntry set deleted=1 where id={id}"); DeleteHistory.SqlInsert(DeleteHistory.LabourTimeEntry, curr.MatchId); } else { SqlForceDelete(id); } }
public static void DeleteEntry(int id) { var curr = EquipTimeEntry.GetEquipEntry(id); if (curr.MatchId != -1) { MobileCommon.ExecuteNonQuery($"update EquipTimeEntry set Deleted=1 where id={id}"); DeleteHistory.SqlInsert(DeleteHistory.EquipTimeEntry, curr.MatchId); } else { SqlForceDelete(id); } }
public override void CommitReceive() { if (new EnumTableSyncStatus[] { EnumTableSyncStatus.Receiving, EnumTableSyncStatus.CompleteReceive }.Contains(SyncInfo.Status)) { DataTable table = MobileCommon.ExecuteDataAdapter($"select * from DeleteHistory where CompanyId={CompanyId} and SyncStatus='{EnumRecordSyncStatus.Receiving}'"); List <DeleteHistory> list = table.Select().Select(r => new DeleteHistory(r)).ToList(); list.ForEach(x => x.SqlExecute()); DeleteHistory.UndeleteAll(CompanyId); MobileCommon.ExecuteNonQuery($"delete DeleteHistory where CompanyId={CompanyId} and SyncStatus='{EnumRecordSyncStatus.Receiving}'"); UpdateStatus(EnumTableSyncStatus.ReadyToSync); } }
public static void SqlUpdateLemAP(int id, int?logHeaderId) { if (logHeaderId == null) { int matchId = (int)MobileCommon.ExecuteScalar($"select isnull(matchid, 0) from LemAP where id={id} and SyncStatus='{EnumRecordSyncStatus.Submitted}'"); if (matchId != 0) { DeleteHistory.SqlInsert(DeleteHistory.LemAPUnselect, matchId); } } string sql = $"update LemAP set LogHeaderId={StrEx.ValueOrNull(logHeaderId)}, SyncStatus='{EnumRecordSyncStatus.NoSubmit}' where Id={id}"; MobileCommon.ExecuteNonQuery(sql); }
public static void DeleteAttach(string tableName, int repoId) { string sql = $"select matchId from CFS_FileLink where FileRepository_ID={repoId}"; int? matchId = ConvertEx.ToNullable <int>(MobileCommon.ExecuteScalar(sql)); if (matchId != null) { MobileCommon.ExecuteNonQuery($"update CFS_FileLink set TableDotField=TableDotField+'_DEL' where FileRepository_ID={repoId}"); DeleteHistory.SqlInsert(tableName, matchId.Value); } else { SqlForceDelete(repoId); } }