コード例 #1
0
        public int getAttributeValueID(int attributeID, string value)
        {
            AttributeBL attributeBL = new AttributeBL();
            List<AttributeValue> attributeValues = attributeBL.GetAttributeValues(attributeID);
            int attributeValueID = 0;
            bool exists = false;

            if (attributeValues != null)
            {
                for (int i = 0; i < attributeValues.Count; i++)
                    if (attributeValues[i].Value == value)
                    {
                        attributeValueID = attributeValues[i].AttributeValueID;
                        exists = true;
                        break;
                    }
            }

            if (!exists)
            {
                AttributeValue attributeValue = new AttributeValue(-1, value, attributeID, 0, string.Empty, 0);
                attributeValueID = attributeBL.SaveAttributeValue(attributeValue, false);
            }
            return attributeValueID;
        }
コード例 #2
0
        protected void btnAddAttributeValue_Click(object sender, EventArgs e)
        {
            switch(lblType.Value)
            {
                case "attribute":
                    {
                        AttributeBL attributeBL = new AttributeBL();
                        attributeBL.SaveAttributeValue(new AttributeValue(-1, txtAttributeValue.Text, int.Parse(lblAttributeID.Value), 0, string.Empty, 0), false);

                        foreach (object control in pnlAttributes.Controls)
                            if (control is customControls.AttributeControl)
                                if (((customControls.AttributeControl)control).ID == lblAttributeName.Value)
                                    ((customControls.AttributeControl)control).setValues();
                        break;
                    }
                case "supplier":
                    {
                        SupplierBL supplierBL = new SupplierBL();
                        supplierBL.SaveSupplier(new Supplier(-1, txtAttributeValue.Text));
                        loadSupplier();
                        break;
                    }

                case "brand":
                    {
                        BrandBL brandBL = new BrandBL();
                        brandBL.SaveBrand(new Brand(-1, txtAttributeValue.Text));
                        loadBrands();
                        break;
                    }
            }
            txtAttributeValue.Text = string.Empty;
        }
コード例 #3
0
ファイル: attribute.aspx.cs プロジェクト: yoorke/pinshop
        protected void btnAddValue_Click(object sender, EventArgs e)
        {
            AttributeValue attributeValue = new AttributeValue();
            attributeValue.Value = txtValue.Text;
            attributeValue.AttributeID = int.Parse(lblAttributeID.Value);

            AttributeBL attributeBL = new AttributeBL();
            attributeBL.SaveAttributeValue(attributeValue, false);

            loadValues();
        }