Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                string forProvider;

                if (_formFromProviderClaim == null)
                {
                    forProvider = "";
                }
                else
                {
                    forProvider = _formFromProviderClaim.doctor_provider_id;
                }

                string   toProvider = _formToProviderClaim.doctor_provider_id;
                DateTime?startDate  = ctlStartDate.CurrentDate;
                DateTime?endDate;
                if (ctlEndDate.CurrentDateText != "")
                {
                    endDate = ctlEndDate.CurrentDate;
                }
                else
                {
                    endDate = null;
                }


                _formRestriction.start_date = startDate;
                _formRestriction.end_date   = endDate;


                _formRestriction.provider_id           = forProvider;
                _formRestriction.switch_to_provider_id = toProvider;
                _formRestriction.insurance_id          = 0;
                _formRestriction.insurance_group_id    = 0;
                _formRestriction.is_advanced           = false;
                _formRestriction.is_enabled            = chkEnabled.Checked;
                _formRestriction.Save();
                provider_eligibility_restrictions.SetGroups(_formRestriction.id, _includedGroups.ToList());

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                Close();
            }
        }
        private void LoadRules()
        {
            provider_eligibility_restrictions workingPER = new provider_eligibility_restrictions();

            string sql = "SELECT * FROM provider_eligibility_restrictions";

            if (cmbCurrentProvider.SelectedIndex > 0)
            {
                sql += string.Format(" WHERE provider_id = '{0}'", ((ProviderInfoDisplay)cmbCurrentProvider.SelectedItem).ProviderID);
            }

            sql += " ORDER BY provider_id, start_date";

            DataTable allMatches = workingPER.Search(sql);

            pnlEnabled.Controls.Clear();
            pnlDisabled.Controls.Clear();

            foreach (DataRow aRow in allMatches.Rows)
            {
                workingPER = new provider_eligibility_restrictions();
                workingPER.Load(aRow);

                if (workingPER.insurance_group_id > 0)
                {
                    // Temporary safeguard since we are switching to multiple storage - take the value out and put it in the table
                    provider_eligibility_restrictions.AddGroup(workingPER.id, workingPER.insurance_group_id, true);
                    workingPER.insurance_group_id = 0;
                    workingPER.Save();
                }

                string fromProvider;

                if (workingPER.provider_id == "")
                {
                    fromProvider = "ALL";
                }
                else
                {
                    fromProvider = workingPER.provider_id;
                }

                try
                {
                    fromProvider = provider_eligibility_restrictions.FindClaimByProviderID(fromProvider).DoctorName + " (" + fromProvider + ")";
                }
                catch { }


                // Add rich text box with text summarytext
                Panel pnl = new Panel();
                pnl.Dock      = DockStyle.Top;
                pnl.Height    = 40;
                pnl.Padding   = new Padding(0, 0, 0, 0);
                pnl.BackColor = BackColor;

                RichTextBox rtb = new RichTextBox();
                rtb.Dock     = DockStyle.Fill;
                rtb.Font     = new System.Drawing.Font(new FontFamily("Microsoft Sans Serif"), 10.0f);
                rtb.Rtf      = GenerateRulesText(workingPER);
                rtb.ReadOnly = true;
                rtb.Tag      = workingPER;

                Button btn = new Button();
                btn.Text   = "Edit";
                btn.Click += Edit_Click;
                btn.Tag    = rtb;
                btn.Font   = new System.Drawing.Font(new FontFamily("Microsoft Sans Serif"), 10.0f);
                btn.Dock   = DockStyle.Right;


                pnl.Controls.Add(rtb);
                pnl.Controls.Add(btn);

                if (!workingPER.is_enabled || (workingPER.end_date.HasValue && workingPER.end_date < DateTime.Today))
                {
                    pnlDisabled.Controls.Add(pnl);
                }
                else
                {
                    pnlEnabled.Controls.Add(pnl);
                }

                pnl.BringToFront();
            }

            lblCurrent.Text  = string.Format("Active ({0})", pnlEnabled.Controls.Count);
            lblDisabled.Text = string.Format("Inactive ({0})", pnlDisabled.Controls.Count);
        }