protected void ddlItem_SelectedIndexChanged(object sender, EventArgs e)
    {
        if ((CurrentEnvironment.LoggedUser != null))
        {
            int    hfId  = CurrentEnvironment.LoggedUser.HealthFacilityId;
            string _hfId = (string)Request.QueryString["hfId"];
            if (!String.IsNullOrEmpty(_hfId))
            {
                int.TryParse(_hfId, out hfId);
            }

            string s = HealthFacility.GetAllChildsForOneHealthFacility(hfId);

            string where = string.Format(@" AND (""VACCINATION_EVENT"".""HEALTH_FACILITY_ID"" in ({0})) ", s);
            string tmp = where;

            HttpContext.Current.Session["VaccinationActivityReport-TempWhere"] = tmp;

            int year = int.Parse(ddlYear.SelectedValue);
            if (year != -1)
            {
                where += string.Format(@" AND EXTRACT(YEAR FROM ""VACCINATION_EVENT"".""VACCINATION_DATE"")::INTEGER = {0} ", year);
            }
            HttpContext.Current.Session["VaccinationActivityReport-Where"] = where;
            string language   = CurrentEnvironment.Language;
            int    languageId = int.Parse(language);

            DataTable dt     = VaccinationActivity.GetVaccinationActivity(languageId, where, Session["__Months"].ToString(), int.Parse(ddlItem.SelectedValue));
            DataTable source = GetDataTable(dt, tmp, languageId);

            string url = VaccinationActivityReportGraphHelper.GetUrl(source, this.lblTitle.Text);

            iActivityReport.Text = String.Format("<img src='{0}' alt='' />", url.Replace(" ", ""));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            if (CurrentEnvironment.LoggedUser != null)
            {
                int    userId     = CurrentEnvironment.LoggedUser.Id;
                string language   = CurrentEnvironment.Language;
                int    languageId = int.Parse(language);

                Dictionary <string, string> wtList = (Dictionary <string, string>)HttpContext.Current.Cache["VaccinationActivityReport-dictionary" + language];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "VaccinationActivityReport");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("VaccinationActivityReport-dictionary" + language, wtList);
                }

                this.lblTitle.Text = wtList["PrintVaccinationActivityReportPageTitle"];
                this.lbItem.Text   = wtList["VaccinationActivityReportItem"];
                this.lbYear.Text   = wtList["VaccinationActivityReportYear"];

                string jan = wtList["Jan"];
                string feb = wtList["Feb"];
                string mar = wtList["Mar"];
                string apr = wtList["Apr"];
                string may = wtList["May"];
                string jun = wtList["Jun"];
                string jul = wtList["Jul"];
                string aug = wtList["Aug"];
                string sep = wtList["Sep"];
                string oct = wtList["Oct"];
                string nov = wtList["Nov"];
                string dec = wtList["Dec"];

                string vaccine = wtList["Vaccine"];
                string total   = wtList["Total"];
                string planned = wtList["Planned"];

                string months = string.Format(@" ""{12}"" text, ""{0}"" int, ""{1}"" int, ""{2}"" int, ""{3}"" int, ""{4}"" int, ""{5}"" int, ""{6}"" int, ""{7}"" int, ""{8}"" int, ""{9}"" int, ""{10}"" int, ""{11}"" int ", jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec, vaccine);

                Session["__Months"]  = months;
                Session["__Total"]   = total;
                Session["__Planned"] = planned;
                string where         = "";
                string tmp = "";
                if (HttpContext.Current.Session["Year"].ToString() != String.Empty)
                {
                    lblYear.Text = HttpContext.Current.Session["Year"].ToString();
                }
                else
                {
                    lblYear.Text = DateTime.Today.Date.Year.ToString();
                }

                if (HttpContext.Current.Session["VaccinationActivityReport-Item"] != String.Empty)
                {
                    lblItem.Text = HttpContext.Current.Session["VaccinationActivityReport-Item"].ToString();
                }

                if (HttpContext.Current.Session["VaccinationActivityReport-Where"].ToString() != String.Empty)
                {
                    where = HttpContext.Current.Session["VaccinationActivityReport-Where"].ToString();
                }
                if (HttpContext.Current.Session["VaccinationActivityReport-TempWhere"].ToString() != String.Empty)
                {
                    tmp = HttpContext.Current.Session["VaccinationActivityReport-TempWhere"].ToString();
                }

                DataTable dt     = VaccinationActivity.GetVaccinationActivity(languageId, where, Session["__Months"].ToString());
                DataTable source = GetDataTable(dt, tmp, languageId);

                gvReport.DataSource = source;
                gvReport.DataBind();

                string url = VaccinationActivityReportGraphHelper.GetUrl(source, this.lblTitle.Text);

                iActivityReport.Text = String.Format("<img src='{0}' alt='' />", url.Replace(" ", ""));
            }
            else
            {
                Response.Redirect("Default.aspx", false);
            }
        }
    }