Пример #1
0
        /// <summary>
        /// Returns the product Allow status as an integer
        /// </summary>
        /// <param name="productID"></param>
        /// <param name="receivingUnitID"></param>
        /// <returns>1=AllowFully, 0=Warning, -1 = Restricted</returns>
        public int ProductAllowStatus(int productID, int receivingUnitID)
        {
            Institution              institution     = new Institution();
            ProductOwnershipType     ownershipStatus = new ProductOwnershipType();
            ProductReceivingUnitType ruTypeStatus    = new ProductReceivingUnitType();

            institution.LoadByPrimaryKey(receivingUnitID);

            ownershipStatus.Where.RUOwnershipTypeID.Value = institution.Ownership;
            ownershipStatus.Where.ProductID.Value         = productID;
            ownershipStatus.Query.Load();

            if (ownershipStatus.RowCount > 0)
            {
                if (!ownershipStatus.IsColumnNull("Restriction") && ownershipStatus.Restriction)
                {
                    return(-1);
                }
                else if (!ownershipStatus.IsColumnNull("Warning") && ownershipStatus.Warning)
                {
                    return(0);
                }
                else if (!ownershipStatus.IsColumnNull("AllowFully") && ownershipStatus.AllowFully)
                {
                    return(1);
                }
            }

            ruTypeStatus.Where.ReceivingUnitTypeID.Value = institution.RUType;
            ruTypeStatus.Where.ProductID.Value           = productID;
            ruTypeStatus.Query.Load();

            if (ruTypeStatus.RowCount > 0)
            {
                if (!ruTypeStatus.IsColumnNull("Restriction") && ruTypeStatus.Restriction)
                {
                    return(-1);
                }
                if (!ruTypeStatus.IsColumnNull("Warning") && ruTypeStatus.Warning)
                {
                    return(0);
                }
                if (!ruTypeStatus.IsColumnNull("AllowFully") && ruTypeStatus.AllowFully)
                {
                    return(1);
                }
            }
            //If it gets here, this means there is no entry in the table about the allow status for this product.  Therefore we give full allow status.
            return(1);
        }
        /// <summary>
        /// Returns the product Allow status as an integer
        /// </summary>
        /// <param name="productID"></param>
        /// <param name="receivingUnitID"></param>
        /// <returns>1=AllowFully, 0=Warning, -1 = Restricted</returns>
        public int ProductAllowStatus(int productID, int receivingUnitID)
        {
            Institution institution = new Institution();
            ProductOwnershipType ownershipStatus = new ProductOwnershipType();
            ProductReceivingUnitType ruTypeStatus = new ProductReceivingUnitType();

            institution.LoadByPrimaryKey(receivingUnitID);

            ownershipStatus.Where.RUOwnershipTypeID.Value = institution.Ownership;
            ownershipStatus.Where.ProductID.Value = productID;
            ownershipStatus.Query.Load();

            if (ownershipStatus.RowCount > 0)
            {
                if (!ownershipStatus.IsColumnNull("Restriction") && ownershipStatus.Restriction)
                    return -1;
                else if (!ownershipStatus.IsColumnNull("Warning") && ownershipStatus.Warning)
                    return 0;
                else if (!ownershipStatus.IsColumnNull("AllowFully") && ownershipStatus.AllowFully)
                    return 1;
            }

            ruTypeStatus.Where.ReceivingUnitTypeID.Value = institution.RUType;
            ruTypeStatus.Where.ProductID.Value = productID;
            ruTypeStatus.Query.Load();

            if (ruTypeStatus.RowCount > 0)
            {
                if (!ruTypeStatus.IsColumnNull("Restriction") && ruTypeStatus.Restriction)
                    return -1;
                if (!ruTypeStatus.IsColumnNull("Warning") && ruTypeStatus.Warning)
                    return 0;
                if (!ruTypeStatus.IsColumnNull("AllowFully") && ruTypeStatus.AllowFully)
                    return 1;
            }
            //If it gets here, this means there is no entry in the table about the allow status for this product.  Therefore we give full allow status.
            return 1;
        }
Пример #3
0
        /// <summary>
        /// Adds new allow status for the ProductOwnershipType
        /// </summary>
        /// <param name="productID"></param>
        /// <param name="receivingUnitID"></param>
        /// <param name="allowStatus">-1 = Restricted, 0 = Warning, 1 = Allow</param>
        public void SetReceivingUnitTypeProductAllowStatus(int productID, int receivingUnit, int allowStatus)
        {
            ProductReceivingUnitType ruTypeAllowStatus = new ProductReceivingUnitType();

            ruTypeAllowStatus.AddNew(productID, receivingUnit, allowStatus);
        }
 /// <summary>
 /// Adds new allow status for the ProductOwnershipType
 /// </summary>
 /// <param name="productID"></param>
 /// <param name="receivingUnitID"></param>
 /// <param name="allowStatus">-1 = Restricted, 0 = Warning, 1 = Allow</param>
 public void SetReceivingUnitTypeProductAllowStatus(int productID, int receivingUnit, int allowStatus)
 {
     ProductReceivingUnitType ruTypeAllowStatus = new ProductReceivingUnitType();
     ruTypeAllowStatus.AddNew(productID, receivingUnit, allowStatus);
 }