Esempio n. 1
0
    public int PatientRemove(int patientId)
    {
        chsi.dat.CHSIEntities db = new chsi.dat.CHSIEntities();
        chsi.dat.payNewPatients patient = db.payNewPatients.Where(a => a.payNewPatientId == patientId).FirstOrDefault();

        if (patient == null)
            return 0;

        patient.Active = false;
        db.SaveChanges();
        return patientId;
    }
Esempio n. 2
0
    public bool PatientContactSave(int patientId, string employee, string whatHappened, string notes, bool isDND, bool isIneligible, bool isCallback, bool isApptMade, DateTime? callBackDateTime, DateTime? apptDateTime)
    {
        try
        {

            chsi.dat.CHSIEntities db = new chsi.dat.CHSIEntities();

            string details = "";

            chsi.dat.payNewPatientContacts c = new chsi.dat.payNewPatientContacts();
            c.payNewPatientId = patientId;
            c.ContactDate = DateTime.Now;
            c.EmployeeName = employee;

            switch (whatHappened.ToLower().Trim())
            {
                case "phonenoanswer": c.isPhoneNoAnswer = true; break;
                case "phoneanswer": c.isPhoneAnswered = true; break;
                case "phoneleftmessage": c.isPhoneLeftMessage = true; break;
                case "phonebusy": c.isPhoneBusy = true; break;
                case "phonewrongnumber": c.isPhoneWrongNumber = true; break;
                case "phonedisconnected": c.isPhoneDisconnected = true; break;
                case "postcardsent": c.isPostCardSent = true; break;

            }

            c.isDoNotDisturbRequested = isDND;
            c.isIneligible = isIneligible;
            c.isRequestCallBack = isCallback;
            c.isApptMade = isApptMade;

            if (isCallback)
            {
                c.CallBack = callBackDateTime;
                DateTime dt = (DateTime)callBackDateTime;
                details = string.Format("Callback requested for {0} {1}{2}", dt.ToShortDateString(), (dt.Hour > 0 ? dt.ToShortTimeString() : ""), Environment.NewLine);

            }

            if (isApptMade)
            {
                c.Appt = apptDateTime;
                DateTime dt = (DateTime)apptDateTime;
                details = string.Format("Appointment made for {0} {1}{2}", dt.ToShortDateString(), (dt.Hour > 0 ? dt.ToShortTimeString() : ""), Environment.NewLine);
            }

            if (isDND)
            {
                details += "Patient requests Do Not Disturb" + Environment.NewLine;
            }

            if (isIneligible)
            {
                details += "Patient is inelibible" + Environment.NewLine;
            }

            details += notes;
            c.Details = details;

            db.AddTopayNewPatientContacts(c);
            db.SaveChanges();

            return true;
        }
        catch (Exception e)
        {

        }

        return false;
    }
Esempio n. 3
0
    protected void btnSaveAssist_Click(object sender, EventArgs e)
    {
        chsi.dat.CHSIEntities db = new chsi.dat.CHSIEntities();
        int _assistId = 0;
        int _appId = 0;

        if (!String.IsNullOrEmpty(Request.QueryString["assistId"]))
        {
            string assistId = Request.QueryString["assistId"];
            int.TryParse(assistId, out _assistId);
        }

        if (!String.IsNullOrEmpty(Request.QueryString["appId"]))
        {
            string appId = Request.QueryString["appId"];
            int.TryParse(appId, out _appId);
        }

        if (_assistId == 0)
        {
            chsi.dat.acaAssists newAssist = new acaAssists();

            newAssist.Notes = txtNotes.Text;
            newAssist.AssistDate = Convert.ToDateTime(txtDateOfEncounter.Text);
            newAssist.PrimaryApplicantId = _appId;
            newAssist.RegionId = Convert.ToInt32(ddlRegion.SelectedValue);
            newAssist.SiteId = Convert.ToInt32(ddlSite.SelectedValue);
            newAssist.AssistTypeId = Convert.ToInt32(ddlAssistType.SelectedValue);
            newAssist.RepresentativeId = Convert.ToInt32(ddlPSR.SelectedValue);

            if (ddlAssistType.SelectedValue == "7")
                newAssist.isSubmission = true;
            else
                newAssist.isSubmission = false;

            if (ddlAssistType.SelectedValue == "9")
                newAssist.isEnrolled = true;
            else
                newAssist.isEnrolled = false;

            db.acaAssists.AddObject(newAssist);
            db.SaveChanges();

        }
        else
        {
            acaAssists assist = (from a in db.acaAssists
                                 where a.AssistId == _assistId
                                 select a).FirstOrDefault();

            assist.Notes = txtNotes.Text;
            assist.AssistDate = Convert.ToDateTime(txtDateOfEncounter.Text);
            assist.RegionId = Convert.ToInt32(ddlRegion.SelectedValue);
            assist.SiteId = Convert.ToInt32(ddlSite.SelectedValue);
            assist.AssistTypeId = Convert.ToInt32(ddlAssistType.SelectedValue);
            assist.RepresentativeId = Convert.ToInt32(ddlPSR.SelectedValue);

            if (ddlAssistType.SelectedValue == "7")
                assist.isSubmission = true;
            else
                assist.isSubmission = false;

            if (ddlAssistType.SelectedValue == "9")
                assist.isEnrolled = true;
            else
                assist.isEnrolled = false;

            db.SaveChanges();

        }

        foreach (RepeaterItem item in rptrFamily.Items)
        {
            HiddenField applicantId = (HiddenField)item.FindControl("hidApplicantId");
            CheckBox submission = (CheckBox)item.FindControl("cbxSubmission");
            CheckBox enrolled = (CheckBox)item.FindControl("cbxEnrolled");
            CheckBox providerSelected = (CheckBox)item.FindControl("cbxProviderSelected");
            DropDownList payer = (DropDownList)item.FindControl("ddlPayers");
            DropDownList types = (DropDownList)item.FindControl("ddlTypes");
            DropDownList tiers = (DropDownList)item.FindControl("ddlTiers");
            DropDownList subTiers = (DropDownList)item.FindControl("ddlSubTiers");

            int appId = Convert.ToInt32(applicantId.Value);

            //Save Applicant
            acaApplicants app = (from a in db.acaApplicants
                                 where a.ApplicantId == appId
                                 select a).FirstOrDefault();

            app.IsEnrolled = enrolled.Checked;
            app.IsSubmission = submission.Checked;
            app.SelectedCHSIProvider = providerSelected.Checked;

            db.SaveChanges();

            //Save health plan
            acaHealthPlans hp = (from h in db.acaHealthPlans
                                 where h.ApplicantId == appId
                                 select h).FirstOrDefault();

            if (payer.SelectedIndex > 0)
                hp.PayerId = Convert.ToInt32(payer.SelectedValue);
            else
                hp.PayerId = null;

            if (types.SelectedIndex > 0)
                hp.PlanTypeId = Convert.ToInt32(types.SelectedValue);
            else
                hp.PlanTypeId = null;

            if (tiers.SelectedIndex > 0)
                hp.PlanTierId = Convert.ToInt32(tiers.SelectedValue);
            else
                hp.PlanTierId = null;

            if (subTiers.SelectedIndex > 0)
                hp.PlanSubTierId = Convert.ToInt32(subTiers.SelectedValue);
            else
                hp.PlanSubTierId = null;

            db.SaveChanges();

        }

        //total assists for each assist record
        int totalAssistCount = db.acaAssists.Where(a => a.PrimaryApplicantId == _appId).Count();
        int totalEnrolled = db.acaAssists.Where(a => a.AssistTypeId == 9 && a.PrimaryApplicantId == _appId).Count();
        int totalSubmitted = db.acaAssists.Where(a => a.AssistTypeId == 7 && a.PrimaryApplicantId == _appId).Count();
        int familyCount = db.acaApplicants.Where(a => a.PrimaryApplicantId == _appId || a.ApplicantId == _appId).Count();

        var some = db.acaAssists.Where(a => a.PrimaryApplicantId == _appId).ToList();

        some.ForEach(a => a.NumberAssisted = (totalAssistCount * familyCount));
        some.ForEach(a => a.NumberEnrolled = (totalEnrolled));
        some.ForEach(a => a.NumberSubmitted = (totalSubmitted));

        db.SaveChanges();

        Response.Redirect(string.Format("/aca/assists?appId={0}", _appId));
    }
Esempio n. 4
0
    protected void btnAddApplicant_Click(object sender, EventArgs e)
    {
        chsi.dat.CHSIEntities db = new chsi.dat.CHSIEntities();
        int _appId = 0;

        if (!String.IsNullOrEmpty(Request.QueryString["appId"]))
        {
            string appId = Request.QueryString["appId"];
            int.TryParse(appId, out _appId);
        }

        if (_appId == 0)
        {
            chsi.dat.acaApplicants app = new acaApplicants();

            app.FirstName = this.txtFirstName.Text.Trim();
            app.LastName = this.txtLastName.Text.Trim();
            //app.Email = this.txtEmail.Text.Trim();
            //app.Address = this.txtAddress.Text.Trim();
            //app.City = this.txtCity.Text.Trim();
            app.isPrimary = true;
            app.DateOfBirth = Convert.ToDateTime(this.txtDOB.Text);
            app.Phone = this.txtPhone.Text.Trim();
            app.RegionId = int.Parse(this.ddRegion.SelectedValue);
            app.isActive = this.chkActive.Checked;
            //app.Zip = this.txtZip.Text.Trim();
            app.Notes = this.txtNotes.Text.Trim();

            db.acaApplicants.AddObject(app);
            db.SaveChanges();

            int appId = app.ApplicantId;

            acaHealthPlans hp = new acaHealthPlans();
            hp.ApplicantId = appId;
            db.acaHealthPlans.AddObject(hp);
            db.SaveChanges();

            Response.Redirect(string.Format("/aca/assists?appId={0}", appId));
        }
        else
        {
            acaApplicants app = (from a in db.acaApplicants
                                       where a.ApplicantId == _appId
                                       select a).FirstOrDefault();

            app.FirstName = this.txtFirstName.Text.Trim();
            app.LastName = this.txtLastName.Text.Trim();
            //app.Email = this.txtEmail.Text.Trim();
            //app.Address = this.txtAddress.Text.Trim();
            //app.City = this.txtCity.Text.Trim();
            app.DateOfBirth = Convert.ToDateTime(this.txtDOB.Text);
            app.isPrimary = true;
            app.Phone = this.txtPhone.Text.Trim();
            app.RegionId = int.Parse(this.ddRegion.SelectedValue);
            app.isActive = this.chkActive.Checked;
            //app.Zip = this.txtZip.Text.Trim();
            app.Notes = this.txtNotes.Text.Trim();

            db.SaveChanges();
            Response.Redirect(string.Format("/aca/assists?appId={0}", _appId));

        }
    }
Esempio n. 5
0
    public int SaveApplicant(string FirstName, string LastName, string DateOfBirth, string Region
                            , string Active, string Address, string City, string Zip
                            , string Phone, string Email, string Notes)
    {
        chsi.dat.acaApplicants applicant = new chsi.dat.acaApplicants();

        applicant.FirstName = FirstName;
        applicant.LastName = LastName;
        applicant.isActive = (Active == "true")? true : false;
        applicant.Address = Address;
        applicant.City = City;
        applicant.Zip = Zip;
        applicant.Phone = Phone;
        applicant.Email = Email;
        applicant.DateOfBirth = Convert.ToDateTime(DateOfBirth);
        applicant.RegionId = Convert.ToInt32(Region);
        applicant.Notes = Notes;

        chsi.dat.CHSIEntities db = new chsi.dat.CHSIEntities();
        db.acaApplicants.AddObject(applicant);
        db.SaveChanges();

        return applicant.ApplicantId;
    }
    protected void btnSaveAssist_Click(object sender, EventArgs e)
    {
        chsi.dat.CHSIEntities db = new chsi.dat.CHSIEntities();
        int _assistId = 0;
        int _appId = 0;

        _submissionId = int.Parse(ddlAssistType.Items.FindByText("Submitting application").Value);
        _enrolledId = int.Parse(ddlAssistType.Items.FindByText("Enrollment Confirmation, payment submitted").Value);

        if (!String.IsNullOrEmpty(Request.QueryString["assistId"]))
        {
            string assistId = Request.QueryString["assistId"];
            int.TryParse(assistId, out _assistId);
        }

        if (!String.IsNullOrEmpty(Request.QueryString["appId"]))
        {
            string appId = Request.QueryString["appId"];
            int.TryParse(appId, out _appId);
        }

        chsi.dat.acaAssists assist = new acaAssists();

        if (_assistId > 0)
        {
            assist = (from a in db.acaAssists
                      where a.AssistId == _assistId
                      select a).FirstOrDefault();
        }

        assist.Notes = txtNotes.Text;
        assist.AssistDate = Convert.ToDateTime(txtDateOfEncounter.Text);
        assist.PrimaryApplicantId = _appId;
        assist.RegionId = Convert.ToInt32(ddlRegion.SelectedValue);
        assist.SiteId = Convert.ToInt32(ddlSite.SelectedValue);
        assist.AssistTypeId = Convert.ToInt32(ddlAssistType.SelectedValue);
        assist.RepresentativeId = Convert.ToInt32(ddlPSR.SelectedValue);

        assist.isSubmission = (int.Parse(ddlAssistType.SelectedValue) == _submissionId);
        assist.isEnrolled = (int.Parse(ddlAssistType.SelectedValue) == _enrolledId);

        int familyCount = db.acaApplicants.Where(a => a.PrimaryApplicantId == _appId || a.ApplicantId == _appId).Count();
        assist.NumberAssisted = familyCount;

        if (assist.isSubmission )
        {
            //get previous totals
            int prevSubmitted = 0;
            int.TryParse(db.acaAssists.Where(a => a.AssistTypeId == _submissionId && a.PrimaryApplicantId == _appId).ToList().Select(a => a.NumberAssisted).Sum().ToString(), out prevSubmitted);
            int totalSubmitted = GetCount("cbxSubmission");
            assist.NumberAssisted = Math.Abs(totalSubmitted - prevSubmitted);
        }

        if (assist.isEnrolled)
        {
            //get previous totals
            int prevEnrolled = 0;
            int.TryParse(db.acaAssists.Where(a => a.AssistTypeId == _enrolledId && a.PrimaryApplicantId == _appId).ToList().Select(a => a.NumberAssisted).Sum().ToString(), out prevEnrolled);

            int totalEnrolled = GetCount("cbxEnrolled");
            assist.NumberAssisted = Math.Abs(totalEnrolled - prevEnrolled);
        }

        if (_assistId == 0)
            db.acaAssists.AddObject(assist);

        //only update health plans if this is an enrollment or submission
        if (assist.isEnrolled || assist.isSubmission)
            UpdateHealthPlans();

        db.SaveChanges();

        Response.Redirect(string.Format("/aca/assists?appId={0}", _appId));
    }
    private void UpdateHealthPlans()
    {
        chsi.dat.CHSIEntities db = new chsi.dat.CHSIEntities();

        foreach (RepeaterItem item in rptrFamily.Items)
        {
            HiddenField applicantId = (HiddenField)item.FindControl("hidApplicantId");
            CheckBox submission = (CheckBox)item.FindControl("cbxSubmission");
            CheckBox enrolled = (CheckBox)item.FindControl("cbxEnrolled");
            CheckBox providerSelected = (CheckBox)item.FindControl("cbxProviderSelected");
            DropDownList payer = (DropDownList)item.FindControl("ddlPayers");
            DropDownList types = (DropDownList)item.FindControl("ddlTypes");
            DropDownList tiers = (DropDownList)item.FindControl("ddlTiers");
            DropDownList subTiers = (DropDownList)item.FindControl("ddlSubTiers");

            int appId = Convert.ToInt32(applicantId.Value);

            //Save Applicant
            acaApplicants app = (from a in db.acaApplicants
                                 where a.ApplicantId == appId
                                 select a).FirstOrDefault();

            app.IsEnrolled = enrolled.Checked;
            app.IsSubmission = submission.Checked;
            app.SelectedCHSIProvider = providerSelected.Checked;

                      db.SaveChanges();

            //Save health plan
            acaHealthPlans hp = (from h in db.acaHealthPlans
                                 where h.ApplicantId == appId
                                 select h).FirstOrDefault();

            if (payer.SelectedIndex > 0)
                hp.PayerId = Convert.ToInt32(payer.SelectedValue);
            else
                hp.PayerId = null;

            if (types.SelectedIndex > 0)
                hp.PlanTypeId = Convert.ToInt32(types.SelectedValue);
            else
                hp.PlanTypeId = null;

            if (tiers.SelectedIndex > 0)
                hp.PlanTierId = Convert.ToInt32(tiers.SelectedValue);
            else
                hp.PlanTierId = null;

            if (subTiers.SelectedIndex > 0)
                hp.PlanSubTierId = Convert.ToInt32(subTiers.SelectedValue);
            else
                hp.PlanSubTierId = null;

            db.SaveChanges();

        }
    }