示例#1
0
        public ActionResult BannerPreview()
        {
            DBI dbi = new DBI();

            DataTable dtBanners = dbi.Select(new Procedure("paceAllBanners"));

            Banner        banner;
            List <Banner> listBanners = new List <Banner>();

            object[] columns;
            foreach (DataRow row in dtBanners.Rows)
            {
                columns = row.ItemArray;

                banner                   = new Banner();
                banner.ID                = (int)columns.GetValue(0);
                banner.Slot              = (int)columns.GetValue(1);
                banner.Duration          = (string)columns.GetValue(2);
                banner.Title             = (string)columns.GetValue(3);
                banner.TopImage          = (bool)columns.GetValue(4);
                banner.TopImageUrl       = (string)columns.GetValue(5);
                banner.TopImageWidth     = (int)columns.GetValue(6);
                banner.FirstCaption      = (string)columns.GetValue(7);
                banner.FirstCaptionSize  = (int)columns.GetValue(8);
                banner.SecondCaption     = (string)columns.GetValue(9);
                banner.SecondCaptionSize = (int)columns.GetValue(10);
                banner.BannerImage       = (bool)columns.GetValue(11);
                banner.BannerImageUrl    = (string)columns.GetValue(12);
                banner.BannerImageWidth  = (int)columns.GetValue(13);
                banner.ButtonText        = (string)columns.GetValue(14);
                banner.ButtonUrl         = (string)columns.GetValue(15);

                listBanners.Add(banner);
            }

            string html = "<li data-transition='fade' data-delay='0' id='firstbullet'></li>";

            foreach (Banner b in listBanners)
            {
                html += "<li data-transition='fade' data-delay='" + b.Duration + "'>";
                html += "<div class='caption sfb big' data-x='center' data-y='40' data-speed='300' data-start='500' data-easing='easeOutExpo'>";
                html += "<img src='/Client/images/symbol.png' style='width: 250px !important; opacity: 0.2;' />";
                html += "</div>";

                if (b.BannerImage)
                {
                    if (b.TopImage)
                    {
                        html += "<div class='caption sft big' data-x='0' data-y='40' data-speed='500' data-start='500' data-easing='easeOutExpo'><img src='" + b.TopImageUrl + "' style='width: " + b.TopImageWidth + "px !important;' /></div>";

                        html += "<div class='caption sfl big' data-x='0' data-y='210' data-speed='300' data-start='800' data-easing='easeOutExpo' style='font-size:" + b.FirstCaptionSize + "'>" + b.FirstCaption + "</div>";

                        html += "<div class='caption sfr big' data-x='0' data-y='270' data-speed='300' data-start='1100' data-easing='easeOutExpo' style='font-size:" + b.SecondCaptionSize + "'>" + b.SecondCaption + "</div>";
                    }
                    else
                    {
                        html += "<div class='caption sft huge' data-x='0' data-y='110' data-speed='300' data-start='800' data-easing='easeOutExpo'><strong>" + b.Title + "</strong></div>";

                        html += "<div class='caption sfl big' data-x='0' data-y='200' data-speed='300' data-start='1100' data-easing='easeOutExpo' style='font-size:" + b.FirstCaptionSize + "'>" + b.FirstCaption + "</div>";

                        html += "<div class='caption sfr big' data-x='0' data-y='265' data-speed='300' data-start='1400' data-easing='easeOutExpo' style='font-size:" + b.SecondCaptionSize + "'>" + b.SecondCaption + "</div>";
                    }

                    html += "<div class='caption sfr big' data-x='" + (1100 - b.BannerImageWidth) + "' data-y='60' data-speed='300' data-start='800' data-easing='easeOutExpo'><img src='" + b.BannerImageUrl + "' style='width: " + b.BannerImageWidth + "px !important;' /></div>";
                }
                else
                {
                    if (b.TopImage)
                    {
                        html += "<div class='caption sft big' data-x='center' data-y='40' data-speed='500' data-start='500' data-easing='easeOutExpo'><img src='" + b.TopImageUrl + "' style='width: " + b.TopImageWidth + "px !important;' /></div>";

                        html += "<div class='caption sfl big' data-x='center' data-y='210' data-speed='300' data-start='800' data-easing='easeOutExpo' style='font-size:" + b.FirstCaptionSize + "'>" + b.FirstCaption + "</div>";

                        html += "<div class='caption sfr big' data-x='center' data-y='270' data-speed='300' data-start='1100' data-easing='easeOutExpo' style='font-size:" + b.SecondCaptionSize + "'>" + b.SecondCaption + "</div>";
                    }
                    else
                    {
                        html += "<div class='caption sft huge' data-x='center' data-y='110' data-speed='300' data-start='800' data-easing='easeOutExpo'><strong>" + b.Title + "</strong></div>";

                        html += "<div class='caption sfl big' data-x='center' data-y='200' data-speed='300' data-start='1100' data-easing='easeOutExpo' style='font-size:" + b.FirstCaptionSize + "'>" + b.FirstCaption + "</div>";

                        html += "<div class='caption sfr big' data-x='center' data-y='265' data-speed='300' data-start='1400' data-easing='easeOutExpo' style='font-size:" + b.SecondCaptionSize + "'>" + b.SecondCaption + "</div>";
                    }
                }

                html += "<div class='caption sfb' data-x='center' data-y='340' data-speed='300' data-start='1400' data-easing='easeOutExpo'><a href='" + b.ButtonUrl + "' class='button'>" + b.ButtonText + "</a></div>";
            }

            html += "</li>";

            ViewBag.Banner = html;


            return(View());
        }
示例#2
0
        public ActionResult Home()
        {
            DBI dbi = new DBI();

            DataTable dtFeedbacks = dbi.Select(new Procedure("paceFeedbacksOnAir"));
            DataTable dtBanners   = dbi.Select(new Procedure("paceBannersOnAir"));

            Feedback        feed;
            List <Feedback> listFeeds = new List <Feedback>();

            Banner        banner;
            List <Banner> listBanners = new List <Banner>();

            object[] columns;
            foreach (DataRow row in dtFeedbacks.Rows)
            {
                columns = row.ItemArray;

                feed          = new Feedback();
                feed.ID       = (int)columns.GetValue(0);
                feed.Image    = (bool)columns.GetValue(1);
                feed.ImageUrl = (string)columns.GetValue(2);
                feed.Text     = (string)columns.GetValue(3);
                feed.Author   = (string)columns.GetValue(4);
                feed.Company  = (string)columns.GetValue(5);
                listFeeds.Add(feed);
            }

            foreach (DataRow row in dtBanners.Rows)
            {
                columns = row.ItemArray;

                banner                   = new Banner();
                banner.ID                = (int)columns.GetValue(0);
                banner.Slot              = (int)columns.GetValue(1);
                banner.Duration          = (string)columns.GetValue(2);
                banner.Title             = (string)columns.GetValue(3);
                banner.TopImage          = (bool)columns.GetValue(4);
                banner.TopImageUrl       = (string)columns.GetValue(5);
                banner.TopImageWidth     = (int)columns.GetValue(6);
                banner.FirstCaption      = (string)columns.GetValue(7);
                banner.FirstCaptionSize  = (int)columns.GetValue(8);
                banner.SecondCaption     = (string)columns.GetValue(9);
                banner.SecondCaptionSize = (int)columns.GetValue(10);
                banner.BannerImage       = (bool)columns.GetValue(11);
                banner.BannerImageUrl    = (string)columns.GetValue(12);
                banner.BannerImageWidth  = (int)columns.GetValue(13);
                banner.ButtonText        = (string)columns.GetValue(14);
                banner.ButtonUrl         = (string)columns.GetValue(15);

                listBanners.Add(banner);
            }

            string html = "", tabs = "";
            int    i = 0;

            foreach (Feedback f in listFeeds)
            {
                i++;

                if (f.Image)
                {
                    html += "<div id='tst" + i + "'><div class='one-fourth'><img src='" + f.ImageUrl + "' class='margin' /></div><div class='three-fourth last'><p>" + f.Text + "</p><h4>" + f.Author + "<span>" + f.Company + "</span></h4></div><div class='clear'></div></div>";
                }
                else
                {
                    html += "<div id='tst" + i + "'><p>" + f.Text + "</p><h4>" + f.Author + "<span>" + f.Company + "</span></h4></div>";
                }


                tabs += "<li class='tab'><a href='#tst" + i + "'></a></li>";
            }

            ViewBag.Testimonials = html;
            ViewBag.Tabs         = tabs;

            html = "<li data-transition='fade' data-delay='0'></li>";

            foreach (Banner b in listBanners)
            {
                html += "<li data-transition='fade' data-delay='" + b.Duration + "'>";
                html += "<div class='caption sfb big' data-x='center' data-y='40' data-speed='300' data-start='500' data-easing='easeOutExpo'>";
                html += "<img src='/Client/images/symbol.png' style='width: 250px !important; opacity: 0.2;' />";
                html += "</div>";

                if (b.BannerImage)
                {
                    if (b.TopImage)
                    {
                        html += "<div class='caption sft big' data-x='0' data-y='40' data-speed='500' data-start='500' data-easing='easeOutExpo'><img src='" + b.TopImageUrl + "' style='width: " + b.TopImageWidth + "px !important;' /></div>";

                        html += "<div class='caption sfl big' data-x='0' data-y='210' data-speed='300' data-start='800' data-easing='easeOutExpo' style='font-size:" + b.FirstCaptionSize + "'>" + b.FirstCaption + "</div>";

                        html += "<div class='caption sfr big' data-x='0' data-y='270' data-speed='300' data-start='1100' data-easing='easeOutExpo' style='font-size:" + b.SecondCaptionSize + "'>" + b.SecondCaption + "</div>";
                    }
                    else
                    {
                        html += "<div class='caption sft huge' data-x='0' data-y='110' data-speed='300' data-start='800' data-easing='easeOutExpo'><strong>" + b.Title + "</strong></div>";

                        html += "<div class='caption sfl big' data-x='0' data-y='200' data-speed='300' data-start='1100' data-easing='easeOutExpo' style='font-size:" + b.FirstCaptionSize + "'>" + b.FirstCaption + "</div>";

                        html += "<div class='caption sfr big' data-x='0' data-y='265' data-speed='300' data-start='1400' data-easing='easeOutExpo' style='font-size:" + b.SecondCaptionSize + "'>" + b.SecondCaption + "</div>";
                    }

                    html += "<div class='caption sfr big' data-x='" + (1100 - b.BannerImageWidth) + "' data-y='60' data-speed='300' data-start='800' data-easing='easeOutExpo'><img src='" + b.BannerImageUrl + "' style='width: " + b.BannerImageWidth + "px !important;' /></div>";
                }
                else
                {
                    if (b.TopImage)
                    {
                        html += "<div class='caption sft big' data-x='center' data-y='40' data-speed='500' data-start='500' data-easing='easeOutExpo'><img src='" + b.TopImageUrl + "' style='width: " + b.TopImageWidth + "px !important;' /></div>";

                        html += "<div class='caption sfl big' data-x='center' data-y='210' data-speed='300' data-start='800' data-easing='easeOutExpo' style='font-size:" + b.FirstCaptionSize + "'>" + b.FirstCaption + "</div>";

                        html += "<div class='caption sfr big' data-x='center' data-y='270' data-speed='300' data-start='1100' data-easing='easeOutExpo' style='font-size:" + b.SecondCaptionSize + "'>" + b.SecondCaption + "</div>";
                    }
                    else
                    {
                        html += "<div class='caption sft huge' data-x='center' data-y='110' data-speed='300' data-start='800' data-easing='easeOutExpo'><strong>" + b.Title + "</strong></div>";

                        html += "<div class='caption sfl big' data-x='center' data-y='200' data-speed='300' data-start='1100' data-easing='easeOutExpo' style='font-size:" + b.FirstCaptionSize + "'>" + b.FirstCaption + "</div>";

                        html += "<div class='caption sfr big' data-x='center' data-y='265' data-speed='300' data-start='1400' data-easing='easeOutExpo' style='font-size:" + b.SecondCaptionSize + "'>" + b.SecondCaption + "</div>";
                    }
                }

                html += "<div class='caption sfb' data-x='center' data-y='340' data-speed='300' data-start='1400' data-easing='easeOutExpo'><a href='" + b.ButtonUrl + "' class='button'>" + b.ButtonText + "</a></div>";
            }

            html += "</li>";

            ViewBag.Banner = html;


            Logs log = new Logs();

            log.Request = Request;
            log.Page    = "Home";
            log.Save();

            return(View());
        }