コード例 #1
0
        public override bool Update(TransactionManager transactionManager, MaterialPurchas entity)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.MaterialPurchas_Update", this._useStoredProcedure);

            database.AddInParameter(command, "@MaterialPurchasID", DbType.Int32, entity.MaterialPurchasID);
            database.AddInParameter(command, "@MaterialPurchasCode", DbType.AnsiString, entity.MaterialPurchasCode);
            database.AddInParameter(command, "@PurchasUnitCode", DbType.AnsiString, entity.PurchasUnitCode);
            database.AddInParameter(command, "@PurchasDate", DbType.DateTime, entity.PurchasDate.HasValue ? ((object)entity.PurchasDate) : ((object)DBNull.Value));
            database.AddInParameter(command, "@ProjectCode", DbType.AnsiString, entity.ProjectCode);
            database.AddInParameter(command, "@Title", DbType.AnsiString, entity.Title);
            database.AddInParameter(command, "@Description", DbType.AnsiString, entity.Description);
            database.AddInParameter(command, "@FollowUserCode", DbType.AnsiString, entity.FollowUserCode);
            database.AddInParameter(command, "@Status", DbType.AnsiString, entity.Status);
            int num = 0;

            if (transactionManager != null)
            {
                num = Utility.ExecuteNonQuery(transactionManager, command);
            }
            else
            {
                num = Utility.ExecuteNonQuery(database, command);
            }
            if (DataRepository.Provider.EnableEntityTracking)
            {
                EntityManager.StopTracking(entity.EntityTrackingKey);
            }
            entity.AcceptChanges();
            return(Convert.ToBoolean(num));
        }
コード例 #2
0
        public virtual MaterialPurchas Copy()
        {
            MaterialPurchas purchas = new MaterialPurchas();

            purchas.MaterialPurchasID   = this.MaterialPurchasID;
            purchas.MaterialPurchasCode = this.MaterialPurchasCode;
            purchas.PurchasUnitCode     = this.PurchasUnitCode;
            purchas.PurchasDate         = this.PurchasDate;
            purchas.ProjectCode         = this.ProjectCode;
            purchas.Title          = this.Title;
            purchas.Description    = this.Description;
            purchas.FollowUserCode = this.FollowUserCode;
            purchas.Status         = this.Status;
            purchas.AcceptChanges();
            return(purchas);
        }