コード例 #1
0
    private void UpdateVaccinationAppointment(int appId, bool outreach)
    {
        VaccinationAppointment va = VaccinationAppointment.GetVaccinationAppointmentById(appId);

        va.Outreach   = outreach;
        va.ModifiedOn = DateTime.Now;
        va.ModifiedBy = CurrentEnvironment.LoggedUser.Id;
        VaccinationAppointment.Update(va);
    }
コード例 #2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                if (HttpContext.Current.Session["__AppId"] != null)
                {
                    int appId = int.Parse(HttpContext.Current.Session["__AppId"].ToString());

                    VaccinationAppointment va = VaccinationAppointment.GetVaccinationAppointmentById(appId);
                    va.Aefi = chbxChildAEFI.Checked;
                    DateTime date = DateTime.ParseExact(txtDate.Text, ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(), CultureInfo.InvariantCulture);
                    va.AefiDate   = date;
                    va.Notes      = txtNotes.Text;
                    va.ModifiedBy = CurrentEnvironment.LoggedUser.Id;
                    va.ModifiedOn = DateTime.Now;

                    int updated = VaccinationAppointment.Update(va);

                    if (updated >= 1)
                    {
                        odsVccEvent.SelectParameters.Clear();
                        odsVccEvent.SelectParameters.Add("childId", va.ChildId.ToString());

                        odsVccEvent.DataBind();

                        lblSuccess.Visible = true;
                        lblWarning.Visible = false;
                        lblError.Visible   = false;
                    }
                    else
                    {
                        lblSuccess.Visible = false;
                        lblWarning.Visible = false;
                        lblError.Visible   = true;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            lblSuccess.Visible = false;
            lblWarning.Visible = false;
            lblError.Visible   = true;
        }
    }
コード例 #3
0
    protected void btnImmunizationCard_Click(object sender, EventArgs e)
    {
        int    id      = -1;
        int    childId = 0;
        string _id     = Request.QueryString["id"];

        if (!String.IsNullOrEmpty(_id))
        {
            int.TryParse(_id, out id);
            VaccinationEvent o = VaccinationEvent.GetVaccinationEventById(id);
            childId = o.ChildId;
        }
        int    appid  = -1;
        string _appid = Request.QueryString["appid"];

        if (!String.IsNullOrEmpty(_appid))
        {
            int.TryParse(_appid, out appid);
            VaccinationAppointment o = VaccinationAppointment.GetVaccinationAppointmentById(appid);
            childId = o.ChildId;
        }
        Response.Redirect("ViewImmunizationCard.aspx?id=" + childId, false);
    }
コード例 #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("ViewVaccinationEvent") && (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["ChildAefi-dictionary" + language];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "ChildAefi");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("VaccinationAppointment-dictionary" + language, wtList);
                }

                //controls
                this.chbxChildAEFI.Text = wtList["ChildAefiDoneAefi"];
                this.lblDate.Text       = wtList["ChildAefiDate"];
                this.lblNotes.Text      = wtList["ChildAefiNotes"];

                //grid header text
                gvVaccinationAppointment.Columns[1].HeaderText = wtList["ChildAefiVaccines"];
                gvVaccinationAppointment.Columns[2].HeaderText = wtList["ChildAefiVaccineDate"];
                gvVaccinationAppointment.Columns[3].HeaderText = wtList["ChildAefiHealthCenter"];
                gvVaccinationAppointment.Columns[4].HeaderText = wtList["ChildAefiDone"];

                gvVccEvent.Columns[1].HeaderText = wtList["ChildAefiVaccines"];
                gvVccEvent.Columns[2].HeaderText = wtList["ChildAefiVaccineDate"];
                gvVccEvent.Columns[3].HeaderText = wtList["ChildAefiHealthCenter"];
                gvVccEvent.Columns[4].HeaderText = wtList["ChildAefiDone"];
                gvVccEvent.Columns[5].HeaderText = wtList["ChildAefiAEFI"];
                gvVccEvent.Columns[6].HeaderText = wtList["ChildAefiAEFIDate"];
                gvVccEvent.Columns[7].HeaderText = wtList["ChildAefiNotes"];

                //page title
                this.lblTitle.Text = wtList["ChildAefiPageTitle"];
                //actions

                //buttons
                this.btnEdit.Text = wtList["ChildAefiEditButton"];
                //this.btnClear.Text = wtList["ChildAefiClearButton"];

                //messages
                this.lblInfo.Text            = wtList["ChildAefiInfoText"];
                this.lblSuccess.Text         = wtList["ChildAefiSuccessText"];
                this.lblWarning.Text         = wtList["ChildAefiWarningText"];
                this.lblError.Text           = wtList["ChildAefiErrorText"];
                this.cvAEFIdate.ErrorMessage = wtList["ChildAefiDateValidator"];

                ConfigurationDate dateformat = ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value));
                ceDate.Format                = dateformat.DateFormat;
                revDate.ErrorMessage         = dateformat.DateFormat;
                revDate.ValidationExpression = dateformat.DateExpresion;
                ceDate.EndDate               = DateTime.Today.Date;

                int    id  = -1;
                string _id = Request.QueryString["id"];
                if (!String.IsNullOrEmpty(_id))
                {
                    int.TryParse(_id, out id);

                    odsVaccinationAppointment.SelectParameters.Clear();
                    odsVaccinationAppointment.SelectParameters.Add("childId", id.ToString());
                    odsVaccinationAppointment.DataBind();

                    if (gvVaccinationAppointment.Rows.Count <= 0)
                    {
                        chbxChildAEFI.Visible = false;
                        lblDate.Visible       = false;
                        txtDate.Visible       = false;
                        lblNotes.Visible      = false;
                        txtNotes.Visible      = false;
                        btnSave.Visible       = false;
                        lblInfo.Visible       = true;
                        btnEdit.Visible       = false;
                    }
                    btnEdit.Visible  = false;
                    btnClear.Visible = false;
                    txtDate.Text     = DateTime.Today.ToString(dateformat.DateFormat);
                    odsVccEvent.SelectParameters.Clear();
                    odsVccEvent.SelectParameters.Add("childId", id.ToString());
                    odsVccEvent.DataBind();
                }
                int    appId  = -1;
                string _appid = Request.QueryString["appId"];
                if (!String.IsNullOrEmpty(_appid))
                {
                    int.TryParse(_appid, out appId);
                    VaccinationAppointment app = VaccinationAppointment.GetVaccinationAppointmentById(appId);
                    HttpContext.Current.Session["__AppId"] = appId;
                    chbxChildAEFI.Visible = true;
                    lblDate.Visible       = true;
                    txtDate.Visible       = true;
                    lblNotes.Visible      = true;
                    txtNotes.Visible      = true;
                    btnSave.Visible       = false;
                    btnEdit.Visible       = true;
                    btnClear.Visible      = false;
                    lblInfo.Visible       = false;

                    chbxChildAEFI.Checked = app.Aefi;
                    if (app.AefiDate.ToString("yyyy-MM-dd") != "0001-01-01")
                    {
                        txtDate.Text = app.AefiDate.ToString(dateformat.DateFormat);
                    }
                    txtNotes.Text = app.Notes;
                    odsVccEvent.SelectParameters.Clear();
                    odsVccEvent.SelectParameters.Add("childId", app.ChildId.ToString());
                    odsVccEvent.DataBind();
                }
            }
        }
    }
コード例 #5
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                int    appId  = -1;
                string _appid = Request.QueryString["appId"];
                if (!String.IsNullOrEmpty(_appid))
                {
                    int.TryParse(_appid, out appId);
                    VaccinationAppointment va = VaccinationAppointment.GetVaccinationAppointmentById(appId);
                    va.Aefi = chbxChildAEFI.Checked;
                    DateTime date = DateTime.ParseExact(txtDate.Text, ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(), CultureInfo.CurrentCulture);
                    if (va.Aefi)
                    {
                        va.AefiDate = date;
                        va.Notes    = txtNotes.Text;
                    }
                    else
                    {
                        va.AefiDate = DateTime.Parse("0001-01-01");
                        va.Notes    = String.Empty;
                    }

                    va.ModifiedBy = CurrentEnvironment.LoggedUser.Id;
                    va.ModifiedOn = DateTime.Now;

                    int updated = VaccinationAppointment.Update(va);

                    if (updated >= 1)
                    {
                        odsVccEvent.SelectParameters.Clear();
                        odsVccEvent.SelectParameters.Add("childId", va.ChildId.ToString());

                        odsVccEvent.DataBind();

                        if (va.Aefi)
                        {
                            txtDate.Text  = string.Empty;
                            txtNotes.Text = string.Empty;
                        }

                        lblSuccess.Visible = true;
                        lblWarning.Visible = false;
                        lblError.Visible   = false;
                    }
                    else
                    {
                        lblSuccess.Visible = false;
                        lblWarning.Visible = false;
                        lblError.Visible   = true;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            lblSuccess.Visible = false;
            lblWarning.Visible = false;
            lblError.Visible   = true;
        }
    }
コード例 #6
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                int    id  = -1;
                string _id = Request.QueryString["id"];
                if (String.IsNullOrEmpty(_id))
                {
                    if (HttpContext.Current.Session["_lastChildId"] != null)
                    {
                        id = (int)HttpContext.Current.Session["_lastChildId"];
                    }
                }
                else
                {
                    int.TryParse(_id, out id);
                }
                int userId = CurrentEnvironment.LoggedUser.Id;

                birthplaceId = ddlBirthplace.SelectedValue;
                if (birthplaceId == null || Birthplace.GetBirthplaceById(int.Parse(birthplaceId)) == null)
                {
                    if (spanBirthplaceId.Visible == true)
                    {
                        revBirthplace.Visible = true;
                        return;
                    }
                }
                if (domicileId == null || Place.GetPlaceById(int.Parse(domicileId)) == null)
                {
                    if (spanDomicileId.Visible == true)
                    {
                        revDomicile.Visible = true;
                        return;
                    }
                }
                if (communityId == null || Community.GetCommunityById(int.Parse(communityId)) == null)
                {
                    if (spanCommunityId.Visible == true)
                    {
                        revCommunity.Visible = true;
                        return;
                    }
                }
                if (healthFacilityId == null || HealthFacility.GetHealthFacilityById(int.Parse(healthFacilityId)) == null)
                {
                    revHealthcenter.Visible = true;
                    return;
                }

                Child o = Child.GetChildById(id);

                o.Firstname1 = txtFirstname1.Text.Trim();
                o.Firstname2 = txtFirstname2.Text.Trim();
                o.Lastname1  = txtLastname1.Text.Trim();
                //o.Lastname2 = txtLastname2.Text.Replace("'", @"''");

                DateTime date     = DateTime.ParseExact(txtBirthdate.Text, ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(), CultureInfo.CurrentCulture);
                int      datediff = Int32.MaxValue;
                if (o.Birthdate != date)
                {
                    if (o.Birthdate.Year != date.Year)
                    {
                        datediff = date.Subtract(o.Birthdate).Days;
                    }
                    else
                    {
                        datediff = date.Subtract(o.Birthdate).Days;
                    }
                }
                o.Birthdate = date;

                o.Gender = bool.Parse(rblGender.SelectedValue);

                int healthcenter = 0;
                if (o.HealthcenterId != int.Parse(healthFacilityId))
                {
                    healthcenter = int.Parse(healthFacilityId);
                }
                o.HealthcenterId = int.Parse(healthFacilityId);

                if (birthplaceId != null && birthplaceId != "0" && birthplaceId != "-1")
                {
                    o.BirthplaceId = int.Parse(birthplaceId);
                }
                else
                {
                    o.BirthplaceId = null;
                }
                if (communityId != null && communityId != "0")
                {
                    o.CommunityId = int.Parse(communityId);
                }
                else
                {
                    o.CommunityId = null;
                }
                if (domicileId != null && domicileId != "0")
                {
                    o.DomicileId = int.Parse(domicileId);
                }
                else
                {
                    o.DomicileId = null;
                }
                o.StatusId = int.Parse(ddlStatus.SelectedValue);
                bool appstatus = true;
                if (o.StatusId != 1) //== 2 || o.StatusId == 3 || o.StatusId == 4 )
                {
                    appstatus = false;
                }
                if (!String.IsNullOrEmpty(txtAddress.Text))
                {
                    o.Address = txtAddress.Text;
                }
                if (!String.IsNullOrEmpty(txtPhone.Text))
                {
                    o.Phone = txtPhone.Text;
                }
                //  o.Mobile = txtMobile.Text;
                //o.Email = txtEmail.Text.Replace("'", @"''");
                //  o.MotherId = txtMotherId.Text.Replace("'", @"''");
                if (!String.IsNullOrEmpty(txtMotherFirstname.Text))
                {
                    o.MotherFirstname = txtMotherFirstname.Text;
                }
                if (!String.IsNullOrEmpty(txtMotherLastname.Text))
                {
                    o.MotherLastname = txtMotherLastname.Text;
                }
                //o.FatherId = txtFatherId.Text.Replace("'", @"''");
                //o.FatherFirstname = txtFatherFirstname.Text.Replace("'", @"''");
                //o.FatherLastname = txtFatherLastname.Text.Replace("'", @"''");
                //o.CaretakerId = txtCaretakerId.Text.Replace("'", @"''");
                //o.CaretakerFirstname = txtCaretakerFirstname.Text.Replace("'", @"''");
                //o.CaretakerLastname = txtCaretakerLastname.Text.Replace("'", @"''");
                o.Notes      = txtNotes.Text.Replace("'", @"''");
                o.IsActive   = true; // bool.Parse(rblIsActive.SelectedValue);
                o.ModifiedOn = DateTime.Now;
                o.ModifiedBy = userId;
                if (!String.IsNullOrEmpty(txtIdentificationNo1.Text))
                {
                    o.IdentificationNo1 = txtIdentificationNo1.Text;
                }
                if (!String.IsNullOrEmpty(txtIdentificationNo2.Text))
                {
                    o.IdentificationNo2 = txtIdentificationNo2.Text;
                }
                if (!String.IsNullOrEmpty(txtIdentificationNo3.Text))
                {
                    o.IdentificationNo3 = txtIdentificationNo3.Text;
                }
                if (!String.IsNullOrEmpty(txtBarcodeId.Text))
                {
                    o.BarcodeId = txtBarcodeId.Text.Trim();
                    if (Child.GetChildByBarcode(o.BarcodeId) != null && Child.GetChildByBarcode(o.BarcodeId).Id != id)
                    {
                        lblWarningBarcode.Visible = true;
                        return;
                    }
                }
                if (!String.IsNullOrEmpty(txtTempId.Text))
                {
                    o.TempId = txtTempId.Text.Trim();
                }

                int i = Child.Update(o);

                if (i > 0)
                {
                    List <VaccinationAppointment> applist    = VaccinationAppointment.GetVaccinationAppointmentsByChildNotModified(id);
                    List <VaccinationAppointment> applistall = VaccinationAppointment.GetVaccinationAppointmentsByChild(id);
                    if (!appstatus)
                    {
                        foreach (VaccinationAppointment app in applist)
                        {
                            VaccinationAppointment.Update(appstatus, app.Id);
                        }
                    }

                    if (healthcenter != 0)
                    {
                        foreach (VaccinationAppointment app in applist)
                        {
                            VaccinationAppointment.Update(o.HealthcenterId, app.Id);
                            VaccinationEvent.Update(app.Id, o.HealthcenterId);
                        }
                    }
                    if (datediff != Int32.MaxValue)
                    {
                        bool done = false;
                        foreach (VaccinationAppointment app in applistall)
                        {
                            VaccinationEvent ve = VaccinationEvent.GetVaccinationEventByAppointmentId(app.Id)[0];
                            if (ve.VaccinationStatus || ve.NonvaccinationReasonId != 0)
                            {
                                done = true;
                                break;
                            }
                        }

                        foreach (VaccinationAppointment app in applist)
                        {
                            if (done)
                            {
                                break;
                            }
                            VaccinationAppointment.Update(app.ScheduledDate.AddDays(datediff), app.Id);
                            VaccinationEvent.Update(app.Id, app.ScheduledDate.AddDays(datediff));
                        }
                    }
                    HttpContext.Current.Session["_successUpdateChild"] = "1";

                    lblSuccess.Visible = true;
                    lblWarning.Visible = false;
                    lblError.Visible   = false;
                    gvVaccinationEvent.DataBind();
                }
                else
                {
                    lblSuccess.Visible = false;
                    lblWarning.Visible = false;
                    lblError.Visible   = true;
                }
            }
        }
        catch (Exception ex)
        {
            lblSuccess.Visible = false;
            lblWarning.Visible = false;
            lblError.Visible   = true;
        }
    }
コード例 #7
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                int userId = CurrentEnvironment.LoggedUser.Id;

                birthplaceId = ddlBirthplace.SelectedValue;

                if (birthplaceId == null || Birthplace.GetBirthplaceById(int.Parse(birthplaceId)) == null)
                {
                    if (spanBirthplaceId.Visible == true)
                    {
                        revBirthplace.Visible = true;
                        return;
                    }
                }
                if (domicileId == null || Place.GetPlaceById(int.Parse(domicileId)) == null)
                {
                    if (spanDomicileId.Visible == true)
                    {
                        revDomicile.Visible = true;
                        return;
                    }
                }
                if (communityId == null || Community.GetCommunityById(int.Parse(communityId)) == null)
                {
                    if (spanCommunityId.Visible == true)
                    {
                        revCommunity.Visible = true;
                        return;
                    }
                }
                if (healthFacilityId == null || HealthFacility.GetHealthFacilityById(int.Parse(healthFacilityId)) == null)
                {
                    revHealthcenter.Visible = true;
                    return;
                }

                Child o = new Child();

                o.Firstname1 = txtFirstname1.Text.Trim();
                o.Firstname2 = txtFirstname2.Text.Trim();
                o.Lastname1  = txtLastname1.Text.Trim();
                // o.Lastname2 = txtLastname2.Text.Replace("'", @"''");
                DateTime date = DateTime.ParseExact(txtBirthdate.Text, ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(), CultureInfo.CurrentCulture);
                o.Birthdate = date;
                o.Gender    = bool.Parse(rblGender.SelectedValue);
                if (childExists(o.Lastname1, o.Gender, o.Birthdate) && (!contRegistration))
                {
                    return;
                }

                if (healthFacilityId != null && healthFacilityId != "0")
                {
                    o.HealthcenterId = int.Parse(healthFacilityId);
                }
                if (birthplaceId != null && birthplaceId != "0" && birthplaceId != "-1")
                {
                    o.BirthplaceId = int.Parse(birthplaceId);
                }
                if (communityId != null && communityId != "0")
                {
                    o.CommunityId = int.Parse(communityId);
                }
                if (domicileId != null && domicileId != "0")
                {
                    o.DomicileId = int.Parse(domicileId);
                }

                o.StatusId = int.Parse(ddlStatus.SelectedValue);
                if (!String.IsNullOrEmpty(txtAddress.Text))
                {
                    o.Address = txtAddress.Text;
                }
                if (!String.IsNullOrEmpty(txtPhone.Text))
                {
                    o.Phone = txtPhone.Text;
                }
                //  o.Mobile = txtMobile.Text;
                //o.Email = txtEmail.Text.Replace("'", @"''");
                //  o.MotherId = txtMotherId.Text.Replace("'", @"''");
                if (!String.IsNullOrEmpty(txtMotherFirstname.Text))
                {
                    o.MotherFirstname = txtMotherFirstname.Text;
                }
                if (!String.IsNullOrEmpty(txtMotherLastname.Text))
                {
                    o.MotherLastname = txtMotherLastname.Text;
                }
                //o.FatherId = txtFatherId.Text.Replace("'", @"''");
                //o.FatherFirstname = txtFatherFirstname.Text.Replace("'", @"''");
                //o.FatherLastname = txtFatherLastname.Text.Replace("'", @"''");
                //o.CaretakerId = txtCaretakerId.Text.Replace("'", @"''");
                //o.CaretakerFirstname = txtCaretakerFirstname.Text.Replace("'", @"''");
                //o.CaretakerLastname = txtCaretakerLastname.Text.Replace("'", @"''");
                o.Notes      = txtNotes.Text;
                o.IsActive   = true; // bool.Parse(rblIsActive.SelectedValue);
                o.ModifiedOn = DateTime.Now;
                o.ModifiedBy = userId;
                if (!String.IsNullOrEmpty(txtIdentificationNo1.Text))
                {
                    o.IdentificationNo1 = txtIdentificationNo1.Text;
                }
                if (!String.IsNullOrEmpty(txtIdentificationNo2.Text))
                {
                    o.IdentificationNo2 = txtIdentificationNo2.Text;
                }
                if (!String.IsNullOrEmpty(txtIdentificationNo3.Text))
                {
                    o.IdentificationNo3 = txtIdentificationNo3.Text;
                }
                if (!String.IsNullOrEmpty(txtBarcodeId.Text))
                {
                    o.BarcodeId = txtBarcodeId.Text.Trim();
                    if (Child.GetChildByBarcode(o.BarcodeId) != null)
                    {
                        lblWarningBarcode.Visible = true;
                        return;
                    }
                }
                if (!String.IsNullOrEmpty(txtTempId.Text))
                {
                    o.TempId = txtTempId.Text.Trim();
                }

                if (o.IdentificationNo1 != String.Empty && o.IdentificationNo1 != null)
                {
                    if (IdentificationNo1Exists(o.IdentificationNo1))
                    {
                        return;
                    }
                }
                if (o.IdentificationNo2 != String.Empty && o.IdentificationNo2 != null)
                {
                    if (IdentificationNo2Exists(o.IdentificationNo2))
                    {
                        return;
                    }
                }
                if (o.IdentificationNo3 != String.Empty && o.IdentificationNo3 != null)
                {
                    if (IdentificationNo3Exists(o.IdentificationNo3))
                    {
                        return;
                    }
                }

                o.SystemId = DateTime.Now.ToString("yyMMddhhmmss");
                int i = Child.Insert(o);

                if (i > 0)
                {
                    //add appointments
                    int j = VaccinationAppointment.InsertVaccinationsForChild(i, userId);
                    if (j > 0)
                    {
                        odsVaccinationEvent.SelectParameters.Clear();
                        odsVaccinationEvent.SelectParameters.Add("childId", i.ToString());

                        lblSuccess.Visible          = true;
                        lblWarning.Visible          = false;
                        lblError.Visible            = false;
                        btnAddNew.Visible           = true;
                        btnAdd.Visible              = false;
                        btnImmunizationCard.Visible = false;
                        btnEdit.Visible             = true;
                        //btnRemove.Visible = true;
                        lblWarningBarcode.Visible = false;
                        lnbContinue.Visible       = false;

                        HttpContext.Current.Session["_successChild"] = "1";
                        HttpContext.Current.Session["_lastChildId"]  = i;
                    }
                }
                else
                {
                    lblSuccess.Visible = false;
                    lblWarning.Visible = false;
                    lblError.Visible   = true;
                    btnAddNew.Visible  = false;
                }
            }
        }
        catch (Exception ex)
        {
            lblSuccess.Visible = false;
            lblWarning.Visible = false;
            lblError.Visible   = true;
            btnAddNew.Visible  = false;
        }
    }
コード例 #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");
            }
        }
    }
コード例 #9
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("ViewVaccinationEvent") && (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["VaccinationEvent-dictionary" + language];
                if (wtList == null)
                {
                    List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "VaccinationEvent");
                    wtList = new Dictionary <string, string>();
                    foreach (WordTranslate vwt in wordTranslateList)
                    {
                        wtList.Add(vwt.Code, vwt.Name);
                    }
                    HttpContext.Current.Cache.Insert("VaccinationEvent-dictionary" + language, wtList);
                }

                //controls
                this.lbChild.Text          = wtList["VaccinationEventChild"];
                this.lbVaccineDose.Text    = wtList["VaccinationEventDose"];
                this.lbHealthCenter.Text   = wtList["VaccinationEventHealthFacility"];
                this.lbScheduledDate.Text  = wtList["VaccinationEventScheduledDate"];
                this.lbChildBirthdate.Text = wtList["VaccinationEventBirthdate"];
                //this.cvVaccinationdate.ErrorMessage = wtList["VaccinationEventDateValidator"];

                //grid header text
                gvVaccinationEvent.Columns[1].HeaderText = wtList["VaccinationEventDose"];
                gvVaccinationEvent.Columns[2].HeaderText = wtList["VaccinationEventVaccineLot"];
                gvVaccinationEvent.Columns[3].HeaderText = wtList["VaccinationEventVaccinationDate"];
                gvVaccinationEvent.Columns[4].HeaderText = wtList["VaccinationEventVaccinationStatus"];
                gvVaccinationEvent.Columns[5].HeaderText = wtList["VaccinationEventNonvaccinationReason"];

                //actions
                this.btnEdit.Visible   = actionList.Contains("EditVaccinationEvent");
                this.btnRemove.Visible = actionList.Contains("RemoveVaccinationEvent");

                //buttons
                this.btnEdit.Text   = wtList["VaccinationEventEditButton"];
                this.btnRemove.Text = wtList["VaccinationEventRemoveButton"];

                //message
                this.lblSuccess.Text = wtList["VaccinationEventSuccessText"];
                this.lblWarning.Text = wtList["VaccinationEventWarningText"];
                this.lblError.Text   = wtList["VaccinationEventErrorText"];

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

                //selected object by id
                int    appId  = -1;
                string _appid = Request.QueryString["appId"];
                if (!String.IsNullOrEmpty(_appid))
                {
                    int.TryParse(_appid, out appId);
                    VaccinationAppointment app = VaccinationAppointment.GetVaccinationAppointmentById(appId);
                    PopulateControls(app);
                }
                int    id  = -1;
                string _id = Request.QueryString["id"];
                if (!String.IsNullOrEmpty(_id))
                {
                    id = int.Parse(_id);
                    VaccinationEvent v = VaccinationEvent.GetVaccinationEventById(id);
                    PopulateControls(v);
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
    }
コード例 #10
0
    /// <summary>
    /// Populate Controls on the page by using the vaccination appointment
    /// </summary>
    /// <param name="app">The vaccination appointment that is being called</param>
    private void PopulateControls(VaccinationAppointment app)
    {
        List <VaccinationEvent> le = VaccinationEvent.GetVaccinationEventByAppointmentId(app.Id);

        lnkChild.Text          = app.Child.Name;
        lnkChild.PostBackUrl   = "Child.aspx?id=" + app.Child.Id;
        lblChildBirthdate.Text = app.Child.Birthdate.ToString("dd-MMM-yyyy");
        chbxOutreach.Checked   = app.Outreach;
        string           doses = "";
        VaccinationEvent o     = null;

        foreach (VaccinationEvent ve in le)
        {
            doses += ve.Dose.Fullname + " ";
            lblHealthCenter.Text = ve.HealthFacility.Name;
            o = ve;
        }
        lblVaccineDose.Text   = doses;
        lblScheduledDate.Text = app.ScheduledDate.ToString("dd-MMM-yyyy"); //ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat);

        if (!o.IsActive)
        {
            lblInfo.Visible            = true;
            btnEdit.Visible            = false;
            btnRemove.Visible          = false;
            gvVaccinationEvent.Visible = false;
        }

        foreach (VaccinationEvent ve in le)
        {
            int datediff = DateTime.Today.Date.Subtract(ve.Child.Birthdate).Days;
            if (ve.Dose.FromAgeDefinitionId != 0 && ve.Dose.FromAgeDefinitionId != null)
            {
                if (datediff < ve.Dose.FromAgeDefinition.Days)
                {
                    lblInfo.Visible = true;
                    break;
                }
            }
            if (ve.Dose.ToAgeDefinitionId != 0 && ve.Dose.ToAgeDefinitionId != null)
            {
                if (datediff > ve.Dose.ToAgeDefinition.Days)
                {
                    lblInfo.Visible = true;
                    break;
                }
            }
        }

        // populate supplements table
        lblVitADate.Text       = DateTime.Today.Date.ToString("dd-MMM-yyyy");
        lblMebendezolDate.Text = DateTime.Today.Date.ToString("dd-MMM-yyyy");

        ChildSupplements su = ChildSupplements.GetChildSupplementsByChild(app.Child.Id, DateTime.Today.Date); //get by date

        if (su != null)
        {
            chkVitA.Checked       = su.Vita;
            chkMebendezol.Checked = su.Mebendezol;
        }
        else
        {
            chkVitA.Checked       = false;
            chkMebendezol.Checked = false;
        }

        //populate facility dropdownlist

        int            hfId = CurrentEnvironment.LoggedUser.HealthFacilityId;
        HealthFacility hf   = HealthFacility.GetHealthFacilityById(hfId);

        string where = string.Empty;
        if (!hf.TopLevel)
        {
            string s = HealthFacility.GetAllChildsForOneHealthFacility(hfId, true);
            where = string.Format(@"AND ""ID"" in ( {0})", s);
        }
        odsHealthF.SelectParameters.Clear();
        odsHealthF.SelectParameters.Add("ids", where);
        odsHealthF.DataBind();
        if (hf.VaccinationPoint)
        {
            ddlHealthFacility.SelectedValue = hfId.ToString();
        }

        //populate events grid
        odsVaccinationEvent.SelectParameters.Clear();
        odsVaccinationEvent.SelectParameters.Add("appId", app.Id.ToString());
    }