protected void btnSearch_Click(object sender, EventArgs e) { if (healthCenterId != null) { vaccineId = Page.Request.QueryString["vaccineId"].ToString(); txtVaccine.Text = Dose.GetDoseById(int.Parse(vaccineId)).Fullname; //fromdate = DateTime.Parse(HttpContext.Current.Session["fromdate"].ToString()); //todate = DateTime.Parse(HttpContext.Current.Session["todate"].ToString()); //enddate = DateTime.Parse(HttpContext.Current.Session["enddate"].ToString()); string s = HealthFacility.GetAllChildsForOneHealthFacility(int.Parse(healthCenterId)); string where = string.Format(" AND (\"HEALTHCENTER_ID\" in ({0})) ", s); 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["hfId"] = healthCenterId; HttpContext.Current.Session["whereNotImmunized"] = where; Response.Redirect(Request.RawUrl); } }
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("ViewDose") && (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["Dose-dictionary" + language]; if (wtList == null) { List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "Dose"); wtList = new Dictionary <string, string>(); foreach (WordTranslate vwt in wordTranslateList) { wtList.Add(vwt.Code, vwt.Name); } HttpContext.Current.Cache.Insert("Dose-dictionary" + language, wtList); } //controls this.lblScheduledVaccinationId.Text = wtList["DoseScheduledVaccination"]; this.lblDoseNumber.Text = wtList["DoseDoseNumber"]; this.lblAgeDefinitionId.Text = wtList["DoseAgeDefinition"]; this.lblFullname.Text = wtList["DoseFullname"]; this.lblNotes.Text = wtList["DoseNotes"]; this.lblIsActive.Text = wtList["DoseIsActive"]; // this.lblFromAgeDef.Text = wtList["DoseFromAgeDefinition"]; // this.lblToAgeDef.Text = wtList["DoseToAgeDefinition"]; //grid header text gvDose.Columns[1].HeaderText = wtList["DoseFullname"]; gvDose.Columns[2].HeaderText = wtList["DoseAgeDefinition"]; gvDose.Columns[3].HeaderText = wtList["DoseScheduledVaccination"]; gvDose.Columns[4].HeaderText = wtList["DoseDoseNumber"]; gvDose.Columns[5].HeaderText = wtList["DoseNotes"]; gvDose.Columns[6].HeaderText = wtList["DoseIsActive"]; //actions this.btnAdd.Visible = actionList.Contains("AddDose"); this.btnEdit.Visible = actionList.Contains("EditDose"); this.btnRemove.Visible = actionList.Contains("RemoveDose"); //buttons this.btnAdd.Text = wtList["DoseAddButton"]; this.btnEdit.Text = wtList["DoseEditButton"]; this.btnRemove.Text = wtList["DoseRemoveButton"]; //message this.lblSuccess.Text = wtList["DoseSuccessText"]; this.lblWarning.Text = wtList["DoseWarningText"]; this.lblError.Text = wtList["DoseErrorText"]; //Page Title this.lblTitle.Text = wtList["DosePageTitle"]; //validators cvDose.ErrorMessage = wtList["DoseMandatory"]; // cvScheduledVaccination.ErrorMessage = wtList["DoseScheduledVaccinationValidator"]; //cvAgeDefinition.ErrorMessage = wtList["DoseAgeDefinitionValidator"]; //selected object int id = -1; string _id = Request.QueryString["id"]; if (!String.IsNullOrEmpty(_id)) { int.TryParse(_id, out id); Dose o = Dose.GetDoseById(id); ddlScheduledVaccination.SelectedValue = o.ScheduledVaccinationId.ToString(); ddlAgeDefinition.SelectedValue = o.AgeDefinitionId.ToString(); if (o.FromAgeDefinitionId > 0) { ddlFromAgeDef.SelectedValue = o.FromAgeDefinitionId.ToString(); } if (o.ToAgeDefinitionId > 0) { ddlToAgeDef.SelectedValue = o.ToAgeDefinitionId.ToString(); } txtDoseNumber.Text = o.DoseNumber.ToString(); txtFullname.Text = o.Fullname.ToString(); txtNotes.Text = o.Notes; rblIsActive.Items[0].Selected = o.IsActive; rblIsActive.Items[1].Selected = !o.IsActive; gridview_Databind(id); btnAdd.Visible = false; } else { btnEdit.Visible = false; btnRemove.Visible = false; } } else { Response.Redirect("Default.aspx"); } } }
protected void btnEdit_Click(object sender, EventArgs e) { try { if (Page.IsValid) { int id = -1; string _id = Request.QueryString["id"].ToString(); int.TryParse(_id, out id); int userId = CurrentEnvironment.LoggedUser.Id; Dose o = Dose.GetDoseById(id); if (Exists(ddlScheduledVaccination.SelectedIndex, int.Parse(txtDoseNumber.Text)) && (o.ScheduledVaccinationId != int.Parse(ddlScheduledVaccination.SelectedValue)) && (o.DoseNumber != int.Parse(txtDoseNumber.Text))) { return; } if (NameExists(txtFullname.Text.Replace("'", @"''")) && (o.Fullname != txtFullname.Text)) { return; } o.ScheduledVaccinationId = int.Parse(ddlScheduledVaccination.SelectedValue); o.AgeDefinitionId = int.Parse(ddlAgeDefinition.SelectedValue); o.DoseNumber = int.Parse(txtDoseNumber.Text); o.Fullname = txtFullname.Text.Replace("'", @"''"); o.Notes = txtNotes.Text.Replace("'", @"''"); o.IsActive = bool.Parse(rblIsActive.SelectedValue); o.ModifiedOn = DateTime.Now; o.ModifiedBy = userId; if (ddlFromAgeDef.SelectedIndex > 0) { o.FromAgeDefinitionId = int.Parse(ddlFromAgeDef.SelectedValue); } else { o.FromAgeDefinitionId = null; } if (ddlToAgeDef.SelectedIndex > 0) { o.ToAgeDefinitionId = int.Parse(ddlToAgeDef.SelectedValue); } else { o.ToAgeDefinitionId = null; } int i = Dose.Update(o); if (i > 0) { lblSuccess.Visible = true; lblWarning.Visible = false; lblError.Visible = false; gridview_Databind(id); //ClearControls(this); } else { lblSuccess.Visible = false; lblWarning.Visible = false; lblError.Visible = true; } } } catch (Exception ex) { lblSuccess.Visible = false; lblWarning.Visible = false; lblError.Visible = true; } }
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["CohortCoverageReport-dictionary" + language + language]; if (wtList == null) { List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "CohortCoverageReport"); wtList = new Dictionary <string, string>(); foreach (WordTranslate vwt in wordTranslateList) { wtList.Add(vwt.Code, vwt.Name); } HttpContext.Current.Cache.Insert("CohortCoverageReport-dictionary" + language + language, wtList); } //controls this.lbFromDate.Text = wtList["CohortCoverageReportFromDate"]; this.lbToDate.Text = wtList["CohortCoverageReportToDate"]; this.lbEndDate.Text = wtList["CohortCoverageReportEndDate"]; this.lbVaccine.Text = wtList["CohortCoverageReportVaccine"]; this.lblTitle.Text = wtList["PrintCohortCoverageReportPageTitle"]; int hfId = CurrentEnvironment.LoggedUser.HealthFacilityId; string _hfId = (string)Request.QueryString["hfId"]; if (!String.IsNullOrEmpty(_hfId)) { int.TryParse(_hfId, out hfId); } string healthFacilityId = HealthFacility.GetAllChildsForOneHealthFacility(hfId); lblFromDate.Text = HttpContext.Current.Session["fromdate"].ToString(); lblToDate.Text = HttpContext.Current.Session["todate"].ToString(); lblEndDate.Text = HttpContext.Current.Session["enddate"].ToString(); int vaccine = Helper.ConvertToInt(HttpContext.Current.Session["vaccineId"]); int community = int.Parse(HttpContext.Current.Session["community"].ToString()); int domicile = int.Parse(HttpContext.Current.Session["domicile"].ToString()); if (vaccine != -1) { Dose o = Dose.GetDoseById(vaccine); lblVaccine.Text = o.Fullname; } string dateFormat = ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(); DateTime datefrom = DateTime.ParseExact(lblFromDate.Text, dateFormat, CultureInfo.CurrentCulture); DateTime dateto = DateTime.ParseExact(lblToDate.Text, dateFormat, CultureInfo.CurrentCulture); DateTime dateend = DateTime.ParseExact(lblEndDate.Text, dateFormat, CultureInfo.CurrentCulture); DataTable dt = CohortCoverage.GetCohortCoverage(languageId, healthFacilityId, datefrom, dateto, dateend, vaccine, community, domicile); DataTable table = CreateDataTable(dt); if (dt != null) { char[] stringSeparators = new char[] { ',' }; string[] result; foreach (DataRow dr in dt.Rows) { result = dr[0].ToString().Replace(" ", "").Replace("(", "").Replace(")", "").Replace("\"", "").Split(stringSeparators); CreateDataRow(result, table); } gvCohortCoverage.DataSource = table; gvCohortCoverage.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 ((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"); } } }