protected override OpResult _Store(RecurringGeneralJournal _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "RecurringGeneralJournal object cannot be created as it is null"));
            }

            if (Exists(_obj))
            {
                ExecuteNonQuery(GetQuery_UpdateQuery(_obj));
                foreach (RecurringGeneralJournalLine line in _obj.RecurringGeneralJournalLines)
                {
                    RepositoryMgr.RecurringGeneralJournalLineMgr.Store(line);
                }
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Updated, _obj));
            }

            ExecuteNonQuery(GetQuery_InsertQuery(_obj));
            if (_obj.RecurringGeneralJournalID == null)
            {
                _obj.RecurringGeneralJournalID = DbMgr.GetLastInsertID();
            }
            foreach (RecurringGeneralJournalLine line in _obj.RecurringGeneralJournalLines)
            {
                RepositoryMgr.RecurringGeneralJournalLineMgr.Store(line);
            }
            _obj.FromDb = true;
            return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj));
        }
        private DbDeleteStatement GetQuery_DeleteQuery(RecurringGeneralJournal _obj)
        {
            DbDeleteStatement clause = DbMgr.CreateDeleteClause();

            clause.DeleteFrom("RecurringGeneralJournals").Criteria.IsEqual("RecurringGeneralJournals", "RecurringGeneralJournalID", _obj.RecurringGeneralJournalID);

            return(clause);
        }
 protected override OpResult _Delete(RecurringGeneralJournal _obj)
 {
     if (Exists(_obj))
     {
         ExecuteNonQuery(GetQuery_DeleteQuery(_obj));
         return(OpResult.NotifyDeleteAction(OpResult.ResultStatus.ExistsAndDeleted, _obj));
     }
     return(OpResult.NotifyDeleteAction(OpResult.ResultStatus.NotExists, _obj, "RecurringGeneralJournal object cannot be deleted as it does not exist"));
 }
 private DbUpdateStatement GetQuery_UpdateQuery(RecurringGeneralJournal _obj)
 {
     return(DbMgr.CreateUpdateClause("RecurringGeneralJournals", GetFields(_obj), "RecurringGeneralJournalID", _obj.RecurringGeneralJournalID));
 }
        private DbInsertStatement GetQuery_InsertQuery(RecurringGeneralJournal _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

            return(DbMgr.CreateInsertClause("RecurringGeneralJournals", fields));
        }