///<Summary> ///SaveNew ///This method persists a new Products record to the store ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void SaveNew() { Doing(this); IDAOProducts daoProducts = _iProductsRepository.New(); RegisterDataObject(_iProductsRepository, _iProductsRepository.BaseData(daoProducts)); BeginTransaction(_iProductsRepository, "savenewBOProducts"); try { daoProducts.Supplierİds = _supplierİds; daoProducts.ProductCode = _productCode; daoProducts.ProductName = _productName; daoProducts.Description = _description; daoProducts.StandardCost = _standardCost; daoProducts.ListPrice = _listPrice; daoProducts.ReorderLevel = _reorderLevel; daoProducts.TargetLevel = _targetLevel; daoProducts.QuantityPerUnit = _quantityPerUnit; daoProducts.Discontinued = _discontinued; daoProducts.MinimumReorderQuantity = _minimumReorderQuantity; daoProducts.Category = _category; daoProducts.Attachments = _attachments; _iProductsRepository.Insert(daoProducts); CommitTransaction(_iProductsRepository); Done(this); _supplierİds = daoProducts.Supplierİds; _id = daoProducts.İd; _productCode = daoProducts.ProductCode; _productName = daoProducts.ProductName; _description = daoProducts.Description; _standardCost = daoProducts.StandardCost; _listPrice = daoProducts.ListPrice; _reorderLevel = daoProducts.ReorderLevel; _targetLevel = daoProducts.TargetLevel; _quantityPerUnit = daoProducts.QuantityPerUnit; _discontinued = daoProducts.Discontinued; _minimumReorderQuantity = daoProducts.MinimumReorderQuantity; _category = daoProducts.Category; _attachments = daoProducts.Attachments; _ctrVersion = daoProducts.CtrVersion; _isDirty = false; } catch (Exception ex) { Failed(this, ex); RollbackTransaction(_iProductsRepository, "savenewBOProducts"); Handle(this, ex); } }
///<Summary> ///SaveNew ///This method persists a new Products record to the store ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void SaveNew() { Doing(this); IDAOProducts daoProducts = _iProductsRepository.New(); RegisterDataObject(_iProductsRepository, _iProductsRepository.BaseData(daoProducts)); BeginTransaction(_iProductsRepository, "savenewBOProducts"); try { daoProducts.ProductName = _productName; daoProducts.SupplierID = _supplierID; daoProducts.CategoryID = _categoryID; daoProducts.QuantityPerUnit = _quantityPerUnit; daoProducts.UnitPrice = _unitPrice; daoProducts.UnitsInStock = _unitsInStock; daoProducts.UnitsOnOrder = _unitsOnOrder; daoProducts.ReorderLevel = _reorderLevel; daoProducts.Discontinued = _discontinued; _iProductsRepository.Insert(daoProducts); CommitTransaction(_iProductsRepository); Done(this); _productID = daoProducts.ProductID; _productName = daoProducts.ProductName; _supplierID = daoProducts.SupplierID; _categoryID = daoProducts.CategoryID; _quantityPerUnit = daoProducts.QuantityPerUnit; _unitPrice = daoProducts.UnitPrice; _unitsInStock = daoProducts.UnitsInStock; _unitsOnOrder = daoProducts.UnitsOnOrder; _reorderLevel = daoProducts.ReorderLevel; _discontinued = daoProducts.Discontinued; _ctrVersion = daoProducts.CtrVersion; _isDirty = false; } catch (Exception ex) { Failed(this, ex); RollbackTransaction(_iProductsRepository, "savenewBOProducts"); Handle(this, ex); } }
///<Summary> ///AddProducts ///This method persists a BOProducts object to the database collection ///</Summary> ///<returns> ///void ///</returns> ///<parameters> ///BOProducts ///</parameters> public virtual void AddProducts(IBOProducts boProducts) { Doing(this); IDAOProducts daoProducts = _iProductsRepository.New(); RegisterDataObject(_iProductsRepository, _iProductsRepository.BaseData(daoProducts)); BeginTransaction(_iProductsRepository, "addProducts"); try { daoProducts.ProductID = boProducts.ProductID; daoProducts.ProductName = boProducts.ProductName; daoProducts.SupplierID = boProducts.SupplierID; daoProducts.QuantityPerUnit = boProducts.QuantityPerUnit; daoProducts.UnitPrice = boProducts.UnitPrice; daoProducts.UnitsInStock = boProducts.UnitsInStock; daoProducts.UnitsOnOrder = boProducts.UnitsOnOrder; daoProducts.ReorderLevel = boProducts.ReorderLevel; daoProducts.Discontinued = boProducts.Discontinued; daoProducts.CategoryID = _categoryID.Value; _iProductsRepository.Insert(daoProducts); CommitTransaction(_iProductsRepository); Done(this); /*pick up any primary keys, computed values etc*/ boProducts = new BOProducts(daoProducts); if (_boProductsCollection != null) { _boProductsCollection.Add(boProducts); } } catch (Exception ex) { Failed(this, ex); RollbackTransaction(_iProductsRepository, "addProducts"); Handle(this, ex); } }