示例#1
0
 protected override void Edit()
 {
     Entity = new MarketingMaterial {
         id = EventArgument
     };
     Entity = TheEvent.Materials.Find(l => l.id == EventArgument);
     base.Edit();
 }
示例#2
0
        public MarketingViewModel(string id)
        {
            arole   = false;
            EventId = id;
            var searchEvent = new Event {
                id = id
            };

            TheEvent     = DbCommands.GetByIdDbCommand.ById(searchEvent);
            SearchEntity = new NullMarketingmaterial();
            EventCommand = "List";
            Entity       = new MarketingMaterial();
        }
示例#3
0
        protected override void Delete()
        {
            // set product to delete Product
            Entity = TheEvent.Materials.Find(l => l.id == EventArgument);

            var adapter = new BlogStorageAdapter();

            adapter.Delete(Entity.Resource);


            TheEvent.Materials.Remove(Entity);
            DbCommands.UpdateDbCommand.SetEntity(TheEvent); // save updated product
            Get();
            base.Delete();
        }
        public void Update(string id, Event anObject)
        {
            using (var context = new EventContext())
            {
                var newList = new List <MarketingMaterial>();
                var ninja   = context.Events.Include(n => n.Materials)
                              .FirstOrDefault(n => n.id == id);

                if (anObject.Materials.Count < ninja.Materials.Count)
                {
                    // deleted marketing material

                    var differenceQuery =
                        ninja.Materials.Except(anObject.Materials);
                    context.Material.Remove(differenceQuery.FirstOrDefault());
                    context.SaveChanges();
                }
                else
                {
                    // added marketing material
                    var differenceQuery =
                        ninja.Materials.Except(anObject.Materials);

                    var marketingMaterials = differenceQuery as MarketingMaterial[] ?? differenceQuery.ToArray();
                    if (marketingMaterials.Count() != 0)
                    {
                        context.Material.Remove(marketingMaterials.FirstOrDefault());
                    }
                    var differenceQuery1 =
                        anObject.Materials.Except(ninja.Materials);

                    foreach (var material in differenceQuery1)
                    {
                        ninja.Materials.Add(MarketingMaterial.Copy(material));
                    }
                    //   ninja.Materials = newList;
                    ninja.EventLocation        = anObject.EventLocation;
                    ninja.EventType            = anObject.EventType;
                    ninja.EventDate            = anObject.EventDate;
                    ninja.EventName            = anObject.EventName;
                    ninja.EventAttendance      = anObject.EventAttendance;
                    context.Entry(ninja).State = EntityState.Modified;
                    context.SaveChanges();
                }
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!_enabled)
            {
                return;
            }

            try
            {
                var repository = new CustomCampaignContentRepository();
                MarketingMaterial marketingMaterial = repository.GetCustomContent(CampaignId, Tag);
                _content = marketingMaterial.HTMLText;
            }
            catch
            {
                // Just continue using the default content.
            }
        }
示例#6
0
 protected override void Add()
 {
     IsValid = true;
     Entity  = new MarketingMaterial();
     base.Add();
 }
 public void DeleteMarketingMaterial(MarketingMaterial mm)
 {
     throw new NotImplementedException();
 }
 public MarketingMaterial SaveMarketingMaterial(MarketingMaterial mm)
 {
     throw new NotImplementedException();
 }