Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
            }
        }