Saturday, May 24, 2014

jquery using image slide show with opacity animate

css

#topCarousel .slideshow {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
    position: relative;
}
#topCarousel .slideshow li {
    position: absolute;
    left: 0px;
    top: 0px;
    display: block;
    width: 100%;
    opacity: 0;
    filter: alpha(opacity=0);
}
#topCarousel .slideshow li.ishow {   
    position: relative;
    z-index:500;
}
#topCarousel .slideshow li img {
    display: block;
    line-height: 1;
    width: 100%;
}

html

<div id="topCarousel">
            <ul class="slideshow">
                <?php
                $count_for = 0;
                foreach ($static_top_banners as $static_top_banner):
                    $originalurl = $this->thumbmanager->thumb_url($static_top_banner);
                    ?>
                    <li class="<?php echo $count_for === 0 ? 'ishow' : ''; ?>">
                        <img src="<?php echo $originalurl; ?>" alt=""/>
                    </li>
                    <?php
                    $count_for++;
                endforeach;
                ?>
            </ul>
            <div class="clear: both;"></div>
        </div><!-- /.carousel -->

        <script type="text/javascript">
            $(function() {
                h2o.imgsViewer($('#topCarousel .slideshow'));
            });
        </script>

js

imgsViewer: function(obj) {
        var fadeDuration = 2000, slideDuration = 4000, currentIndex = 1, nextIndex = 1,
                nextSlide = function() {
                    nextIndex = currentIndex + 1;
                    if (nextIndex > $(obj).children().size()) {
                        nextIndex = 1;
                    }
                    var next = $(obj).find('li:nth-child(' + nextIndex + ')');
                    var curr = $(obj).find('li:nth-child(' + currentIndex + ')');

                    next.addClass('ishow').animate({opacity: 1.0}, fadeDuration);

                    curr.removeClass('ishow').animate({opacity: 0.0}, fadeDuration);

                    currentIndex = nextIndex;

                    setTimeout(nextSlide, slideDuration);
                };
               
        $(obj).find('li').css({opacity: 0.0});
        $(obj).find('li:nth-child(' + nextIndex + ')')
                .addClass('ishow').animate({opacity: 1.0}, fadeDuration);
        setTimeout(nextSlide, slideDuration);
        return this;
    }

Saturday, May 3, 2014

c# app telerik reportViewer, ReportSource, Report class with ReportParameters

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HO.MCAA.GHD.Model;
using HO.MCAA.GHD.Controls;
using HO.MCAA.GHD.Reports;
using HiimelOyun.App.Lib.Settings;
using System.Collections;

namespace HO.MCAA.GHD.Jagsaalt
{
    public partial class frmProductRequestReportViewer : Form
    {
        public ProductRequestHeaderInfo DataHeader { get; set; }

        public frmProductRequestReportViewer()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
        }

        protected override void OnClosing(CancelEventArgs e)
        {
            //this.reportViewer.Report.Dispose();
            this.reportViewer1.Dispose();

            base.OnClosing(e);
        }

        private void frmProductRequestReportViewer_Load(object sender, EventArgs e)
        {
            ProductRequestReport report = new ProductRequestReport();
            Hashtable setting = FormSettingManager.loadSetting(FormSettingManager.GetFilename("frmSetting"));
            try
            {
                report.DataSource = DataHeader.ProductRequestDetails.ToList();
               
                string parDate = DataHeader.RequestDate.Year + " оны " + DataHeader.RequestDate.Month
                    + " -р сарын " + DataHeader.RequestDate.Day + " -ны өдөр";
                string parCentre = (setting["Setting_CentreName"] + string.Empty).ToString();
                string parCode = (setting["Setting_CentreCode"] + string.Empty).ToString();

                //report.ReportParameters["ParDate"].Text;
                report.ReportParameters["ParDate"].Value = parDate;
                report.ReportParameters["ParCentre"].Value = parCentre;
                report.ReportParameters["ParCode"].Value = parCode;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Алдаа", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
            try
            {
                string companyLogo32 = (setting["Setting_CompanyLogo48"] + string.Empty).ToString();
                report.LogoBox.Style.BackgroundImage.ImageData = new Bitmap(companyLogo32);
            }
            catch { }


            // perform additional operations on the report object if needed          
            Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
            instanceReportSource.ReportDocument = report;
            this.reportViewer1.ReportSource = instanceReportSource;
            //this.reportViewer1.Report = report;
            this.reportViewer1.RefreshReport();
        }
    }
}