private DbDeleteStatement GetQuery_DeleteQuery(RecurringItemSaleLine _obj)
        {
            DbDeleteStatement clause = DbMgr.CreateDeleteClause();

            clause.DeleteFrom("RecurringItemSaleLines").Criteria.IsEqual("RecurringItemSaleLines", "RecurringItemSaleLineID", _obj.RecurringItemSaleLineID);

            return(clause);
        }
        protected override OpResult _Delete(RecurringItemSaleLine _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyDeleteAction(OpResult.ResultStatus.ObjectIsNull, _obj, "RecurringItemSaleLine object cannot be deleted as it is null"));
            }

            if (Exists(_obj))
            {
                ExecuteNonQuery(GetQuery_DeleteQuery(_obj));
                return(OpResult.NotifyDeleteAction(OpResult.ResultStatus.ExistsAndDeleted, _obj));
            }

            return(OpResult.NotifyDeleteAction(OpResult.ResultStatus.NotExists, _obj, "RecurringItemSaleLine object cannot be deleted as it does not exist"));;
        }
        protected override OpResult _Store(RecurringItemSaleLine _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "RecurringItemSaleLine object cannot be created as it is null"));
            }

            if (Exists(_obj))
            {
                ExecuteNonQuery(GetQuery_UpdateQuery(_obj));
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Updated, _obj));
            }

            ExecuteNonQuery(GetQuery_InsertQuery(_obj));
            if (_obj.RecurringItemSaleLineID == null)
            {
                _obj.RecurringItemSaleLineID = DbMgr.GetLastInsertID();
            }
            _obj.FromDb = true;
            return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj));
        }
 private DbUpdateStatement GetQuery_UpdateQuery(RecurringItemSaleLine _obj)
 {
     return(DbMgr.CreateUpdateClause("RecurringItemSaleLines", GetFields(_obj), "RecurringItemSaleLineID", _obj.RecurringItemSaleLineID));
 }
        private DbInsertStatement GetQuery_InsertQuery(RecurringItemSaleLine _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

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