Ejemplo n.º 1
0
        private DbDeleteStatement GetQuery_DeleteQuery(RecurringSaleLine _obj)
        {
            DbDeleteStatement clause = DbMgr.CreateDeleteClause();

            clause
            .DeleteFrom("RecurringSaleLines")
            .Criteria
            .IsEqual("RecurringSaleLines", "RecurringSaleLineID", _obj.RecurringSaleLineID);
            return(clause);
        }
Ejemplo n.º 2
0
        private DbUpdateStatement GetQuery_UpdateQuery(RecurringSaleLine _obj)
        {
            DbUpdateStatement clause = DbMgr.CreateUpdateClause();

            clause
            .UpdateColumns(GetFields(_obj))
            .From("RecurringSaleLines")
            .Criteria
            .IsEqual("RecurringSaleLines", "RecurringSaleLineID", _obj.RecurringSaleLineID);
            return(clause);
        }
Ejemplo n.º 3
0
        private DbInsertStatement GetQuery_InsertQuery(RecurringSaleLine _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

            DbInsertStatement clause = DbMgr.CreateInsertClause();

            clause
            .InsertColumns(fields)
            .Into("RecurringSaleLines");

            return(clause);
        }
Ejemplo n.º 4
0
        protected override OpResult _Delete(RecurringSaleLine _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyDeleteAction(OpResult.ResultStatus.ObjectIsNull, _obj, "RecurringSaleLine 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, "RecurringSaleLine object cannot be deleted as it is null"));
        }
Ejemplo n.º 5
0
        protected override OpResult _Store(RecurringSaleLine _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "RecurringSaleLine 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.RecurringSaleLineID == null)
            {
                _obj.RecurringSaleLineID = DbMgr.GetLastInsertID();
            }
            _obj.FromDb = true;
            return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj));
        }