public void QualificationsFromXmlTest()
        {
            Promotion expected = new Promotion();
            ProductBvin q1 = new ProductBvin("abc123");
            expected.AddQualification(q1);

            string xml = "<Qualifications>" + System.Environment.NewLine;
            xml += "  <Qualification>" + System.Environment.NewLine;
            xml += "    <Id>" + q1.Id.ToString() + "</Id>" + System.Environment.NewLine;
            xml += "    <TypeId>" + q1.TypeId + "</TypeId>" + System.Environment.NewLine;
            xml += "    <ProcessingCost>0</ProcessingCost>" + System.Environment.NewLine;
            xml += "    <Settings>" + System.Environment.NewLine;
            xml += "      <Setting>" + System.Environment.NewLine;
            xml += "        <Key>ProductIds</Key>" + System.Environment.NewLine;
            xml += "        <Value>abc123</Value>" + System.Environment.NewLine;
            xml += "      </Setting>" + System.Environment.NewLine;
            xml += "    </Settings>" + System.Environment.NewLine;
            xml += "  </Qualification>" + System.Environment.NewLine;
            xml += "</Qualifications>";

            Promotion actual = new Promotion();
            actual.QualificationsFromXml(xml);

            Assert.AreEqual(expected.Qualifications.Count, actual.Qualifications.Count, "Qualifications count did not match");
            Assert.AreEqual(q1.CurrentProductIds()[0], ((ProductBvin)actual.Qualifications[0]).CurrentProductIds()[0], "Product bvin didn't come through");
            for (int i = 0; i < expected.Qualifications.Count; i++)
            {
                Assert.AreEqual(expected.Qualifications[i].Id, actual.Qualifications[i].Id, "Id didn't match for qualification index " + i.ToString());
                Assert.AreEqual(expected.Qualifications[i].ProcessingCost, actual.Qualifications[i].ProcessingCost, "Processing Cost didn't match for qualification index " + i.ToString());
                Assert.AreEqual(expected.Qualifications[i].Settings.Count, actual.Qualifications[i].Settings.Count, "Settings Count didn't match for qualification index " + i.ToString());
                Assert.AreEqual(expected.Qualifications[i].TypeId, actual.Qualifications[i].TypeId, "TypeId didn't match for qualification index " + i.ToString());
            }
        }
        public void QualificationsToXmlTest()
        {
            Promotion target = new Promotion();
            ProductBvin q1 = new ProductBvin("abc123");
            target.AddQualification(q1);

            string expected = "<Qualifications>" + System.Environment.NewLine;

            expected += "  <Qualification>" + System.Environment.NewLine;
            expected += "    <Id>" + q1.Id.ToString() + "</Id>" + System.Environment.NewLine;
            expected += "    <TypeId>" + q1.TypeId + "</TypeId>" + System.Environment.NewLine;
            expected += "    <ProcessingCost>0</ProcessingCost>" + System.Environment.NewLine;
            expected += "    <Settings>" + System.Environment.NewLine;
            expected += "      <Setting>" + System.Environment.NewLine;
            expected += "        <Key>ProductIds</Key>" + System.Environment.NewLine;
            expected += "        <Value>abc123</Value>" + System.Environment.NewLine;
            expected += "      </Setting>" + System.Environment.NewLine;
            expected += "    </Settings>" + System.Environment.NewLine;
            expected += "  </Qualification>" + System.Environment.NewLine;

            expected += "</Qualifications>";

            string actual;
            actual = target.QualificationsToXml();
            Assert.AreEqual(expected, actual);
        }
        // Product Bvin Editor
        private void LoadProductBvinEditor(ProductBvin q)
        {
            this.ProductPicker1.LoadSearch();

            List<FriendlyBvinDisplay> displayData = new List<FriendlyBvinDisplay>();

            foreach (string bvin in q.CurrentProductIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin = bvin;
                item.DisplayName = bvin;

                MerchantTribe.Commerce.Catalog.Product p = MyPage.MTApp.CatalogServices.Products.Find(item.bvin);
                if (p != null)
                {
                    item.DisplayName = "[" + p.Sku + "] " + p.ProductName;
                }
                displayData.Add(item);
            }

            this.gvProductBvins.DataSource = displayData;
            this.gvProductBvins.DataBind();
        }