Ejemplo n.º 1
0
        private void butEdit_Click(object sender, System.EventArgs e)
        {
            try{
                DataToCur();
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            Referral         referral = Referrals.GetReferral(RefAttachCur.ReferralNum);
            FormReferralEdit FormRE   = new FormReferralEdit(referral);

            FormRE.ShowDialog();
            Referrals.RefreshCache();
            FillData();
        }
Ejemplo n.º 2
0
        private void FillTable()
        {
            Referrals.RefreshCache();
            listRef = Referrals.GetDeepCopy();
            if (!checkHidden.Checked)
            {
                listRef.RemoveAll(x => x.IsHidden);
            }
            if (!checkShowPat.Checked)
            {
                listRef.RemoveAll(x => x.PatNum > 0);
            }
            if (!checkShowDoctor.Checked)
            {
                listRef.RemoveAll(x => x.IsDoctor);
            }
            if (!checkShowOther.Checked)
            {
                listRef.RemoveAll(x => x.PatNum == 0 && !x.IsDoctor);
            }
            if (checkPreferred.Checked)
            {
                listRef.RemoveAll(x => !x.IsPreferred);
            }
            if (!string.IsNullOrWhiteSpace(textSearch.Text))
            {
                string[] searchTokens = textSearch.Text.ToLower().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                listRef.RemoveAll(x => searchTokens.Any(y => !x.FName.ToLower().Contains(y) && !x.LName.ToLower().Contains(y)));
            }
            int  scrollValue    = gridMain.ScrollValue;
            long selectedRefNum = -1;

            if (gridMain.GetSelectedIndex() > -1)
            {
                selectedRefNum = ((Referral)gridMain.Rows[gridMain.GetSelectedIndex()].Tag).ReferralNum;
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "LastName"), 150));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "FirstName"), 80));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "MI"), 30));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Title"), 70));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Specialty"), 60));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Patient"), 45));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Note"), 250));
            gridMain.Rows.Clear();
            ODGridRow row;
            int       indexSelectedRef = -1;

            foreach (Referral refCur in listRef)
            {
                row = new ODGridRow();
                row.Cells.Add(refCur.LName);
                row.Cells.Add(refCur.FName);
                row.Cells.Add(refCur.MName.Left(1).ToUpper());                //Left(1) will return empty string if MName is null or empty string, so ToUpper is null safe
                row.Cells.Add(refCur.Title);
                row.Cells.Add(refCur.IsDoctor?Lan.g("enumDentalSpecialty", Defs.GetName(DefCat.ProviderSpecialties, refCur.Specialty)):"");
                row.Cells.Add(refCur.PatNum > 0?"X":"");
                row.Cells.Add(refCur.Note);
                if (refCur.IsHidden)
                {
                    row.ColorText = Color.Gray;
                }
                row.Tag = refCur;
                gridMain.Rows.Add(row);
                if (refCur.ReferralNum == selectedRefNum)
                {
                    indexSelectedRef = gridMain.Rows.Count - 1;
                }
            }
            gridMain.EndUpdate();
            if (indexSelectedRef > -1)
            {
                gridMain.SetSelected(indexSelectedRef, true);
            }
            gridMain.ScrollValue  = scrollValue;
            labelResultCount.Text = gridMain.Rows.Count.ToString() + Lan.g(this, " results found");
        }
Ejemplo n.º 3
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            string phone = textPhone1.Text + textPhone2.Text + textPhone3.Text;

            if (phone.Length > 0 && phone.Length < 10)
            {
                MessageBox.Show(Lan.g(this, "Invalid phone"));
                return;
            }
            if (textLName.Text == "")
            {
                MsgBox.Show(this, "Please enter a last name.");
                return;
            }
            RefCur.IsHidden       = checkHidden.Checked;
            RefCur.NotPerson      = checkNotPerson.Checked;
            RefCur.LName          = textLName.Text;
            RefCur.FName          = textFName.Text;
            RefCur.MName          = textMName.Text;
            RefCur.Title          = textTitle.Text;
            RefCur.Address        = textAddress.Text;
            RefCur.Address2       = textAddress2.Text;
            RefCur.City           = textCity.Text;
            RefCur.ST             = textST.Text;
            RefCur.Zip            = textZip.Text;
            RefCur.Telephone      = phone;
            RefCur.Phone2         = textOtherPhone.Text;
            RefCur.SSN            = textSSN.Text;
            RefCur.NationalProvID = textNationalProvID.Text;
            RefCur.EMail          = textEmail.Text;
            RefCur.Note           = textNotes.Text;
            RefCur.Slip           = 0;
            if (comboSlip.SelectedIndex > 0)
            {
                RefCur.Slip = SlipList[comboSlip.SelectedIndex - 1].SheetDefNum;
            }
            //RefCur.UsingTIN already taken care of
            if (!IsPatient)
            {
                RefCur.IsDoctor  = checkIsDoctor.Checked;
                RefCur.Specialty = (DentalSpecialty)listSpecialty.SelectedIndex;
            }
            if (IsNew)
            {
                for (int i = 0; i < Referrals.List.Length; i++)
                {
                    if ((RefCur.LName + RefCur.FName) == (Referrals.List[i].LName + Referrals.List[i].FName))
                    {
                        if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Referral of same name exists. Add anyway?"))
                        {
                            DialogResult = DialogResult.Cancel;
                            return;
                        }
                        break;
                    }
                }
                Referrals.Insert(RefCur);
            }
            else
            {
                Referrals.Update(RefCur);
            }
            //
            Referrals.RefreshCache();
            //MessageBox.Show(RefCur.ReferralNum.ToString());
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 4
0
        private void FillTable()
        {
            Referrals.RefreshCache();
            listRef = new List <Referral>();
            for (int i = 0; i < Referrals.List.Length; i++)
            {
                if (!checkHidden.Checked)                 //don't include hidden
                {
                    if (Referrals.List[i].IsHidden)       //if hidden
                    {
                        continue;
                    }
                }
                if (textSearch.Text != "")
                {
                    if (!Referrals.List[i].LName.ToLower().StartsWith(textSearch.Text.ToLower()))                     //no match
                    {
                        continue;
                    }
                }
                listRef.Add(Referrals.List[i]);
            }
            int  scrollValue    = gridMain.ScrollValue;
            long selectedRefNum = -1;

            if (gridMain.GetSelectedIndex() != -1)
            {
                selectedRefNum = ((Referral)gridMain.Rows[gridMain.GetSelectedIndex()].Tag).ReferralNum;
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lans.g("TableSelectRefferal", "LastName"), 150);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "FirstName"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "MI"), 30);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "Title"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "Specialty"), 60);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "Patient"), 45);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "Note"), 250);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < listRef.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listRef[i].LName);
                row.Cells.Add(listRef[i].FName);
                if (listRef[i].MName != "")
                {
                    row.Cells.Add(listRef[i].MName.Substring(0, 1).ToUpper());
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(listRef[i].Title);
                if (listRef[i].IsDoctor)
                {
                    row.Cells.Add(Lan.g("enumDentalSpecialty", ((DentalSpecialty)(listRef[i].Specialty)).ToString()));
                }
                else
                {
                    row.Cells.Add("");
                }
                if (listRef[i].PatNum > 0)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(listRef[i].Note);
                if (listRef[i].IsHidden)
                {
                    row.ColorText = Color.Gray;
                }
                row.Tag = listRef[i];
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            labelResultCount.Text = gridMain.Rows.Count.ToString() + " results found.";
            gridMain.ScrollValue  = scrollValue;
            for (int i = 0; i < gridMain.Rows.Count; i++)
            {
                if (((Referral)gridMain.Rows[i].Tag).ReferralNum == selectedRefNum)
                {
                    gridMain.SetSelected(i, true);
                    break;
                }
            }
        }