private void mDelete(Guid iDSubject, bool loadList = true) { if (mValidateDelete(iDSubject)) { DAL.GlobalCore.TransactionMgr tx = DAL.GlobalCore.TransactionMgr.ThreadTransactionMgr(); try { tx.BeginTransaction(); MediaSubjects mediaSubjects = new MediaSubjects(); mediaSubjects.LoadByIDSubject(iDSubject); mediaSubjects.DeleteAll(); mediaSubjects.Save(); SubjectPlugins subjectPlugin = new SubjectPlugins(); subjectPlugin.LoadByIDSubject(iDSubject); subjectPlugin.DeleteAll(); subjectPlugin.Save(); GalleryPlugins GalleryPlugins = new GalleryPlugins(); GalleryPlugins.LoadByIDSubject(iDSubject); GalleryPlugins.DeleteAll(); GalleryPlugins.Save(); Subjects subject = new Subjects(iDSubject); subject.MarkAsDeleted(false); subject.Save(); tx.CommitTransaction(); if (loadList) { pMessage.Clear(); pMessage.Add(Farschidus.Translator.AppTranslate["general.message.deleted"], Farschidus.Web.UI.Message.MessageTypes.Success); mShowMessage(pMessage); mLoadList(); } } catch (Exception ex) { tx.RollbackTransaction(); pMessage.Clear(); pMessage.Add(ex.Message, Farschidus.Web.UI.Message.MessageTypes.Error); } } mShowMessage(pMessage); }
private void mDelete(Guid iDUser) { DAL.GlobalCore.TransactionMgr tx = DAL.GlobalCore.TransactionMgr.ThreadTransactionMgr(); try { Subjects subjects = new Subjects(); subjects.LoadBySubjectAliasAndIDSubjectType(pIDUser.Value.ToString(), (byte)SubjectTypes.Enum.userPage); if (subjects.RowCount > 0) { tx.BeginTransaction(); MediaSubjects mediaSubjects = new MediaSubjects(); mediaSubjects.LoadByIDSubject(subjects.pIDSubject); mediaSubjects.DeleteAll(); mediaSubjects.Save(); SubjectPlugins subjectPlugin = new SubjectPlugins(); subjectPlugin.LoadByIDSubject(subjects.pIDSubject); subjectPlugin.DeleteAll(); subjectPlugin.Save(); GalleryPlugins GalleryPlugins = new GalleryPlugins(); GalleryPlugins.LoadByIDSubject(subjects.pIDSubject); GalleryPlugins.DeleteAll(); GalleryPlugins.Save(); Subjects subject = new Subjects(subjects.pIDSubject); subject.MarkAsDeleted(false); subject.Save(); tx.CommitTransaction(); pMessage.Clear(); pMessage.Add(Farschidus.Translator.AppTranslate["general.message.deleted"], Farschidus.Web.UI.Message.MessageTypes.Success); mShowMessage(pMessage); mLoadList(); } } catch (Exception ex) { tx.RollbackTransaction(); pMessage.Clear(); pMessage.Add(ex.Message, Farschidus.Web.UI.Message.MessageTypes.Error); mShowMessage(pMessage); } }