Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            List <string> actionList        = null;
            string        sessionNameAction = "";
            if (CurrentEnvironment.LoggedUser != null)
            {
                sessionNameAction = "__GIS_actionList_" + CurrentEnvironment.LoggedUser.Id;
                actionList        = (List <string>)Session[sessionNameAction];
            }

            if ((actionList != null) && actionList.Contains("ViewChildList") && (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["Child-dictionary" + language];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "Child");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("Child-dictionary" + language, wtList);
                }

                #region Person Configuration

                List <PersonConfiguration> pcList = PersonConfiguration.GetPersonConfigurationList();

                foreach (PersonConfiguration pc in pcList)
                {
                    if (pc.IsVisible == false)
                    {
                        Control lbl = FindMyControl(this, "lbl" + pc.ColumnName);
                        Control txt = FindMyControl(this, "txt" + pc.ColumnName);
                        //Control rbl = FindMyControl(this, "rbl" + pc.ColumnName);
                        Control tr = FindMyControl(this, "tr" + pc.ColumnName);

                        if (lbl != null)
                        {
                            lbl.Visible = false;
                        }

                        if (txt != null)
                        {
                            txt.Visible = false;
                        }

                        //if (rbl != null)
                        //    rbl.Visible = false;

                        if (tr != null)
                        {
                            tr.Visible = false;
                        }

                        for (int i = 1; i < gvChild.Columns.Count; i++)
                        {
                            if (gvChild.Columns[i].HeaderText == pc.ColumnName)
                            {
                                gvChild.Columns[i].Visible = false;
                                break;
                            }
                        }
                    }
                }
                string id1 = Configuration.GetConfigurationByName("IdentificationNo1").Value;
                string id2 = Configuration.GetConfigurationByName("IdentificationNo2").Value;
                string id3 = Configuration.GetConfigurationByName("IdentificationNo3").Value;
                #endregion

                //grid header text
                #region Grid Columns
                gvChild.Columns[1].HeaderText  = wtList["ChildSystem"];
                gvChild.Columns[2].HeaderText  = wtList["ChildFirstname1"];
                gvChild.Columns[3].HeaderText  = wtList["ChildFirstname2"];
                gvChild.Columns[4].HeaderText  = wtList["ChildLastname1"];
                gvChild.Columns[5].HeaderText  = wtList["ChildLastname2"];
                gvChild.Columns[6].HeaderText  = wtList["ChildBirthdate"];
                gvChild.Columns[7].HeaderText  = wtList["ChildGender"];
                gvChild.Columns[8].HeaderText  = wtList["ChildHealthcenter"];
                gvChild.Columns[9].HeaderText  = wtList["ChildBirthplace"];
                gvChild.Columns[10].HeaderText = wtList["ChildCommunity"];
                gvChild.Columns[11].HeaderText = wtList["ChildDomicile"];
                gvChild.Columns[12].HeaderText = wtList["ChildStatus"];
                gvChild.Columns[13].HeaderText = wtList["ChildAddress"];
                gvChild.Columns[14].HeaderText = wtList["ChildPhone"];
                gvChild.Columns[15].HeaderText = wtList["ChildMobile"];
                gvChild.Columns[16].HeaderText = wtList["ChildEmail"];
                gvChild.Columns[17].HeaderText = wtList["ChildMother"];
                gvChild.Columns[18].HeaderText = wtList["ChildMotherFirstname"];
                gvChild.Columns[19].HeaderText = wtList["ChildMotherLastname"];
                gvChild.Columns[20].HeaderText = wtList["ChildFather"];
                gvChild.Columns[21].HeaderText = wtList["ChildFatherFirstname"];
                gvChild.Columns[22].HeaderText = wtList["ChildFatherLastname"];
                gvChild.Columns[23].HeaderText = wtList["ChildCaretaker"];
                gvChild.Columns[24].HeaderText = wtList["ChildCaretakerFirstname"];
                gvChild.Columns[25].HeaderText = wtList["ChildCaretakerLastname"];
                gvChild.Columns[26].HeaderText = wtList["ChildNotes"];
                gvChild.Columns[27].HeaderText = wtList["ChildIsActive"];
                gvChild.Columns[30].HeaderText = id1;
                gvChild.Columns[31].HeaderText = id2;
                gvChild.Columns[32].HeaderText = id3;
                gvChild.Columns[26].Visible    = false;

                gvExel.Columns[1].HeaderText  = wtList["ChildSystem"];
                gvExel.Columns[2].HeaderText  = wtList["ChildFirstname1"];
                gvExel.Columns[3].HeaderText  = wtList["ChildFirstname2"];
                gvExel.Columns[4].HeaderText  = wtList["ChildLastname1"];
                gvExel.Columns[5].HeaderText  = wtList["ChildLastname2"];
                gvExel.Columns[6].HeaderText  = wtList["ChildBirthdate"];
                gvExel.Columns[7].HeaderText  = wtList["ChildGender"];
                gvExel.Columns[8].HeaderText  = wtList["ChildHealthcenter"];
                gvExel.Columns[9].HeaderText  = wtList["ChildBirthplace"];
                gvExel.Columns[10].HeaderText = wtList["ChildCommunity"];
                gvExel.Columns[11].HeaderText = wtList["ChildDomicile"];
                gvExel.Columns[12].HeaderText = wtList["ChildStatus"];
                gvExel.Columns[13].HeaderText = wtList["ChildAddress"];
                gvExel.Columns[14].HeaderText = wtList["ChildPhone"];
                gvExel.Columns[15].HeaderText = wtList["ChildMobile"];
                gvExel.Columns[16].HeaderText = wtList["ChildEmail"];
                gvExel.Columns[17].HeaderText = wtList["ChildMother"];
                gvExel.Columns[18].HeaderText = wtList["ChildMotherFirstname"];
                gvExel.Columns[19].HeaderText = wtList["ChildMotherLastname"];
                gvExel.Columns[20].HeaderText = wtList["ChildFather"];
                gvExel.Columns[21].HeaderText = wtList["ChildFatherFirstname"];
                gvExel.Columns[22].HeaderText = wtList["ChildFatherLastname"];
                gvExel.Columns[23].HeaderText = wtList["ChildCaretaker"];
                gvExel.Columns[24].HeaderText = wtList["ChildCaretakerFirstname"];
                gvExel.Columns[25].HeaderText = wtList["ChildCaretakerLastname"];
                gvExel.Columns[26].HeaderText = wtList["ChildNotes"];
                gvExel.Columns[27].HeaderText = wtList["ChildIsActive"];
                gvExel.Columns[30].HeaderText = id1;
                gvExel.Columns[31].HeaderText = id2;
                gvExel.Columns[32].HeaderText = id3;
                gvExel.Columns[26].Visible    = false;
                #endregion

                //message
                this.lblWarning.Text = wtList["ChildSearchWarningText"];

                //buttons
                //this.btnSearch.Text = wtList["ChildSearchAgainButton"];//Add this entry in DB
                this.btnExcel.Text = wtList["ChildExcelButton"];

                //Page Title
                this.lblTitle.Text = wtList["ChildListNewPageTitle"];

                odsChild.SelectParameters.Clear();

                if (HttpContext.Current.Session["_statusChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("statusId", HttpContext.Current.Session["_statusChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_birthdateFromChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("birthdateFrom", HttpContext.Current.Session["_birthdateFromChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_birthdateToChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("birthdateTo", HttpContext.Current.Session["_birthdateToChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_firstname1ChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("firstname1", HttpContext.Current.Session["_firstname1ChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_lastname1ChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("lastname1", HttpContext.Current.Session["_lastname1ChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_motherfirstname1ChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("motherFirstname", HttpContext.Current.Session["_motherfirstname1ChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_motherlastname1ChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("motherLastname", HttpContext.Current.Session["_motherlastname1ChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_idFieldsChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("idFields", HttpContext.Current.Session["_idFieldsChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_systemIdChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("systemId", HttpContext.Current.Session["_systemIdChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_barcodeIdChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("barcodeId", HttpContext.Current.Session["_barcodeIdChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_tempIdChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("tempId", HttpContext.Current.Session["_tempIdChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_healthCenterIdChildListNew"] != null)
                {
                    odsChild.SelectParameters.Add("healthFacilityId", HttpContext.Current.Session["_healthCenterIdChildListNew"].ToString());
                }
                if (HttpContext.Current.Session["_birthplace"] != null)
                {
                    odsChild.SelectParameters.Add("birthplaceId", HttpContext.Current.Session["_birthplace"].ToString());
                }
                else
                {
                    odsChild.SelectParameters.Add("birthplaceId", "");
                }
                if (HttpContext.Current.Session["_community"] != null)
                {
                    odsChild.SelectParameters.Add("communityId", HttpContext.Current.Session["_community"].ToString());
                }
                else
                {
                    odsChild.SelectParameters.Add("communityId", "");
                }
                if (HttpContext.Current.Session["_domicile"] != null)
                {
                    odsChild.SelectParameters.Add("domicileId", HttpContext.Current.Session["_domicile"].ToString());
                }
                else
                {
                    odsChild.SelectParameters.Add("domicileId", "");
                }

                //if (odsChild.SelectParameters.Count > 3)  // why
                //{
                gvChild.DataSourceID = "odsChild";
                gvChild.DataBind();
                //}
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
    }
    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["Child-dictionary" + language];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "Child");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("Child-dictionary" + language, wtList);
                }
                #region Person Configuration

                List <PersonConfiguration> pcList = PersonConfiguration.GetPersonConfigurationList();

                foreach (PersonConfiguration pc in pcList)
                {
                    if (pc.IsVisible == false)
                    {
                        Control lbl = FindMyControl(this, "lbl" + pc.ColumnName);
                        Control txt = FindMyControl(this, "txt" + pc.ColumnName);
                        Control tr  = FindMyControl(this, "tr" + pc.ColumnName);

                        if (lbl != null)
                        {
                            lbl.Visible = false;
                        }

                        if (txt != null)
                        {
                            txt.Visible = false;
                        }



                        if (tr != null)
                        {
                            tr.Visible = false;
                        }

                        for (int i = 1; i < gvChild.Columns.Count; i++)
                        {
                            if (gvChild.Columns[i].HeaderText == pc.ColumnName)
                            {
                                gvChild.Columns[i].Visible = false;
                                break;
                            }
                        }
                    }
                }
                string id1 = Configuration.GetConfigurationByName("IdentificationNo1").Value;
                string id2 = Configuration.GetConfigurationByName("IdentificationNo2").Value;
                string id3 = Configuration.GetConfigurationByName("IdentificationNo3").Value;
                #endregion

                this.lbHealthFacility.Text = wtList["ImmunizedChildrenByLotHealthFacility"];
                this.lbLotId.Text          = wtList["ImmunizedChildrenByLotItemLot"];
                this.lbChildNo.Text        = wtList["ImmunizedChildrenByLotChildrenNo"];

                this.lblTitle.Text = wtList["PrintImmunizedChildrenByLotPageTitle"];

                //grid header text
                #region Grid Columns
                gvChild.Columns[1].HeaderText  = wtList["ChildSystem"];
                gvChild.Columns[2].HeaderText  = wtList["ChildFirstname1"];
                gvChild.Columns[3].HeaderText  = wtList["ChildFirstname2"];
                gvChild.Columns[4].HeaderText  = wtList["ChildLastname1"];
                gvChild.Columns[5].HeaderText  = wtList["ChildLastname2"];
                gvChild.Columns[6].HeaderText  = wtList["ChildBirthdate"];
                gvChild.Columns[7].HeaderText  = wtList["ChildGender"];
                gvChild.Columns[8].HeaderText  = wtList["ChildHealthcenter"];
                gvChild.Columns[9].HeaderText  = wtList["ChildBirthplace"];
                gvChild.Columns[10].HeaderText = wtList["ChildCommunity"];
                gvChild.Columns[11].HeaderText = wtList["ChildDomicile"];
                gvChild.Columns[12].HeaderText = wtList["ChildStatus"];
                gvChild.Columns[13].HeaderText = wtList["ChildAddress"];
                gvChild.Columns[14].HeaderText = wtList["ChildPhone"];
                gvChild.Columns[15].HeaderText = wtList["ChildMobile"];
                gvChild.Columns[16].HeaderText = wtList["ChildEmail"];
                gvChild.Columns[17].HeaderText = wtList["ChildMother"];
                gvChild.Columns[18].HeaderText = wtList["ChildMotherFirstname"];
                gvChild.Columns[19].HeaderText = wtList["ChildMotherLastname"];
                gvChild.Columns[20].HeaderText = wtList["ChildFather"];
                gvChild.Columns[21].HeaderText = wtList["ChildFatherFirstname"];
                gvChild.Columns[22].HeaderText = wtList["ChildFatherLastname"];
                gvChild.Columns[23].HeaderText = wtList["ChildCaretaker"];
                gvChild.Columns[24].HeaderText = wtList["ChildCaretakerFirstname"];
                gvChild.Columns[25].HeaderText = wtList["ChildCaretakerLastname"];
                gvChild.Columns[26].HeaderText = wtList["ChildNotes"];
                gvChild.Columns[27].HeaderText = wtList["ChildIsActive"];
                gvChild.Columns[30].HeaderText = id1;
                gvChild.Columns[31].HeaderText = id2;
                gvChild.Columns[32].HeaderText = id3;

                #endregion

                int    hfId  = CurrentEnvironment.LoggedUser.HealthFacilityId;
                string _hfId = (string)Request.QueryString["hfId"];
                if (!String.IsNullOrEmpty(_hfId))
                {
                    int.TryParse(_hfId, out hfId);
                }

                int lotId = 0;
                lotId = Helper.ConvertToInt(HttpContext.Current.Session["ImmunizedChildrenByLot-lotID"].ToString());

                lblHealthFacility.Text = HealthFacility.GetHealthFacilityById(hfId).Name;
                if (lotId != 0)
                {
                    lblLotId.Text = ItemLot.GetItemLotById(lotId).LotNumber;
                }
                lblChildNo.Text = Child.GetCountImmunizedChildrenByLot(hfId, lotId).ToString();
                int maximumRows   = int.MaxValue;
                int startRowIndex = 0;

                List <Child> list = Child.GetImmunizedChildrenByLot(ref maximumRows, ref startRowIndex, hfId, lotId);
                gvChild.DataSource = list;
                gvChild.DataBind();
            }
            else
            {
                Response.Redirect("Default.aspx", false);
            }
        }
    }
Exemple #3
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string where = string.Format(@" ""STATUS_ID"" = {0} ", ddlStatus.SelectedValue);
        DateTime dateto   = new DateTime();
        DateTime datefrom = new DateTime();
        string   bdcontrol;

        if ((txtBirthdateFrom.Text != String.Empty) && (txtBirthdateTo.Text != String.Empty))
        {
            datefrom  = DateTime.ParseExact(txtBirthdateFrom.Text, ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(), CultureInfo.CurrentCulture);
            dateto    = DateTime.ParseExact(txtBirthdateTo.Text, ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(), CultureInfo.CurrentCulture);
            bdcontrol = string.Format(@" AND ""BIRTHDATE"" between '{0}' and '{1}'", datefrom.ToString("yyyy-MM-dd"), dateto.ToString("yyyy-MM-dd"));
        }
        else if (txtBirthdateFrom.Text != String.Empty)
        {
            datefrom  = DateTime.ParseExact(txtBirthdateFrom.Text, ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(), CultureInfo.CurrentCulture);
            bdcontrol = string.Format(@" AND ""BIRTHDATE"" >= '{0}' ", datefrom.ToString("yyyy-MM-dd"));
        }
        else if (txtBirthdateTo.Text != String.Empty)
        {
            dateto    = DateTime.ParseExact(txtBirthdateTo.Text, ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(), CultureInfo.CurrentCulture);
            bdcontrol = string.Format(@" AND ""BIRTHDATE"" <= '{0}' ", dateto.ToString("yyyy-MM-dd"));
        }
        else
        {
            bdcontrol = "";
        }
        where += bdcontrol;
        List <PersonConfiguration> pcList = PersonConfiguration.GetPersonConfigurationList();

        foreach (PersonConfiguration pc in pcList)
        {
            if (pc.IsVisible == true)
            {
                Control c            = FindMyControl(this, "txt" + pc.ColumnName);
                string  dbColumnName = string.Empty;
                if (pc.ColumnName.Contains("Identification"))
                {
                    dbColumnName = pc.ColumnName.ToUpper().Replace("NO", "_NO");
                }
                else
                {
                    dbColumnName = pc.ColumnName.ToUpper().Replace("ID", "_ID").Replace("ERFIRSTNAME", "ER_FIRSTNAME").Replace("ERLASTNAME", "ER_LASTNAME");
                }

                if (dbColumnName.Contains("HEALTHCENTER") && healthFacilityId != null)
                {
                    where += string.Format(@" AND ""HEALTHCENTER_ID"" = {0} ", healthFacilityId);
                }

                if (dbColumnName.Contains("BIRTHPLACE") && birthplaceId != null)
                {
                    where += string.Format(@" AND ""BIRTHPLACE_ID"" = {0} ", birthplaceId);
                }

                if (dbColumnName.Contains("COMMUNITY") && communityId != null)
                {
                    where += string.Format(@" AND ""COMMUNITY_ID"" = {0} ", communityId);
                }

                if (dbColumnName.Contains("DOMICILE") && domicileId != null)
                {
                    where += string.Format(@" AND ""DOMICILE_ID"" = {0} ", domicileId);
                }

                if (c is TextBox)
                {
                    if (!string.IsNullOrEmpty((c as TextBox).Text))
                    {
                        if (dbColumnName.Contains("BIRTHDATE"))
                        {
                            where += "";
                        }

                        //else if (dbColumnName.Contains("FIRSTNAME") || dbColumnName.Contains("LASTNAME"))
                        //    where += string.Format(@" AND UPPER(""{1}"") LIKE '%{0}%' ", (c as TextBox).Text.ToUpper(), dbColumnName);
                        else
                        {
                            where += string.Format(@" AND UPPER(""{1}"") LIKE '%{0}%' ", (c as TextBox).Text.ToUpper(), dbColumnName);
                        }
                    }
                }
            }
        }
        HttpContext.Current.Session["_whereChildList"] = where;

        healthFacilityId = null;
        domicileId       = null;
        communityId      = null;
        birthplaceId     = null;

        odsChild.SelectParameters.Clear();
        odsChild.SelectParameters.Add("where", where);

        gvChild.DataSourceID = "odsChild";
        gvChild.DataBind();
        Response.Redirect(Request.RawUrl);
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            List <string> actionList        = null;
            string        sessionNameAction = "";
            if (CurrentEnvironment.LoggedUser != null)
            {
                sessionNameAction = "__GIS_actionList_" + CurrentEnvironment.LoggedUser.Id;
                actionList        = (List <string>)Session[sessionNameAction];
            }

            if ((actionList != null) && actionList.Contains("ViewChildList") && (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["Child-dictionary1"];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "Child");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("Child-dictionary" + language, wtList);
                }

                #region Person Configuration

                List <PersonConfiguration> pcList = PersonConfiguration.GetPersonConfigurationList();

                foreach (PersonConfiguration pc in pcList)
                {
                    if (pc.IsVisible == false)
                    {
                        Control lbl = FindMyControl(this, "lbl" + pc.ColumnName);
                        Control txt = FindMyControl(this, "txt" + pc.ColumnName);
                        //Control rbl = FindMyControl(this, "rbl" + pc.ColumnName);
                        Control tr = FindMyControl(this, "tr" + pc.ColumnName);

                        if (lbl != null)
                        {
                            lbl.Visible = false;
                        }

                        if (txt != null)
                        {
                            txt.Visible = false;
                        }

                        //if (rbl != null)
                        //    rbl.Visible = false;

                        if (tr != null)
                        {
                            tr.Visible = false;
                        }

                        for (int i = 1; i < gvChild.Columns.Count; i++)
                        {
                            if (i == 26)
                            {
                                gvChild.Columns[i].Visible = false;
                            }
                            if (gvChild.Columns[i].HeaderText == pc.ColumnName)
                            {
                                gvChild.Columns[i].Visible = false;
                                break;
                            }
                        }
                    }
                }

                string id1 = Configuration.GetConfigurationByName("IdentificationNo1").Value;
                string id2 = Configuration.GetConfigurationByName("IdentificationNo2").Value;
                string id3 = Configuration.GetConfigurationByName("IdentificationNo3").Value;
                #endregion

                //controls
                #region Controls
                this.lblSystemId.Text           = wtList["ChildSystem"];
                this.lblFirstname1.Text         = wtList["ChildFirstname1"];
                this.lblFirstname2.Text         = wtList["ChildFirstname2"];
                this.lblLastname1.Text          = wtList["ChildLastname1"];
                this.lblLastname2.Text          = wtList["ChildLastname2"];
                this.lblBirthdateFrom.Text      = wtList["ChildBirthdateFrom"];
                this.lblBirthdateTo.Text        = wtList["ChildBirthdateTo"];
                this.lblHealthcenterId.Text     = wtList["ChildHealthcenter"];
                this.lblBirthplaceId.Text       = wtList["ChildBirthplace"];
                this.lblCommunityId.Text        = wtList["ChildCommunity"];
                this.lblDomicileId.Text         = wtList["ChildDomicile"];
                this.lblStatusId.Text           = wtList["ChildStatus"];
                this.lblAddress.Text            = wtList["ChildAddress"];
                this.lblPhone.Text              = wtList["ChildPhone"];
                this.lblMobile.Text             = wtList["ChildMobile"];
                this.lblEmail.Text              = wtList["ChildEmail"];
                this.lblMotherId.Text           = wtList["ChildMother"];
                this.lblMotherFirstname.Text    = wtList["ChildMotherFirstname"];
                this.lblMotherLastname.Text     = wtList["ChildMotherLastname"];
                this.lblFatherId.Text           = wtList["ChildFather"];
                this.lblFatherFirstname.Text    = wtList["ChildFatherFirstname"];
                this.lblFatherLastname.Text     = wtList["ChildFatherLastname"];
                this.lblCaretakerId.Text        = wtList["ChildCaretaker"];
                this.lblCaretakerFirstname.Text = wtList["ChildCaretakerFirstname"];
                this.lblCaretakerLastname.Text  = wtList["ChildCaretakerLastname"];
                this.lblNotes.Text              = wtList["ChildNotes"];
                this.lblIsActive.Text           = wtList["ChildIsActive"];
                this.lblIdentificationNo1.Text  = id1;
                this.lblIdentificationNo2.Text  = id2;
                this.lblIdentificationNo3.Text  = id3;

                #endregion

                //grid header text
                #region Grid Columns
                gvChild.Columns[1].HeaderText  = wtList["ChildSystem"];
                gvChild.Columns[2].HeaderText  = wtList["ChildFirstname1"];
                gvChild.Columns[3].HeaderText  = wtList["ChildFirstname2"];
                gvChild.Columns[4].HeaderText  = wtList["ChildLastname1"];
                gvChild.Columns[5].HeaderText  = wtList["ChildLastname2"];
                gvChild.Columns[6].HeaderText  = wtList["ChildBirthdate"];
                gvChild.Columns[7].HeaderText  = wtList["ChildGender"];
                gvChild.Columns[8].HeaderText  = wtList["ChildHealthcenter"];
                gvChild.Columns[9].HeaderText  = wtList["ChildBirthplace"];
                gvChild.Columns[10].HeaderText = wtList["ChildCommunity"];
                gvChild.Columns[11].HeaderText = wtList["ChildDomicile"];
                gvChild.Columns[12].HeaderText = wtList["ChildStatus"];
                gvChild.Columns[13].HeaderText = wtList["ChildAddress"];
                gvChild.Columns[14].HeaderText = wtList["ChildPhone"];
                gvChild.Columns[15].HeaderText = wtList["ChildMobile"];
                gvChild.Columns[16].HeaderText = wtList["ChildEmail"];
                gvChild.Columns[17].HeaderText = wtList["ChildMother"];
                gvChild.Columns[18].HeaderText = wtList["ChildMotherFirstname"];
                gvChild.Columns[19].HeaderText = wtList["ChildMotherLastname"];
                gvChild.Columns[20].HeaderText = wtList["ChildFather"];
                gvChild.Columns[21].HeaderText = wtList["ChildFatherFirstname"];
                gvChild.Columns[22].HeaderText = wtList["ChildFatherLastname"];
                gvChild.Columns[23].HeaderText = wtList["ChildCaretaker"];
                gvChild.Columns[24].HeaderText = wtList["ChildCaretakerFirstname"];
                gvChild.Columns[25].HeaderText = wtList["ChildCaretakerLastname"];
                gvChild.Columns[26].HeaderText = wtList["ChildNotes"];
                gvChild.Columns[27].HeaderText = wtList["ChildIsActive"];
                gvChild.Columns[30].HeaderText = id1;
                gvChild.Columns[31].HeaderText = id2;
                gvChild.Columns[32].HeaderText = id3;

                gvChild.Columns[26].Visible = false;
                #endregion

                //buttons
                this.btnSearch.Text = wtList["ChildSearchButton"];

                //message
                //this.lblSuccess.Text = wtList["ChildSuccessText"];
                this.lblWarning.Text = wtList["ChildSearchWarningText"];
                //this.lblWarning.Text = wtList["ChildWarningText"];
                //this.lblError.Text = wtList["ChildErrorText"];

                //Page Title
                this.lblTitle.Text = wtList["ChildListPageTitle"];

                //validators
                ConfigurationDate cd = ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value));
                ceBirthdateFrom.Format                = cd.DateFormat;
                ceBirthdateTo.Format                  = cd.DateFormat;
                revBirthdateFrom.ErrorMessage         = cd.DateFormat;
                revBirthdateTo.ErrorMessage           = cd.DateFormat;
                revBirthdateFrom.ValidationExpression = cd.DateExpresion;
                revBirthdateTo.ValidationExpression   = cd.DateExpresion;

                if (HttpContext.Current.Session["_whereChildList"] != null)
                {
                    string where = HttpContext.Current.Session["_whereChildList"].ToString();
                    odsChild.SelectParameters.Clear();
                    odsChild.SelectParameters.Add("where", where);

                    gvChild.DataSourceID = "odsChild";
                    gvChild.DataBind();
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
    }
    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["Child-dictionary" + language];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "Child");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("Child-dictionary" + language, wtList);
                }
                #region Person Configuration

                List <PersonConfiguration> pcList = PersonConfiguration.GetPersonConfigurationList();

                foreach (PersonConfiguration pc in pcList)
                {
                    if (pc.IsVisible == false)
                    {
                        //Control lbl = FindMyControl(this, "lbl" + pc.ColumnName);
                        //Control txt = FindMyControl(this, "txt" + pc.ColumnName);
                        ////Control rbl = FindMyControl(this, "rbl" + pc.ColumnName);
                        //Control tr = FindMyControl(this, "tr" + pc.ColumnName);

                        //if (lbl != null)
                        //    lbl.Visible = false;

                        //if (txt != null)
                        //    txt.Visible = false;

                        //if (rbl != null)
                        //    rbl.Visible = false;

                        //if (tr != null)
                        //    tr.Visible = false;

                        for (int i = 1; i < gvChild.Columns.Count; i++)
                        {
                            if (gvChild.Columns[i].HeaderText == pc.ColumnName)
                            {
                                gvChild.Columns[i].Visible = false;
                                break;
                            }
                        }
                    }
                }

                #endregion

                this.lbHealthFacility.Text = wtList["ChildHealthcenter"];
                this.lbVaccine.Text        = wtList["ChildVaccine"];

                this.lblTitle.Text = wtList["PrintNotImmunizedChildrenPageTitle"];

                //grid header text
                #region Grid Columns
                gvChild.Columns[1].HeaderText  = wtList["ChildNonVaccinationReason"];
                gvChild.Columns[2].HeaderText  = wtList["ChildSystem"];
                gvChild.Columns[3].HeaderText  = wtList["ChildFirstname1"];
                gvChild.Columns[4].HeaderText  = wtList["ChildFirstname2"];
                gvChild.Columns[5].HeaderText  = wtList["ChildLastname1"];
                gvChild.Columns[6].HeaderText  = wtList["ChildLastname2"];
                gvChild.Columns[7].HeaderText  = wtList["ChildBirthdate"];
                gvChild.Columns[8].HeaderText  = wtList["ChildGender"];
                gvChild.Columns[9].HeaderText  = wtList["ChildHealthcenter"];
                gvChild.Columns[10].HeaderText = wtList["ChildBirthplace"];
                gvChild.Columns[11].HeaderText = wtList["ChildMotherFirstname"];
                gvChild.Columns[12].HeaderText = wtList["ChildMotherLastname"];
                gvChild.Columns[13].HeaderText = wtList["ChildFatherFirstname"];
                gvChild.Columns[14].HeaderText = wtList["ChildFatherLastname"];

                #endregion

                int    hfId  = CurrentEnvironment.LoggedUser.HealthFacilityId;
                string _hfId = (string)Request.QueryString["hfId"];
                if (!String.IsNullOrEmpty(_hfId))
                {
                    int.TryParse(_hfId, out hfId);
                }

                lblHealthFacility.Text = HealthFacility.GetHealthFacilityById(hfId).Name;
                lblVaccine.Text        = HttpContext.Current.Session["vaccine"].ToString();

                int maximumRows   = int.MaxValue;
                int startRowIndex = 0;
                string where = HttpContext.Current.Session["whereExcelNotImmunized"].ToString();
                List <Child> list = Child.GetNotImmunizedChildren(ref maximumRows, ref startRowIndex, where);
                gvChild.DataSource = list;
                gvChild.DataBind();
            }
            else
            {
                Response.Redirect("Default.aspx", false);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            List <string> actionList        = null;
            string        sessionNameAction = "";
            if (CurrentEnvironment.LoggedUser != null)
            {
                sessionNameAction = "__GIS_actionList_" + CurrentEnvironment.LoggedUser.Id;
                actionList        = (List <string>)Session[sessionNameAction];
            }

            if ((actionList != null) && actionList.Contains("ViewChildList") && (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["Child-dictionary" + language];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "Child");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("Child-dictionary" + language, wtList);
                }

                #region Person Configuration

                List <PersonConfiguration> pcList = PersonConfiguration.GetPersonConfigurationList();

                foreach (PersonConfiguration pc in pcList)
                {
                    if (pc.IsVisible == false)
                    {
                        Control lbl = FindMyControl(this, "lbl" + pc.ColumnName);
                        Control txt = FindMyControl(this, "txt" + pc.ColumnName);
                        //Control rbl = FindMyControl(this, "rbl" + pc.ColumnName);
                        Control tr = FindMyControl(this, "tr" + pc.ColumnName);

                        if (lbl != null)
                        {
                            lbl.Visible = false;
                        }

                        if (txt != null)
                        {
                            txt.Visible = false;
                        }

                        //if (rbl != null)
                        //    rbl.Visible = false;

                        if (tr != null)
                        {
                            tr.Visible = false;
                        }
                    }
                }
                string id1 = Configuration.GetConfigurationByName("IdentificationNo1").Value;
                string id2 = Configuration.GetConfigurationByName("IdentificationNo2").Value;
                string id3 = Configuration.GetConfigurationByName("IdentificationNo3").Value;
                #endregion

                //controls
                #region Controls

                this.lblSystemId.Text        = wtList["ChildSystem"];
                this.lblBarcode.Text         = wtList["BarcodeId"];
                this.lblTempId.Text          = wtList["TempId"];
                this.lblFirstname1.Text      = wtList["ChildFirstname1"];
                this.lblLastname1.Text       = wtList["ChildLastname1"];
                this.lblMotherFirstname.Text = wtList["ChildMotherFirstname"];
                this.lblMotherLastname.Text  = wtList["ChildMotherLastname"];
                this.lblBirthdateFrom.Text   = wtList["ChildBirthdateFrom"];
                this.lblBirthdateTo.Text     = wtList["ChildBirthdateTo"];
                this.lblHealthcenterId.Text  = wtList["ChildHealthcenter"];
                this.lblBirthplaceId.Text    = wtList["ChildBirthplace"];
                this.lblCommunityId.Text     = wtList["ChildCommunity"];
                this.lblDomicileId.Text      = wtList["ChildDomicile"];
                this.lblStatusId.Text        = wtList["ChildStatus"];


                #endregion


                //buttons
                this.btnSearch.Text = wtList["ChildSearchButton"];
                //this.btnExcel.Text = wtList["ChildExcelButton"];

                //Page Title
                this.lblTitle.Text = wtList["ChildListNewPageTitle"];

                //message
                this.lblWarning.Text = wtList["ChildSearchWarningText"];

                //validators
                ConfigurationDate cd = ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value));
                ceBirthdateFrom.Format                = cd.DateFormat;
                ceBirthdateTo.Format                  = cd.DateFormat;
                revBirthdateFrom.ErrorMessage         = cd.DateFormat;
                revBirthdateTo.ErrorMessage           = cd.DateFormat;
                revBirthdateFrom.ValidationExpression = cd.DateExpresion;
                revBirthdateTo.ValidationExpression   = cd.DateExpresion;

                ceBirthdateFrom.EndDate = DateTime.Today.Date;
                ceBirthdateTo.EndDate   = DateTime.Today.Date;
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
    }
Exemple #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            List <string> actionList        = null;
            string        sessionNameAction = "";
            if (CurrentEnvironment.LoggedUser != null)
            {
                sessionNameAction = "__GIS_actionList_" + CurrentEnvironment.LoggedUser.Id;
                actionList        = (List <string>)Session[sessionNameAction];
            }

            if ((actionList != null) && actionList.Contains("ViewFindDuplications") && (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["Child-dictionary" + language];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "Child");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("Child-dictionary" + language, wtList);
                }

                #region Person Configuration

                List <PersonConfiguration> pcList = PersonConfiguration.GetPersonConfigurationList();

                foreach (PersonConfiguration pc in pcList)
                {
                    if (pc.IsVisible == false)
                    {
                        Control lbl = FindMyControl(this, "lbl" + pc.ColumnName);
                        Control txt = FindMyControl(this, "txt" + pc.ColumnName);
                        //Control rbl = FindMyControl(this, "rbl" + pc.ColumnName);
                        Control tr = FindMyControl(this, "tr" + pc.ColumnName);

                        if (lbl != null)
                        {
                            lbl.Visible = false;
                        }

                        if (txt != null)
                        {
                            txt.Visible = false;
                        }

                        //if (rbl != null)
                        //    rbl.Visible = false;

                        if (tr != null)
                        {
                            tr.Visible = false;
                        }

                        for (int i = 1; i < gvChild.Columns.Count; i++)
                        {
                            if (gvChild.Columns[i].HeaderText == pc.ColumnName)
                            {
                                gvChild.Columns[i].Visible = false;
                                break;
                            }
                        }
                    }
                }
                string id1 = Configuration.GetConfigurationByName("IdentificationNo1").Value;
                string id2 = Configuration.GetConfigurationByName("IdentificationNo2").Value;
                string id3 = Configuration.GetConfigurationByName("IdentificationNo3").Value;
                #endregion

                //controls
                #region Controls

                this.chbFirstname.Text = wtList["ChildFirstname1"];
                this.chbLastname.Text  = wtList["ChildLastname1"];
                this.chbBirthdate.Text = wtList["ChildBirthdate"];
                this.chbGender.Text    = wtList["ChildGender"];


                #endregion

                //grid header text
                #region Grid Columns
                gvChild.Columns[1].HeaderText  = wtList["ChildSystem"];
                gvChild.Columns[2].HeaderText  = wtList["ChildFirstname1"];
                gvChild.Columns[3].HeaderText  = wtList["ChildFirstname2"];
                gvChild.Columns[4].HeaderText  = wtList["ChildLastname1"];
                gvChild.Columns[5].HeaderText  = wtList["ChildLastname2"];
                gvChild.Columns[6].HeaderText  = wtList["ChildBirthdate"];
                gvChild.Columns[7].HeaderText  = wtList["ChildGender"];
                gvChild.Columns[8].HeaderText  = wtList["ChildHealthcenter"];
                gvChild.Columns[9].HeaderText  = wtList["ChildBirthplace"];
                gvChild.Columns[10].HeaderText = wtList["ChildStatus"];
                gvChild.Columns[11].HeaderText = wtList["ChildMotherFirstname"];
                gvChild.Columns[12].HeaderText = wtList["ChildMotherLastname"];
                gvChild.Columns[13].HeaderText = wtList["ChildFatherFirstname"];
                gvChild.Columns[14].HeaderText = wtList["ChildFatherLastname"];
                gvChild.Columns[15].HeaderText = id1;
                gvChild.Columns[16].HeaderText = id2;
                gvChild.Columns[17].HeaderText = id3;
                #endregion

                //buttons
                this.btnSearch.Text = wtList["ChildSearchButton"];
                this.btnExcel.Text  = wtList["ChildExcelButton"];

                //Page Title
                this.lblTitle.Text = wtList["ChildFindDuplications"];

                //message
                this.lblWarningText.Text = wtList["ChildSearchWarningText"];
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
    }
Exemple #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region Validator

        string        tmp = "";
        StringBuilder sb  = new StringBuilder();

        //sb.AppendLine("<script type=\"text/javaScript\">");
        sb.AppendLine("function cvChild_Validate(sender, args) {");

        List <PersonConfiguration> pcList1 = PersonConfiguration.GetPersonConfigurationList();

        foreach (PersonConfiguration pc in pcList1)
        {
            if (pc.IsMandatory)
            {
                if (pc.ColumnName.Contains("Health"))
                {
                    tmp += "(document.getElementById('ctl00_ContentPlaceHolder1_txtHealthcenterId_SBox').value == '') || ";
                    continue;
                }
                if (pc.ColumnName.Contains("Birthplace"))
                {
                    tmp += "(document.getElementById('ctl00_ContentPlaceHolder1_ddlBirthplace').value == '-1') || ";
                    continue;
                }
                if (pc.ColumnName.Contains("Community"))
                {
                    tmp += "(document.getElementById('ctl00_ContentPlaceHolder1_txtCommunityId_CBox').value == '') || ";
                    continue;
                }
                if (pc.ColumnName.Contains("Domicile"))
                {
                    tmp += "(document.getElementById('ctl00_ContentPlaceHolder1_txtDomicileId_DBox').value == '') || ";
                    continue;
                }
                if (!pc.ColumnName.Contains("Status") && !pc.ColumnName.Contains("Gender") && !pc.ColumnName.Contains("System"))
                {
                    tmp += "(document.getElementById('ctl00_ContentPlaceHolder1_txt" + pc.ColumnName + "').value == '') || ";
                }
            }
        }
        sb.AppendLine("var text = " + tmp.Substring(0, tmp.Length - 3) + ";");//remove the last ||
        sb.AppendLine("if (text) {");
        sb.AppendLine("args.IsValid = false;");
        sb.AppendLine("return;");
        sb.AppendLine("}");
        sb.AppendLine("args.IsValid = true;");
        sb.AppendLine("}");
        //sb.AppendLine("</script>");

        Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), sb.ToString(), true);

        #endregion

        if (!this.Page.IsPostBack)
        {
            Page.DataBind();

            List <string> actionList        = null;
            string        sessionNameAction = "";
            if (CurrentEnvironment.LoggedUser != null)
            {
                sessionNameAction = "__GIS_actionList_" + CurrentEnvironment.LoggedUser.Id;
                actionList        = (List <string>)Session[sessionNameAction];
            }

            if ((actionList != null) && actionList.Contains("ViewChild") && (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["Child-dictionary" + language];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "Child");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("Child-dictionary" + language, wtList);
                }

                #region Person Configuration

                List <PersonConfiguration> pcList = PersonConfiguration.GetPersonConfigurationList();

                foreach (PersonConfiguration pc in pcList)
                {
                    if (pc.IsVisible == false)
                    {
                        Control lbl = FindMyControl(this, "lbl" + pc.ColumnName);
                        Control txt = FindMyControl(this, "txt" + pc.ColumnName);
                        Control rbl = FindMyControl(this, "rbl" + pc.ColumnName);
                        Control tr  = FindMyControl(this, "tr" + pc.ColumnName);

                        if (lbl != null)
                        {
                            lbl.Visible = false;
                        }

                        if (txt != null)
                        {
                            txt.Visible = false;
                        }

                        if (rbl != null)
                        {
                            rbl.Visible = false;
                        }

                        if (tr != null)
                        {
                            tr.Visible = false;
                        }

                        //for (int i = 1; i <= gvChild.Columns.Count; i++)
                        //{
                        //    if (gvChild.Columns[i].HeaderText == pc.ColumnName)
                        //    {
                        //        gvChild.Columns[i].Visible = false;
                        //        break;
                        //    }
                        //}
                    }

                    Control span = FindMyControl(this, "span" + pc.ColumnName);
                    if (span != null)
                    {
                        span.Visible = pc.IsMandatory;
                    }
                }

                string id1    = Configuration.GetConfigurationByName("IdentificationNo1").Value;
                string id2    = Configuration.GetConfigurationByName("IdentificationNo2").Value;
                string id3    = Configuration.GetConfigurationByName("IdentificationNo3").Value;
                string revid1 = Configuration.GetConfigurationByName("IdentificationValidationExpression1").Value;
                string revid2 = Configuration.GetConfigurationByName("IdentificationValidationExpression2").Value;
                string revid3 = Configuration.GetConfigurationByName("IdentificationValidationExpression3").Value;

                #endregion

                #region Controls
                //controls
                this.lblBarcodeID.Text  = wtList["BarcodeId"];
                this.lblTempId.Text     = wtList["TempId"];
                this.lblSystemId.Text   = wtList["ChildSystem"];
                this.lblFirstname1.Text = wtList["ChildFirstname1"];
                this.lblFirstname2.Text = wtList["ChildFirstname2"];
                this.lblLastname1.Text  = wtList["ChildLastname1"];
                //this.lblLastname2.Text = wtList["ChildLastname2"];
                this.lblBirthdate.Text      = wtList["ChildBirthdate"];
                this.lblGender.Text         = wtList["ChildGender"];
                this.lblHealthcenterId.Text = wtList["ChildHealthcenter"];
                this.lblBirthplaceId.Text   = wtList["ChildBirthplace"];
                this.lblCommunityId.Text    = wtList["ChildCommunity"];
                this.lblDomicileId.Text     = wtList["ChildDomicile"];
                this.lblStatusId.Text       = wtList["ChildStatus"];
                this.lblAddress.Text        = wtList["ChildAddress"];
                this.lblPhone.Text          = wtList["ChildPhone"];
                //this.lblMobile.Text = wtList["ChildMobile"];
                //this.lblEmail.Text = wtList["ChildEmail"];
                //this.lblMotherId.Text = wtList["ChildMother"];
                this.lblMotherFirstname.Text = wtList["ChildMotherFirstname"];
                this.lblMotherLastname.Text  = wtList["ChildMotherLastname"];
                //this.lblFatherId.Text = wtList["ChildFather"];
                //this.lblFatherFirstname.Text = wtList["ChildFatherFirstname"];
                //this.lblFatherLastname.Text = wtList["ChildFatherLastname"];
                //this.lblCaretakerId.Text = wtList["ChildCaretaker"];
                //this.lblCaretakerFirstname.Text = wtList["ChildCaretakerFirstname"];
                //this.lblCaretakerLastname.Text = wtList["ChildCaretakerLastname"];
                this.lblNotes.Text = wtList["ChildNotes"];
                //this.lblIsActive.Text = wtList["ChildIsActive"];
                this.lblIdentificationNo1.Text = id1;
                this.lblIdentificationNo2.Text = id2;
                this.lblIdentificationNo3.Text = id3;
                this.rblGender.Items[0].Text   = wtList["ChildMale"];
                this.rblGender.Items[1].Text   = wtList["ChildFemale"];
                #endregion

                //Page Title
                this.lblTitle.Text = wtList["ChildPageTitle"];

                //actions
                this.btnAdd.Visible  = actionList.Contains("AddChild");
                this.btnEdit.Visible = actionList.Contains("EditChild");
                //this.btnRemove.Visible = actionList.Contains("RemoveChild");
                this.btnAddNew.Visible           = actionList.Contains("AddNewChild");
                this.btnImmunizationCard.Visible = actionList.Contains("ViewImmunizationCard");

                //buttons
                this.btnAdd.Text  = wtList["ChildAddButton"];
                this.btnEdit.Text = wtList["ChildEditButton"];
                //this.btnRemove.Text = wtList["ChildRemoveButton"];
                this.btnAddNew.Text           = wtList["ChildAddNewButton"];
                this.btnImmunizationCard.Text = wtList["ChildImmunizationCardButton"];

                //message
                this.lblSuccess.Text        = wtList["ChildSuccessText"];
                this.lblWarning.Text        = wtList["ChildWarningText"];
                this.lblError.Text          = wtList["ChildErrorText"];
                this.lblWarningBarcode.Text = wtList["ChildWarningBarcode"];

                //validators
                ConfigurationDate dateformat = ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value));

                ceBirthdate.Format                = dateformat.DateFormat;
                revBirthdate.ErrorMessage         = dateformat.DateFormat;
                revBirthdate.ValidationExpression = dateformat.DateExpresion;
                cvChild.ErrorMessage              = wtList["ChildMandatory"];
                //revEmail.ErrorMessage = wtList["ChildEmailValidator"];
                revPhone.ErrorMessage = wtList["ChildPhoneValidator"];
                //revMobile.ErrorMessage = wtList["ChildMobileValidator"];
                revFirstname1.ErrorMessage = wtList["ChildFirstnameValidator"];
                //revFirstname2.ErrorMessage = wtList["ChildFirstnameValidator"];
                revLastname1.ErrorMessage = wtList["ChildLastnameValidator"];
                //revLastname2.ErrorMessage = wtList["ChildLastnameValidator"];
                cvBirthdate.ErrorMessage = wtList["ChildBirthdateValidator"];

                string value = revid1.Replace("$", "").Replace("[0-9]", "9");
                value = value.Replace("\\", "");
                value = value.Replace("[^0-9_|°¬!#%/()?¡¿+{}[]:.,;@ª^*<>=&-]", "X");
                revIdentification1.ErrorMessage = value;

                value = revid2.Replace("$", "").Replace("[0-9]", "9");
                value = value.Replace("\\", "");
                value = value.Replace("[^0-9_|°¬!#%/()?¡¿+{}[]:.,;@ª^*<>=&-]", "X");
                revIdentification2.ErrorMessage = value;

                value = revid3.Replace("$", "").Replace("[0-9]", "9");
                value = value.Replace("\\", "");
                value = value.Replace("[^0-9_|°¬!#%/()?¡¿+{}[]:.,;@ª^*<>=&-]", "X");
                revIdentification3.ErrorMessage = value;

                revIdentification1.ValidationExpression = revid1;
                revIdentification2.ValidationExpression = revid2;
                revIdentification3.ValidationExpression = revid3;
                ceBirthdate.EndDate = DateTime.Today.Date;
                //selected object
                int    id  = -1;
                string _id = Request.QueryString["id"];
                if (!String.IsNullOrEmpty(_id))
                {
                    int.TryParse(_id, out id);
                    lblSystemId.Visible = true;
                    txtSystemId.Visible = true;
                    Child o = Child.GetChildById(id);
                    txtSystemId.Text   = o.SystemId;
                    txtFirstname1.Text = o.Firstname1;
                    txtFirstname2.Text = o.Firstname2;
                    txtLastname1.Text  = o.Lastname1;
                    // txtLastname2.Text = o.Lastname2;
                    txtBirthdate.Text                  = o.Birthdate.ToString(dateformat.DateFormat.ToString());
                    rblGender.Items[0].Selected        = o.Gender;
                    rblGender.Items[1].Selected        = !o.Gender;
                    txtHealthcenterId.SelectedItemText = o.Healthcenter.Name.ToString();
                    healthFacilityId          = o.HealthcenterId.ToString();
                    ddlStatus.SelectedValue   = o.StatusId.ToString();
                    txtIdentificationNo1.Text = o.IdentificationNo1;
                    txtIdentificationNo2.Text = o.IdentificationNo2;
                    txtIdentificationNo3.Text = o.IdentificationNo3;
                    txtBarcodeId.Text         = o.BarcodeId;
                    if (string.IsNullOrEmpty(o.BarcodeId))
                    {
                        if (!string.IsNullOrEmpty(o.TempId))
                        {
                            lblTempId.Visible = true;
                            txtTempId.Visible = true;
                            txtTempId.Text    = o.TempId;
                        }
                    }
                    if (o.BirthplaceId > 0)
                    {
                        birthplaceId = o.BirthplaceId.ToString();
                        ddlBirthplace.SelectedValue = birthplaceId;
                    }
                    if (o.CommunityId > 0)
                    {
                        txtCommunityId.SelectedItemText = o.Community.Name.ToString();
                        communityId = o.CommunityId.ToString();
                    }
                    if (o.DomicileId != 0)
                    {
                        txtDomicileId.SelectedItemText = o.Domicile.Name.ToString();
                        domicileId = o.DomicileId.ToString();
                    }
                    txtAddress.Text = o.Address;
                    txtPhone.Text   = o.Phone;
                    //txtMobile.Text = o.Mobile;
                    //txtEmail.Text = o.Email;
                    //txtMotherId.Text = o.MotherId;
                    txtMotherFirstname.Text = o.MotherFirstname;
                    txtMotherLastname.Text  = o.MotherLastname;
                    //txtFatherId.Text = o.FatherId;
                    //txtFatherFirstname.Text = o.FatherFirstname;
                    //txtFatherLastname.Text = o.FatherLastname;
                    //txtCaretakerId.Text = o.CaretakerId;
                    //txtCaretakerFirstname.Text = o.CaretakerFirstname;
                    //txtCaretakerLastname.Text = o.CaretakerLastname;
                    txtNotes.Text = o.Notes;
                    odsVaccinationEvent.SelectParameters.Clear();
                    odsVaccinationEvent.SelectParameters.Add("childId", id.ToString());

                    int vcount = VaccinationAppointment.GetVaccinationAppointmentsByChildNotModified(o.Id).Count;
                    int count  = VaccinationAppointment.GetVaccinationAppointmentsByChild(o.Id).Count;
                    if (vcount != count)
                    {
                        txtBirthdate.Enabled = false;
                    }

                    btnAdd.Visible              = false;
                    btnAddNew.Visible           = false;
                    btnImmunizationCard.Visible = true;
                    btnWeight.Visible           = true;
                    btnAefi.Visible             = true;
                }
                else
                {
                    //lblSystemId.Visible = false;
                    //txtSystemId.Visible = false;
                    lblTempId.Visible = false;
                    txtTempId.Visible = false;
                    btnEdit.Visible   = false;
                    //btnRemove.Visible = false;
                    btnAddNew.Visible           = false;
                    btnImmunizationCard.Visible = false;
                }
                if ((String)HttpContext.Current.Session["_successChild"] == "1")
                {
                    lblSuccess.Visible = true;
                    btnAddNew.Visible  = true;
                    btnEdit.Visible    = true;
                    //btnRemove.Visible = true;
                    btnImmunizationCard.Visible = true;
                }
                else if ((String)HttpContext.Current.Session["_successChild"] == "2")
                {
                    lblSuccess.Visible = true;
                }
                else
                {
                    lblSuccess.Visible = false;
                    btnAddNew.Visible  = false;
                    //btnImmunizationCard.Visible = true;
                }

                HttpContext.Current.Session["_successChild"] = "0";
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            List <string> actionList        = null;
            string        sessionNameAction = "";
            if (CurrentEnvironment.LoggedUser != null)
            {
                sessionNameAction = "__GIS_actionList_" + CurrentEnvironment.LoggedUser.Id;
                actionList        = (List <string>)Session[sessionNameAction];
            }

            if ((CurrentEnvironment.LoggedUser != null)) //actionList.Contains("ViewNotImmunizedChildren") &&
            {
                int    userId     = CurrentEnvironment.LoggedUser.Id;
                string language   = CurrentEnvironment.Language;
                int    languageId = int.Parse(language);
                Dictionary <string, string> wtList = (Dictionary <string, string>)HttpContext.Current.Cache["Child-dictionary" + language];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "Child");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("Child-dictionary" + language, wtList);
                }

                #region Person Configuration

                List <PersonConfiguration> pcList = PersonConfiguration.GetPersonConfigurationList();

                foreach (PersonConfiguration pc in pcList)
                {
                    if (pc.IsVisible == false)
                    {
                        //Control lbl = FindMyControl(this, "lbl" + pc.ColumnName);
                        //Control txt = FindMyControl(this, "txt" + pc.ColumnName);
                        ////Control rbl = FindMyControl(this, "rbl" + pc.ColumnName);
                        //Control tr = FindMyControl(this, "tr" + pc.ColumnName);

                        //if (lbl != null)
                        //    lbl.Visible = false;

                        //if (txt != null)
                        //    txt.Visible = false;

                        //if (rbl != null)
                        //    rbl.Visible = false;

                        //if (tr != null)
                        //    tr.Visible = false;

                        for (int i = 1; i < gvChild.Columns.Count; i++)
                        {
                            if (gvChild.Columns[i].HeaderText == pc.ColumnName)
                            {
                                gvChild.Columns[i].Visible = false;
                                break;
                            }
                        }
                    }
                }

                #endregion

                //controls
                #region Controls

                //this.lblHealthFacility.Text = wtList["ChildHealthcenter"];
                this.lblVaccine.Text = wtList["ChildVaccine"];
                this.lblTitle.Text   = wtList["ChildListNotImmunizedChildrenPageTitle"];
                // this.lblWarning.Text = wtList["ChildListNotImmunizedChildrenWarningText"];

                #endregion

                //grid header text
                #region Grid Columns
                gvChild.Columns[1].HeaderText  = wtList["ChildNonVaccinationReason"];
                gvChild.Columns[2].HeaderText  = wtList["ChildSystem"];
                gvChild.Columns[3].HeaderText  = wtList["ChildFirstname1"];
                gvChild.Columns[4].HeaderText  = wtList["ChildLastname1"];
                gvChild.Columns[5].HeaderText  = wtList["ChildMotherFirstname"];
                gvChild.Columns[6].HeaderText  = wtList["ChildMotherLastname"];
                gvChild.Columns[7].HeaderText  = wtList["ChildBirthdate"];
                gvChild.Columns[8].HeaderText  = wtList["ChildGender"];
                gvChild.Columns[9].HeaderText  = wtList["ChildHealthcenter"];
                gvChild.Columns[10].HeaderText = wtList["ChildDomicile"];

                gvExport.Columns[1].HeaderText  = wtList["ChildNonVaccinationReason"];
                gvExport.Columns[2].HeaderText  = wtList["ChildSystem"];
                gvExport.Columns[3].HeaderText  = wtList["ChildFirstname1"];
                gvExport.Columns[4].HeaderText  = wtList["ChildLastname1"];
                gvExport.Columns[5].HeaderText  = wtList["ChildMotherFirstname"];
                gvExport.Columns[6].HeaderText  = wtList["ChildMotherLastname"];
                gvExport.Columns[7].HeaderText  = wtList["ChildBirthdate"];
                gvExport.Columns[8].HeaderText  = wtList["ChildGender"];
                gvExport.Columns[9].HeaderText  = wtList["ChildHealthcenter"];
                gvExport.Columns[10].HeaderText = wtList["ChildBirthplace"];


                #endregion

                //buttons
                // this.btnSearch.Text = wtList["ChildSearchButton"];
                this.btnExcel.Text = wtList["ChildExcelButton"];
                this.btnPrint.Text = wtList["ChildPrintButton"];

                string _hfId = (string)Request.QueryString["hfId"];
                if (!String.IsNullOrEmpty(_hfId))
                {
                    healthCenterId = _hfId;
                }
                string _vaccineId = (string)Request.QueryString["vaccineId"];
                if (!String.IsNullOrEmpty(_vaccineId))
                {
                    vaccineId = _vaccineId;
                }
                txtVaccine.Text = Dose.GetDoseById(int.Parse(vaccineId)).Fullname;
                HttpContext.Current.Session["vaccine"] = txtVaccine.Text;

                string _planned = (string)Request.QueryString["planned"];
                if (!String.IsNullOrEmpty(_planned))
                {
                    planned = int.Parse(_planned);
                }

                string dateFormat = ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString();

                fromdate = DateTime.ParseExact(HttpContext.Current.Session["fromdate"].ToString(), dateFormat, CultureInfo.CurrentCulture);
                todate   = DateTime.ParseExact(HttpContext.Current.Session["todate"].ToString(), dateFormat, CultureInfo.CurrentCulture);
                enddate  = DateTime.ParseExact(HttpContext.Current.Session["enddate"].ToString(), dateFormat, CultureInfo.CurrentCulture);

                string s = HealthFacility.GetAllChildsForOneHealthFacility(int.Parse(healthCenterId));
                string where = string.Format(" AND (\"HEALTHCENTER_ID\" in ({0})) ", s);

                if (planned == 1)
                {
                    where += String.Format(@" AND ""DOSE_ID"" = {0} AND ""SCHEDULED_DATE"" between '{1}' and '{2}' AND ""VACCINATION_DATE"" between '{1}' and '{3}' ", vaccineId, fromdate.ToString("yyyy-MM-dd"), todate.ToString("yyyy-MM-dd"), enddate.ToString("yyyy-MM-dd"));
                }
                else
                {
                    where += String.Format(@" AND ""DOSE_ID"" = {0} AND ""BIRTHDATE"" between '{1}' and '{2}' AND ""VACCINATION_DATE"" between '{1}' and '{3}' ", vaccineId, fromdate.ToString("yyyy-MM-dd"), todate.ToString("yyyy-MM-dd"), enddate.ToString("yyyy-MM-dd"));
                }

                odsChild.SelectParameters.Clear();
                odsChild.SelectParameters.Add("where", where);
                odsChild.DataBind();
                HttpContext.Current.Session["whereExcelNotImmunized"] = where; //use for excel

                if (HttpContext.Current.Session["whereNotImmunized"] != null)
                {
                    string swhere = HttpContext.Current.Session["whereNotImmunized"].ToString();
                    odsChild.SelectParameters.Clear();
                    odsChild.SelectParameters.Add("where", swhere);
                    odsChild.DataBind();
                    HttpContext.Current.Session["whereExcelNotImmunized"] = swhere;
                    HttpContext.Current.Session["whereNotImmunized"]      = null;
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
    }