コード例 #1
0
ファイル: BusinessInformation.cs プロジェクト: zibler/zibler
 public virtual void RemoveSupplier(Supplier supplier)
 {
     Suppliers.Remove(supplier);
 }
コード例 #2
0
        /// <summary>
        /// Creates a new Business Supplier
        /// </summary>
        /// <param name="businessId">businessId</param>
        /// <param name="businessVersion">businessVersion</param>
        /// <param name="supplier">supplier to be created</param>
        public void CreateNewBusinessSupplier(int businessId,
            int businessVersion,
            Supplier supplier)
        {
            try
            {
                IBusinessInformationDAO businessInformationDAO = _daoFactory.GetBusinessInformationDAO ();

                //Get all the business supplier. Note that I retrieve all products in a batch base
                //and don't care about the number of records. This is because it is not likely
                //the business will contain hundreds of products
                BusinessInformation businessInformation = businessInformationDAO.FindByIdAndVersion (
                    businessId,
                    businessVersion);

                if (businessInformation == null)
                    throw new ZiblerBusinessComponentsException (Resources.RecordNotFound);
                else
                {
                    foreach (Supplier existingSupplier in businessInformation.Suppliers)
                    {
                        if (existingSupplier.Name == supplier.Name)
                        {
                            throw new ZiblerBusinessComponentsException (
                                Resources.LoanRequestOperationsMsgBusinessAlreadyHasSupplier);
                        }
                    }

                    //Since no exception was thrown, then we add the new client to the list.
                    businessInformation.AddSupplier (supplier);
                }
            }
            /* If the exception was thrown here, just pass it up */
            catch (ZiblerBusinessComponentsException ex)
            {
                throw;
            }
            /* Catch any Data Layer or other exception and throw an unkown exception */
            catch (Exception ex)
            {
                ZiblerBusinessComponentsUnknownException exc
                = new ZiblerBusinessComponentsUnknownException (ex);

                /* Throw the new exception */
                throw exc;
            }
        }
コード例 #3
0
ファイル: BusinessInformation.cs プロジェクト: zibler/zibler
 public virtual void AddSupplier(Supplier newSupplier)
 {
     newSupplier.BusinessInformation = this;
     Suppliers.Add(newSupplier);
 }