Exemple #1
0
        ///<summary>Fills both the Specialty and Clinic combo boxes according to the available clinics to the user and the unused specialties for the patient.
        ///Only fills the combo box of clinics with clinics that are associated to specialties that have not been used for this patient yet.
        ///E.g. Even if the user has access to Clinic X, if there is already a clone of this patient for Clinic X, it will no longer show.
        ///Throws exceptions that should be shown to the user which should then be followed by closing the window.</summary>
        private void FillClinicComboBoxes()
        {
            _dictSpecialtyClinics = new Dictionary <long, List <Clinic> >();
            //Fill the list of clinics for this user.
            List <Clinic> listClinicsForUser = Clinics.GetForUserod(Security.CurUser);
            //Make a deep copy of the list of clinics so that we can filter down to the clinics that have no specialty specified if all are hidden.
            List <Clinic> listClinicsNoSpecialty = listClinicsForUser.Select(x => x.Copy()).ToList();
            //Fill the list of defLinks used by clones of this patient.
            List <long>    listClonePatNum    = PatientLinks.GetPatNumsLinkedFrom(_patientMaster.PatNum, PatientLinkType.Clone);
            List <DefLink> listPatCurDefLinks = DefLinks.GetListByFKeys(listClonePatNum, DefLinkType.Patient);
            //Fill the list of clinics defLink
            List <DefLink> listClinicDefLinks = DefLinks.GetDefLinksByType(DefLinkType.Clinic);

            //Filter out any specialties that are currently in use by clones of this patient.
            if (listPatCurDefLinks.Count > 0)
            {
                listClinicDefLinks.RemoveAll(x => x.DefNum.In(listPatCurDefLinks.Select(y => y.DefNum).ToList()));
            }
            //Get all non-hidden specialties
            List <Def> listSpecialtyDefs = Defs.GetDefsForCategory(DefCat.ClinicSpecialty, true);

            //If there are specialties present, we need to know which clinics have no specialty set so that the user can always make clones for that specialty.
            if (listSpecialtyDefs.Count > 0)
            {
                listClinicsNoSpecialty.RemoveAll(x => x.ClinicNum.In(listClinicDefLinks.Select(y => y.FKey).ToList()));
            }
            //Remove all clinics that do not have any specialties from the original list of clinics for the user.
            listClinicsForUser.RemoveAll(x => !x.ClinicNum.In(listClinicDefLinks.Select(y => y.FKey).ToList()));
            //Filter out any specialties that are not associated to any available clinics for this user.
            listSpecialtyDefs.RemoveAll(x => !x.DefNum.In(listClinicDefLinks.Select(y => y.DefNum).ToList()));
            //Lump all of the left over specialties into a dictionary and slap the associated clinics to them.
            comboSpecialty.Items.Clear();
            //Create a dummy specialty of 0 if there are any clinics that do not have a specialty.
            if (listClinicsNoSpecialty != null && listClinicsNoSpecialty.Count > 0)
            {
                comboSpecialty.Items.Add(new ODBoxItem <Def>(Lan.g(this, "Unspecified"), new Def()
                {
                    DefNum = 0
                }));
                _dictSpecialtyClinics[0] = listClinicsNoSpecialty;
            }
            foreach (Def specialty in listSpecialtyDefs)
            {
                comboSpecialty.Items.Add(new ODBoxItem <Def>(specialty.ItemName, specialty));
                //Get a list of all deflinks for the def
                List <DefLink> listLinkForDef = listClinicDefLinks.FindAll(x => x.DefNum == specialty.DefNum).ToList();
                _dictSpecialtyClinics[specialty.DefNum] = listClinicsForUser.FindAll(x => x.ClinicNum.In(listLinkForDef.Select(y => y.FKey).ToList()));
            }
            //If there are no specialties to show, we need to let the user know that they need to associate at least one clinic to a specialty.
            if (_dictSpecialtyClinics.Count < 1)
            {
                MsgBox.Show(this, "This patient already has a clone for every Clinic Specialty available.\r\n"
                            + "In the main menu, click Setup, Definitions, Clinic Specialties category to add new specialties.\r\n"
                            + "In the main menu, click Lists, Clinics, and double click a clinic to set a Specialty.");
                DialogResult = DialogResult.Abort;
                return;
            }
            comboSpecialty.SelectedIndex = 0;
            FillComboClinic();
        }
Exemple #2
0
 private void FormClinics_Load(object sender, System.EventArgs e)
 {
     if (ListClinics == null)
     {
         ListClinics = Clinics.GetAllForUserod(Security.CurUser);
     }
     if (_listClinicDefLinksAll == null)
     {
         _listClinicDefLinksAll = DefLinks.GetDefLinksByType(DefLinkType.Clinic);
     }
     ListClinicsOld                 = ListClinics.Select(x => x.Copy()).ToList();
     _listClinicDefLinksAllOld      = _listClinicDefLinksAll.Select(x => x.Copy()).ToList();
     _listDefLinkClinicSpecialties  = GetDefLinkClinicList();
     _listClinicSpecialtyDefs       = Defs.GetDefsForCategory(DefCat.ClinicSpecialty);
     checkOrderAlphabetical.Checked = PrefC.GetBool(PrefName.ClinicListIsAlphabetical);
     _dictClinicalCounts            = Clinics.GetClinicalPatientCount();
     if (IsSelectionMode)
     {
         butAdd.Visible           = false;
         butOK.Visible            = true;
         groupClinicOrder.Visible = false;
         groupMovePats.Visible    = false;
         int widthDiff = (groupClinicOrder.Width - butOK.Width);
         this.MinimumSize        = new Size(this.MinimumSize.Width - widthDiff, this.MinimumSize.Height);
         this.Width             -= widthDiff;
         gridMain.Width         += widthDiff;
         checkShowHidden.Visible = false;
         checkShowHidden.Checked = false;
     }
     else
     {
         if (checkOrderAlphabetical.Checked)
         {
             butUp.Enabled   = false;
             butDown.Enabled = false;
         }
         else
         {
             butUp.Enabled   = true;
             butDown.Enabled = true;
         }
     }
     if (IsMultiSelect)
     {
         butSelectAll.Visible   = true;
         butSelectNone.Visible  = true;
         gridMain.SelectionMode = GridSelectionMode.MultiExtended;
     }
     FillGrid();
     for (int i = 0; i < gridMain.Rows.Count; i++)
     {
         if (ListSelectedClinicNums.Contains(((Clinic)gridMain.Rows[i].Tag).ClinicNum))
         {
             gridMain.SetSelected(i, true);
         }
     }
 }
        public FormDefEditWSNPApptTypes(Def defCur)
        {
            InitializeComponent();
            Lan.F(this);
            _defCur             = defCur;
            checkHidden.Checked = _defCur.IsHidden;
            textName.Text       = _defCur.ItemName;
            //Look for an associated appointment type.
            List <DefLink> listDefLinks = DefLinks.GetDefLinksByType(DefLinkType.AppointmentType);
            DefLink        defLink      = listDefLinks.FirstOrDefault(x => x.DefNum == _defCur.DefNum);

            if (defLink != null)
            {
                _apptTypeCur = AppointmentTypes.GetFirstOrDefault(x => x.AppointmentTypeNum == defLink.FKey);
            }
            FillTextValue();
        }
Exemple #4
0
        private void FillGridWSNPAReasons()
        {
            List <Def>             listDefs      = Defs.GetDefsForCategory(DefCat.WebSchedNewPatApptTypes, true);
            List <DefLink>         listDefLinks  = DefLinks.GetDefLinksByType(DefLinkType.AppointmentType);
            List <AppointmentType> listApptTypes = AppointmentTypes.GetWhere(x => listDefLinks.Any(y => y.FKey == x.AppointmentTypeNum), true);

            //The combo box within the available times group box should always reflect the grid.
            comboWSNPADefApptType.Items.Clear();
            gridWSNPAReasons.BeginUpdate();
            gridWSNPAReasons.ListGridColumns.Clear();
            gridWSNPAReasons.ListGridColumns.Add(new GridColumn(Lan.g(this, "Reason"), 120));
            gridWSNPAReasons.ListGridColumns.Add(new GridColumn(Lan.g(this, "Pattern"), 0));
            gridWSNPAReasons.ListGridRows.Clear();
            GridRow row;

            foreach (Def def in listDefs)
            {
                AppointmentType apptType = null;
                DefLink         defLink  = listDefLinks.FirstOrDefault(x => x.DefNum == def.DefNum);
                if (defLink == null)
                {
                    continue;                    //Corruption?
                }
                apptType = listApptTypes.FirstOrDefault(x => x.AppointmentTypeNum == defLink.FKey);
                if (apptType == null)
                {
                    continue;                    //Corruption?
                }
                row = new GridRow();
                row.Cells.Add(def.ItemName);
                row.Cells.Add((string.IsNullOrEmpty(apptType.Pattern) ? Lan.g(this, "(use procedure time pattern)") : Appointments.ConvertPatternFrom5(apptType.Pattern)));
                gridWSNPAReasons.ListGridRows.Add(row);
                comboWSNPADefApptType.Items.Add(def.ItemName, def);
            }
            gridWSNPAReasons.EndUpdate();
            if (comboWSNPADefApptType.Items.Count > 0)
            {
                comboWSNPADefApptType.SelectedIndex = 0;              //Select Default.
            }
        }
Exemple #5
0
 private void FormClinics_Load(object sender, System.EventArgs e)
 {
     checkOrderAlphabetical.Checked = PrefC.GetBool(PrefName.ClinicListIsAlphabetical);
     if (ListClinics == null)
     {
         ListClinics = Clinics.GetAllForUserod(Security.CurUser);
         if (IncludeHQInList)
         {
             ListClinics.Insert(0, new Clinic()
             {
                 ClinicNum = 0, Description = Lan.g(this, "Headquarters"), Abbr = Lan.g(this, "HQ")
             });
         }
         //if alphabetical checkbox is checked/unchecked it triggers a pref cache refresh, but does not refill the clinic cache, so we need to sort here
         //in case the pref was changed since last time this was opened.
         ListClinics.Sort(ClinicSort);
     }
     _listClinicsOld           = ListClinics.Select(x => x.Copy()).ToList();
     _listClinicDefLinksAllOld = DefLinks.GetDefLinksByType(DefLinkType.Clinic);
     _dictClinicalCounts       = new SerializableDictionary <long, int>();
     if (IsSelectionMode)
     {
         butAdd.Visible           = false;
         butOK.Visible            = true;
         groupClinicOrder.Visible = false;
         groupMovePats.Visible    = false;
         int widthDiff = (groupClinicOrder.Width - butOK.Width);
         MinimumSize             = new Size(MinimumSize.Width - widthDiff, MinimumSize.Height);
         Width                  -= widthDiff;
         gridMain.Width         += widthDiff;
         butSelectAll.Location   = new Point(butSelectAll.Location.X + widthDiff, butSelectAll.Location.Y);
         butSelectNone.Location  = new Point(butSelectNone.Location.X + widthDiff, butSelectNone.Location.Y);
         checkShowHidden.Visible = false;
         checkShowHidden.Checked = false;
     }
     else
     {
         if (checkOrderAlphabetical.Checked)
         {
             butUp.Enabled   = false;
             butDown.Enabled = false;
         }
         _dictClinicalCounts = Clinics.GetClinicalPatientCount();
     }
     if (IsMultiSelect)
     {
         butSelectAll.Visible   = true;
         butSelectNone.Visible  = true;
         gridMain.SelectionMode = GridSelectionMode.MultiExtended;
     }
     FillGrid(false);
     if (!ListSelectedClinicNums.IsNullOrEmpty())
     {
         for (int i = 0; i < gridMain.ListGridRows.Count; i++)
         {
             if (ListSelectedClinicNums.Contains(((Clinic)gridMain.ListGridRows[i].Tag).ClinicNum))
             {
                 gridMain.SetSelected(i, true);
             }
         }
     }
 }