Esempio n. 1
0
        public override bool Update(TransactionManager transactionManager, Material entity)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Material_Update", this._useStoredProcedure);

            database.AddInParameter(command, "@MaterialCode", DbType.Int32, entity.MaterialCode);
            database.AddInParameter(command, "@OriginalMaterialCode", DbType.Int32, entity.OriginalMaterialCode);
            database.AddInParameter(command, "@MaterialName", DbType.AnsiString, entity.MaterialName);
            database.AddInParameter(command, "@GroupCode", DbType.AnsiString, entity.GroupCode);
            database.AddInParameter(command, "@Spec", DbType.AnsiString, entity.Spec);
            database.AddInParameter(command, "@Unit", DbType.AnsiString, entity.Unit);
            database.AddInParameter(command, "@StandardPrice", DbType.Decimal, entity.StandardPrice.HasValue ? ((object)entity.StandardPrice) : ((object)DBNull.Value));
            database.AddInParameter(command, "@InputPerson", DbType.AnsiString, entity.InputPerson);
            database.AddInParameter(command, "@InputDate", DbType.DateTime, entity.InputDate.HasValue ? ((object)entity.InputDate) : ((object)DBNull.Value));
            database.AddInParameter(command, "@Remark", DbType.AnsiString, entity.Remark);
            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.OriginalMaterialCode = entity.MaterialCode;
            entity.AcceptChanges();
            return(Convert.ToBoolean(num));
        }
Esempio n. 2
0
        public virtual Material Copy()
        {
            Material material = new Material();

            material.MaterialCode         = this.MaterialCode;
            material.OriginalMaterialCode = this.OriginalMaterialCode;
            material.MaterialName         = this.MaterialName;
            material.GroupCode            = this.GroupCode;
            material.Spec          = this.Spec;
            material.Unit          = this.Unit;
            material.StandardPrice = this.StandardPrice;
            material.InputPerson   = this.InputPerson;
            material.InputDate     = this.InputDate;
            material.Remark        = this.Remark;
            material.AcceptChanges();
            return(material);
        }