/// <summary>
 /// Maneja las operaciones de la seccion de banner de un showroom al guardar, si usa en GuardarShowrrom
 /// </summary>
 /// <param name="idBanner"></param>
 /// <param name="colorBanner"></param>
 private Showroom guardarSeccionBanner(Showroom showroom, int idBanner, string colorBanner, bool esNuevoBanner, string textoPrincipal)
 {
     if (idBanner != 0)
     {
         if (showroom.tieneBanner() && !esNuevoBanner)
         {
             if (showroom.Banner == null)
             {
                 showroom.Banner = BannerDao.get(_context, Convert.ToInt32(showroom.BannerID));
             }
             showroom.Banner.llenarParaEdicion(null, null, textoPrincipal, colorBanner, null);
         }
         else
         {
             showroom.BannerID = idBanner;
             ElementoMenuDAD elemento = _context.ElementosMenuDADs.Single(m => m.ID == idBanner);
             Banner          banner   = new Banner {
                 Showroom = showroom, ColorBanner = colorBanner, TipoLetra = "", Html = elemento.Html, Titulo = textoPrincipal, UrlLogo = ""
             };
             showroom.Banner   = banner;
             showroom.BannerID = idBanner;
         }
     }
     BannerDao.grabarActualizar(_context, showroom.Banner);
     //ShowroomDao.grabar(_context, showroom);
     return(showroom);
 }
示例#2
0
        ///Display, create, edit, delete Slide
        //Index page of Banner management
        public ActionResult Index(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new BannerDao();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;
            ViewBag.PageSize     = pageSize;
            return(View(model));
        }
        public DataModel OptenerHtmlBanner(int idBanner)
        {
            Banner banner = null;

            if (idBanner != 0)
            {
                banner = BannerDao.get(_context, idBanner);
            }
            DataModel respuesta = new DataModel();

            respuesta.data.Add("html", banner != null ? banner.Html : "");
            return(respuesta);
        }
        public IActionResult Ver(int id)
        {
            ShowroomVerModelAndView model = new ShowroomVerModelAndView();
            Negocio  negocio  = NegocioDao.get(_context, id);
            Showroom showroom = new Showroom();
            Banner   banner   = new Banner();
            Cuerpo   cuerpo   = new Cuerpo();

            model.llenarDatosGenerales(HttpContext, _context);
            if (negocio.Showroom != null || negocio.ShowroomID != null)
            {
                if (negocio.ShowroomID != null)
                {
                    showroom = ShowroomDao.get(_context, Convert.ToInt32(negocio.ShowroomID));
                }
                else
                {
                    showroom = negocio.Showroom;
                }
            }
            if (showroom.Banner != null || showroom.BannerID != null)
            {
                if (showroom.BannerID != null)
                {
                    banner = BannerDao.get(_context, Convert.ToInt32(showroom.BannerID));
                }
                else
                {
                    banner = showroom.Banner;
                }
            }
            if (showroom.Cuerpo != null || showroom.CuerpoID != null)
            {
                if (showroom.CuerpoID != null)
                {
                    cuerpo = CuerpoDao.get(_context, Convert.ToInt32(showroom.CuerpoID));
                }
                else
                {
                    cuerpo = showroom.Cuerpo;
                }
            }
            model.Showroom = showroom;
            model.Banner   = banner;
            model.Cuerpo   = cuerpo;

            //model.llenarElmentos(_context, negocio);
            return(View(model));
        }
示例#5
0
        public static void SwapTplCfgSequence(int bannerId, int replaceBannerId)
        {
            BannerDao  dao        = new BannerDao();
            TplCfgInfo tplCfgById = dao.GetTplCfgById(bannerId);
            TplCfgInfo info       = dao.GetTplCfgById(replaceBannerId);

            if ((tplCfgById != null) && (info != null))
            {
                int displaySequence = tplCfgById.DisplaySequence;
                tplCfgById.DisplaySequence = info.DisplaySequence;
                info.DisplaySequence       = displaySequence;
                dao.UpdateTplCfg(tplCfgById);
                dao.UpdateTplCfg(info);
            }
        }
示例#6
0
        public static void SwapTplCfgSequence(int bannerId, int replaceBannerId)
        {
            BannerDao  bannerDao  = new BannerDao();
            TplCfgInfo tplCfgById = bannerDao.GetTplCfgById(bannerId);
            TplCfgInfo tplCfgInfo = bannerDao.GetTplCfgById(replaceBannerId);

            if ((tplCfgById == null ? false : tplCfgInfo != null))
            {
                int displaySequence = tplCfgById.DisplaySequence;
                tplCfgById.DisplaySequence = tplCfgInfo.DisplaySequence;
                tplCfgInfo.DisplaySequence = displaySequence;
                bannerDao.UpdateTplCfg(tplCfgById);
                bannerDao.UpdateTplCfg(tplCfgInfo);
            }
        }
示例#7
0
        public static void SwapTplCfgSequence(int bannerId, int replaceBannerId)
        {
            BannerDao  bannerDao   = new BannerDao();
            TplCfgInfo tplCfgById  = bannerDao.GetTplCfgById(bannerId);
            TplCfgInfo tplCfgById2 = bannerDao.GetTplCfgById(replaceBannerId);

            if (tplCfgById != null && tplCfgById2 != null)
            {
                int displaySequence = tplCfgById.DisplaySequence;
                tplCfgById.DisplaySequence  = tplCfgById2.DisplaySequence;
                tplCfgById2.DisplaySequence = displaySequence;
                bannerDao.UpdateTplCfg(tplCfgById);
                bannerDao.UpdateTplCfg(tplCfgById2);
            }
        }
示例#8
0
 public ActionResult Edit(Banner banner)
 {
     if (ModelState.IsValid)
     {
         var result = new BannerDao().Update(banner);
         if (result)
         {
             SetAlert("Edit this banner successfully.", "success");
         }
         else
         {
             ModelState.AddModelError("", "banner this banner failed.");
         }
     }
     return(View(banner));
 }
示例#9
0
 public ActionResult Create(Banner banner)
 {
     if (ModelState.IsValid)
     {
         var  dao = new BannerDao();
         long id  = dao.Insert(banner);
         if (id > 0)
         {
             SetAlert("Create a new banner successfully.", "success");
             return(RedirectToAction("Index", "banner"));
         }
         else
         {
             ModelState.AddModelError("", "Create a new banner failed.");
             return(RedirectToAction("Create", "Banner"));
         }
     }
     return(View(banner));
 }
示例#10
0
 /// <summary>
 /// Llenar los elementos del modelo
 /// </summary>
 /// <param name="_context"></param>
 public void llenarElmentos(HiShopContext _context, Entity.Negocio negocio)
 {
     this.showroom = ShowroomDao.get(_context, Convert.ToInt32(negocio.ShowroomID.ToString()));
     if (this.showroom.tieneBanner())
     {
         this.showroom.Banner = BannerDao.get(_context, Convert.ToInt32(this.showroom.BannerID.ToString()));
     }
     else
     {
         this.showroom.Banner = new Banner();
     }
     if (this.showroom.tieneCuerpo())
     {
         this.showroom.Cuerpo = CuerpoDao.get(_context, Convert.ToInt32(this.showroom.CuerpoID.ToString()));
     }
     else
     {
         this.showroom.Cuerpo = new Cuerpo();
     }
 }
示例#11
0
        public ActionResult Edit(long id)
        {
            var banner = new BannerDao().GetByID(id);

            return(View(banner));
        }