示例#1
0
        public void Add(int categoryId)
        {
            target(Create);

            set("categoryName", AdCategory.GetName(categoryId));

            set("categoryId", categoryId);

            dropList("adItem.ScopeId", cdb.findAll <AdScope>(), "Name=Id", null);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            AdCategory adCategory = db.AdCategoriesList.Find(id);

            adCategory.IsDeleted = true;

            db.SaveChanges();

            SetMessage("Campaña eliminada", BootstrapAlertTypes.Success);
            return(RedirectToAction("Index"));
        }
示例#3
0
 private void SeedAdCategory(AdContext context)
 {
     for (int i = 1; i <= 10; i++)
     {
         var adcat = new AdCategory()
         {
             Id         = i,
             AdId       = i / 2 + 1,
             CategoryId = i / 2 + 2
         };
         context.Set <AdCategory>().AddOrUpdate(adcat);
     }
     context.SaveChanges();
 }
        public ActionResult Create([Bind(Include = "AdCategoryId,Name,Tags,StartDate,EndDate,Active,MagazineId")] AdCategory adCategory)
        {
            if (ModelState.IsValid)
            {
                db.AdCategoriesList.Add(adCategory);
                db.SaveChanges();

                SetMessage("Campaña creada", BootstrapAlertTypes.Success);
                return(RedirectToAction("Index"));
            }

            ViewBag.Keywords = Keywords_GetForAdGroup(db.NewsesList.Where(x => x.Category.MagazineId == adCategory.MagazineId).ToList()).OrderByDescending(x => x.Value);

            SetMessage("Ha ocurrido un error al crear la campaña", BootstrapAlertTypes.Danger);
            return(View(adCategory));
        }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            AdCategory adCategory = db.AdCategoriesList.Find(id);

            if (adCategory == null)
            {
                return(HttpNotFound());
            }

            return(View(adCategory));
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            AdCategory adCategory = db.AdCategoriesList.Find(id);

            if (adCategory == null)
            {
                return(HttpNotFound());
            }

            ViewBag.Keywords = Keywords_GetForAdGroup(db.NewsesList.Where(x => x.Category.MagazineId == adCategory.MagazineId).ToList()).OrderByDescending(x => x.Value);

            return(View(adCategory));
        }
示例#7
0
        /// <summary>
        /// 控件处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dv = e.Item.DataItem as DataRowView;
                Int32       ID = Convert.ToInt32(dv["id"]);

                ImageButton del = e.Item.FindControl("del") as ImageButton;
                del.OnClientClick = String.Format("javascript:dialogConfirm({{el:this,text:'将删除 {0} 且无法恢复!确定要删除吗?'}});return false;", dv["title"]);

                AdCategory  adtype       = (AdCategory)Enum.Parse(typeof(AdCategory), dv["groupid"].ToString(), true);
                PlaceHolder placeholder1 = e.Item.FindControl("PlaceHolder1") as PlaceHolder;
                PlaceHolder placeholder2 = e.Item.FindControl("PlaceHolder2") as PlaceHolder;
                if (adtype == AdCategory.FLV视频)
                {
                    placeholder1.Visible = false;
                    placeholder2.Visible = true;
                }
            }
        }
示例#8
0
        /// <summary>
        /// 广告类型
        /// </summary>
        /// <returns></returns>
        protected Boolean isFlv()
        {
            AdCategory data = (AdCategory)Enum.Parse(typeof(AdCategory), Eval("groupid").ToString(), true);

            return(data == AdCategory.FLV视频);
        }