Using Custom Fill Methods on BO


Author
Message
Richard Keller
Richard Keller
StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)
Group: Forum Members
Posts: 84, Visits: 324
 When creating a Custom Fill Method does the Data Retrieval order have to match the Business Object Definition order or will the BO auto map the fields to the properties based on the column names?

Thanks for your help.

Richard

Replies
Bradley Marston
Bradley Marston
StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)
Group: Forum Members
Posts: 24, Visits: 119
No I am just trying to do an update in the customers table

the Reseller field from the Select Was used by another apllication

CREATE PROCEDURE UDSP_Customers_GetData
 (  
  @Customer_UID uniqueidentifier = NULL
 Wink
AS

SET NOCOUNT ON

SELECT cs.*, rs.reseller
 FROM Customers cs JOIN
  Reseller rs ON cs.reseller_UID = rs.reseller_UID
 WHERE Customer_UID = @Customer_UID

_________________________________________________________________

CREATE PROCEDURE UDSP_Customers_Update

 @Customer_UID uniqueidentifier ,  
 @CustomerName varchar(50)      = NULL,
 @CustomerStreet varchar(50)    = NULL,
 @CustomerStreet2 varchar(50)    = NULL,
 @CustomerCity varchar(32)      = NULL,
 @CustomerState char(2)         = NULL,
 @CustomerZIP varchar(9)        = NULL,
 @LCon_Name varchar(50)         = NULL,
 @LCon_Phone varchar(20)        = NULL,
 @LCon_Ext varchar(4)           = NULL,
 @LCon_Mobile varchar(20)       = NULL,
 @LCon_Fax varchar(20)          = NULL,
 @LCon_EmailAddr varchar(80)    = NULL,
 @Status char(16)               = NULL,
 @DealerNum char(7)             = NULL,
 @ODNum char(7)                 = NULL,
 @OD2Num char(7)                = NULL,
 @UpdatedBy varchar(16)               ,  
 @CreatedBy varchar(16)         = NULL,
 @Updateddt datetime            = NULL,
 @Createddt datetime            = NULL,
 @Customer_UID_ORGPK uniqueidentifier = NULL,
 @Reseller_UID uniqueidentifier = NULL,
 @reseller varchar(16)         = NULL
)
AS

SET NOCOUNT ON

UPDATE customers SET   
  CustomerName    = ISNULL(@CustomerName, CustomerName),
  CustomerStreet  = ISNULL(@CustomerStreet, CustomerStreet),
  CustomerStreet2  = ISNULL(@CustomerStreet2, CustomerStreet2),
  CustomerCity    = ISNULL(@CustomerCity, CustomerCity),
  CustomerState   = ISNULL(@CustomerState, CustomerState),
  CustomerZIP     = ISNULL(@CustomerZIP, CustomerZIP),
  LCon_Name       = ISNULL(@LCon_Name, LCon_Name),
  LCon_Phone      = ISNULL(@LCon_Phone, LCon_Phone),
  LCon_Ext        = ISNULL(@LCon_Ext, LCon_Ext),
  LCon_Mobile     = ISNULL(@LCon_Mobile, LCon_Mobile),
  LCon_Fax        = ISNULL(@LCon_Fax, LCon_Fax),
  LCon_EmailAddr  = ISNULL(@LCon_EmailAddr, LCon_EmailAddr),
  Status          = ISNULL(@Status, Status),
  DealerNum       = ISNULL(@DealerNum, DealerNum),
  ODNum           = ISNULL(@ODNum, ODNum),
  OD2Num          = ISNULL(@OD2Num, OD2Num),   
  Reseller_UID    = ISNULL(@Reseller_UID, Reseller_UID),  
  UpdatedBy            = UpdatedBy, 
  UpdatedDt            = GETDATE()

 WHERE Customer_UID    = @Customer_UID

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
OK, you can remove the @reseller field from the update command.  The business object will only attempt to update fields that are part of the mapped table (those contained in the AllFieldsList).  Since your business object was mapped to Customers, it does not think that @reseller should be supplied because it doesn't think it's part of the updating table.  So, whatever the structure of the data table inside the business object, it's only going to update the fields that are part of the mapped table on SQL Server.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Richard Keller - 18 Years Ago
Gary Wynne - 18 Years Ago
StrataFrame Team - 18 Years Ago
Bradley Marston - 18 Years Ago
StrataFrame Team - 18 Years Ago
Bradley Marston - 18 Years Ago
StrataFrame Team - 18 Years Ago
Bradley Marston - 18 Years Ago
StrataFrame Team - 18 Years Ago
StrataFrame Team - 18 Years Ago
Bradley Marston - 18 Years Ago
Bradley Marston - 18 Years Ago
StrataFrame Team - 18 Years Ago
Bradley Marston - 18 Years Ago
Trent L. Taylor - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search