protected void btnNewQualification_Click(object sender, ImageClickEventArgs e)
        {
            Promotion p = GetCurrentPromotion();

            if (p == null)
            {
                return;
            }

            string newid = this.lstNewQualification.SelectedValue;
            PromotionQualificationBase pq = PromotionQualificationBase.Factory(newid);

            p.AddQualification(pq);

            MTApp.MarketingServices.Promotions.Update(p);
            LoadItem();
        }
Exemple #2
0
        private IPromotionQualification QualificationFactory(IEnumerable <XElement> nodes)
        {
            if (nodes == null)
            {
                return(null);
            }

            XElement nodeTypeId = nodes.Where(y => y.Name == "TypeId").FirstOrDefault();

            if (nodeTypeId == null)
            {
                return(null);
            }
            Guid typeId = new Guid(nodeTypeId.Value);

            IPromotionQualification result = PromotionQualificationBase.Factory(typeId.ToString().ToUpperInvariant());

            if (result == null)
            {
                return(null);
            }

            XElement nodeId = nodes.Where(y => y.Name == "Id").FirstOrDefault();

            if (nodeId != null)
            {
                long temp = 0;
                long.TryParse(nodeId.Value, out temp);
                result.Id = temp;
            }
            XElement nodeSettings = nodes.Where(y => y.Name == "Settings").FirstOrDefault();

            if (nodeSettings != null)
            {
                foreach (XElement setting in nodeSettings.Descendants("Setting"))
                {
                    string key   = setting.Element("Key").Value;
                    string value = setting.Element("Value").Value;
                    result.Settings[key] = value;
                }
            }

            return(result);
        }