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

            clause.DeleteFrom("RecurringMiscSaleLines").Criteria.IsEqual("RecurringMiscSaleLines", "RecurringMiscSaleLineID", _obj.RecurringMiscSaleLineID);

            return(clause);
        }
 protected override OpResult _Delete(RecurringMiscSaleLine _obj)
 {
     if (_obj == null)
     {
         return(OpResult.NotifyDeleteAction(OpResult.ResultStatus.ObjectIsNull, _obj, "RecurringMiscSaleLine 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, "RecurringMiscSaleLine object cannot be deleted as it does not exist"));;
 }
        protected override OpResult _Store(RecurringMiscSaleLine _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "RecurringMiscSaleLine 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.RecurringMiscSaleLineID == null)
            {
                _obj.RecurringMiscSaleLineID = DbMgr.GetLastInsertID();
            }
            _obj.FromDb = true;
            return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj));
        }
 private DbUpdateStatement GetQuery_UpdateQuery(RecurringMiscSaleLine _obj)
 {
     return(DbMgr.CreateUpdateClause("RecurringMiscSaleLines", GetFields(_obj), "RecurringMiscSaleLineID", _obj.RecurringMiscSaleLineID));
 }
        private DbInsertStatement GetQuery_InsertQuery(RecurringMiscSaleLine _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

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