public static CatalogItem GetByItemName(string itemName) { CatalogItem catalogItem = new CatalogItem(); using (ObjectConnection objectConnection = new ObjectConnection()) { using (GetCatalogItemByItemNameCommand objectCommand = new GetCatalogItemByItemNameCommand(objectConnection)) { objectCommand.ItemName = itemName; objectConnection.Open(); using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader()) { if (!sqlDataReader.HasRows) { return catalogItem; } using (CatalogItemSqlDataReader objectSqlDataReader = new CatalogItemSqlDataReader(sqlDataReader)) { while (objectSqlDataReader.Read()) { catalogItem = objectSqlDataReader.CatalogItem; } } } } } return catalogItem; }
public static Entities.CatalogItem ToEntity(BusinessObject.CatalogItem businessObject) { if (businessObject == null) return null; Entities.CatalogItem entity = new Entities.CatalogItem { InscriptionTypeId = (int)businessObject.InscriptionType, CatalogItemId = businessObject.CatalogItemId, ItemCost = businessObject.ItemCost, Manufacturer = businessObject.Manufacturer, NumberInscriptionLines = businessObject.NumberInscriptionLines, NumberLineCharacters = businessObject.NumberLineCharacters, ItemName = businessObject.ItemName, ItemRetailPrice = businessObject.ItemRetailPrice }; return entity; }
public static BusinessObject.CatalogItem ToBusinessObject(Entities.CatalogItem entity) { if (entity == null) { return(null); } BusinessObject.CatalogItem businessObject = new BusinessObject.CatalogItem(entity.CatalogItemId) { InscriptionType = (Enumeration.InscriptionType)entity.InscriptionTypeId, ItemCost = entity.ItemCost, Manufacturer = entity.Manufacturer, NumberInscriptionLines = entity.NumberInscriptionLines, NumberLineCharacters = entity.NumberLineCharacters, ItemName = entity.ItemName, ItemRetailPrice = entity.ItemRetailPrice }; return(businessObject); }
public static Entities.CatalogItem ToEntity(BusinessObject.CatalogItem businessObject) { if (businessObject == null) { return(null); } Entities.CatalogItem entity = new Entities.CatalogItem { InscriptionTypeId = (int)businessObject.InscriptionType, CatalogItemId = businessObject.CatalogItemId, ItemCost = businessObject.ItemCost, Manufacturer = businessObject.Manufacturer, NumberInscriptionLines = businessObject.NumberInscriptionLines, NumberLineCharacters = businessObject.NumberLineCharacters, ItemName = businessObject.ItemName, ItemRetailPrice = businessObject.ItemRetailPrice }; return(entity); }