Exemple #1
0
        ///<summary>Updates the in memory dictionary with any changes made to the current locationID for each clinic before showing the next one.</summary>
        private void SaveClinicCurProgramPropertiesToDict()
        {
            //First check if Headquarters (default) is selected.
            if (_clinicNumCur == 0)
            {
                //Headquarters is selected so only update the location ID (might have changed) on all other location ID properties that match the "old" location ID of HQ.
                if (_dictLocationIDs.ContainsKey(_clinicNumCur))
                {
                    //Get the location ID so that we correctly update all program properties with a matching location ID.
                    string locationIdOld = _dictLocationIDs[_clinicNumCur].PropertyValue;
                    foreach (KeyValuePair <long, ProgramProperty> item in _dictLocationIDs)
                    {
                        ProgramProperty ppCur = item.Value;
                        if (ppCur.PropertyValue == locationIdOld)
                        {
                            ppCur.PropertyValue = textLocationID.Text;
                        }
                    }
                }
                return;                //No other clinic specific changes could have been made, we need to return.
            }
            //Update or Insert clinic specific properties into memory
            ProgramProperty ppLocationID = new ProgramProperty();

            if (_dictLocationIDs.ContainsKey(_clinicNumCur))
            {
                ppLocationID = _dictLocationIDs[_clinicNumCur]; //Override the database's property with what is in memory.
            }
            else                                                //Get default programproperty from db.
            {
                ppLocationID = ProgramProperties.GetListForProgramAndClinicWithDefault(_progCur.ProgramNum, _clinicNumCur)
                               .FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.LocationID);
            }
            if (ppLocationID.ClinicNum == 0)           //No program property for current clinic, since _clinicNumCur!=0
            {
                ProgramProperty ppLocationIDNew = ppLocationID.Copy();
                ppLocationIDNew.ProgramPropertyNum = 0;
                ppLocationIDNew.ClinicNum          = _clinicNumCur;
                ppLocationIDNew.PropertyValue      = textLocationID.Text;
                if (!_dictLocationIDs.ContainsKey(_clinicNumCur))                 //Should always happen
                {
                    _dictLocationIDs.Add(_clinicNumCur, ppLocationIDNew);
                }
                return;
            }
            //At this point we know that the clinicnum isn't 0 and the database has a property for that clinicnum.
            if (_dictLocationIDs.ContainsKey(_clinicNumCur))             //Should always happen
            {
                ppLocationID.PropertyValue      = textLocationID.Text;
                _dictLocationIDs[_clinicNumCur] = ppLocationID;
            }
            else
            {
                _dictLocationIDs.Add(_clinicNumCur, ppLocationID);               //Should never happen.
            }
        }
Exemple #2
0
 private void FormPodiumSetup_Load(object sender, EventArgs e)
 {
     if (PrefC.HasClinicsEnabled)             //Using clinics
     {
         _listUserClinicNums = new List <long>();
         comboClinic.Items.Clear();
         if (Security.CurUser.ClinicIsRestricted)
         {
             if (checkEnabled.Checked)
             {
                 checkEnabled.Enabled = false;
                 _clinicNumCur        = 0;
             }
         }
         else
         {
             comboClinic.Items.Add(Lan.g(this, "Headquarters"));
             //this way both lists have the same number of items in it and if 'Headquarters' is selected the programproperty.ClinicNum will be set to 0
             _listUserClinicNums.Add(0);
             comboClinic.SelectedIndex = 0;
             _clinicNumCur             = 0;
         }
         List <Clinic> listClinics = Clinics.GetForUserod(Security.CurUser);
         for (int i = 0; i < listClinics.Count; i++)
         {
             comboClinic.Items.Add(listClinics[i].Abbr);
             _listUserClinicNums.Add(listClinics[i].ClinicNum);
             if (Clinics.ClinicNum == listClinics[i].ClinicNum)
             {
                 comboClinic.SelectedIndex = i;
                 if (!Security.CurUser.ClinicIsRestricted)
                 {
                     comboClinic.SelectedIndex++;                            //increment the SelectedIndex to account for 'Headquarters' in the list at position 0 if the user is not restricted.
                 }
                 _clinicNumCur = _listUserClinicNums[comboClinic.SelectedIndex];
             }
         }
     }
     else              //clinics are not enabled, use ClinicNum 0 to indicate 'Headquarters' or practice level program properties
     {
         comboClinic.Visible = false;
         labelClinic.Visible = false;
         _listUserClinicNums = new List <long>()
         {
             0
         };                                                         //if clinics are disabled, programproperty.ClinicNum will be set to 0
         _clinicNumCur = 0;
     }
     _progCur = Programs.GetCur(ProgramName.Podium);
     if (_progCur == null)
     {
         MsgBox.Show(this, "The Podium bridge is missing from the database.");               //should never happen
         DialogResult = DialogResult.Cancel;
         return;
     }
     try {
         long clinicNum = 0;
         if (comboClinic.SelectedIndex > 0)               //0 is always "All" so only check for greater than 0.
         {
             clinicNum = _listUserClinicNums[comboClinic.SelectedIndex];
         }
         _listProgramProperties = ProgramProperties.GetListForProgramAndClinicWithDefault(_progCur.ProgramNum, clinicNum);
         _useService            = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.UseService);
         _disableAdvertising    = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.DisableAdvertising);
         _apptSetCompleteMins   = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.ApptSetCompletedMinutes);
         _apptTimeArrivedMins   = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.ApptTimeArrivedMinutes);
         _apptTimeDismissedMins = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.ApptTimeDismissedMinutes);
         _compName = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.ComputerNameOrIP);
         _apiToken = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.APIToken);
         List <ProgramProperty> listLocationIDs = ProgramProperties.GetForProgram(_progCur.ProgramNum).FindAll(x => x.PropertyDesc == Podium.PropertyDescs.LocationID);
         _dictLocationIDs.Clear();
         foreach (ProgramProperty ppCur in listLocationIDs)                 //If clinics is off, this will only grab the program property with a 0 clinic num (_listUserClinicNums will only have 0).
         {
             if (_dictLocationIDs.ContainsKey(ppCur.ClinicNum) || !_listUserClinicNums.Contains(ppCur.ClinicNum))
             {
                 continue;
             }
             _dictLocationIDs.Add(ppCur.ClinicNum, ppCur);
         }
         _newPatTriggerType             = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.NewPatientTriggerType);
         _existingPatTriggerType        = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.ExistingPatientTriggerType);
         _showCommlogsInChartAndAccount = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == Podium.PropertyDescs.ShowCommlogsInChartAndAccount);
     }
     catch (Exception) {
         MsgBox.Show(this, "You are missing a program property for Podium.  Please contact support to resolve this issue.");
         DialogResult = DialogResult.Cancel;
         return;
     }
     FillForm();
     SetAdvertising();
 }
Exemple #3
0
 private void FormXDRSetup_Load(object sender, EventArgs e)
 {
     if (PrefC.HasClinicsEnabled)             //Using clinics
     {
         _listUserClinicNums = new List <long>();
         comboClinic.Items.Clear();
         comboClinic.Items.Add(Lan.g(this, "Headquarters"));
         //This way both lists have the same number of items in it and if 'Headquarters' is selected the programproperty.ClinicNum will be set to 0
         _listUserClinicNums.Add(0);
         comboClinic.SelectedIndex = 0;
         _clinicNumCur             = 0;
         List <Clinic> listClinics = Clinics.GetForUserod(Security.CurUser);
         for (int i = 0; i < listClinics.Count; i++)
         {
             comboClinic.Items.Add(listClinics[i].Abbr);
             _listUserClinicNums.Add(listClinics[i].ClinicNum);
             if (Clinics.ClinicNum == listClinics[i].ClinicNum)
             {
                 comboClinic.SelectedIndex = i;
                 if (!Security.CurUser.ClinicIsRestricted)
                 {
                     comboClinic.SelectedIndex++;                            //increment the SelectedIndex to account for 'Headquarters' in the list at position 0 if the user is not restricted.
                 }
                 _clinicNumCur = _listUserClinicNums[comboClinic.SelectedIndex];
             }
         }
     }
     else              //clinics are not enabled, use ClinicNum 0 to indicate 'Headquarters' or practice level program properties
     {
         comboClinic.Visible = false;
         labelClinic.Visible = false;
         _listUserClinicNums = new List <long>()
         {
             0
         };                                                         //if clinics are disabled, programproperty.ClinicNum will be set to 0
         _clinicNumCur = 0;
     }
     _progCur = Programs.GetCur(ProgramName.XDR);
     if (_progCur == null)
     {
         MsgBox.Show(this, "The XDR bridge is missing from the database.");               //should never happen
         DialogResult = DialogResult.Cancel;
         return;
     }
     try {
         long clinicNum = 0;
         if (comboClinic.SelectedIndex > 0)               //0 is always "All" so only check for greater than 0.
         {
             clinicNum = _listUserClinicNums[comboClinic.SelectedIndex];
         }
         _listProgramProperties = ProgramProperties.GetListForProgramAndClinicWithDefault(_progCur.ProgramNum, clinicNum);
         _patNumOrChartNum      = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == XDR.PropertyDescs.PatNumOrChartNum);
         _infoFilePath          = _listProgramProperties.FirstOrDefault(x => x.PropertyDesc == XDR.PropertyDescs.InfoFilePath);
         List <ProgramProperty> listLocationIDs = ProgramProperties.GetForProgram(_progCur.ProgramNum).FindAll(x => x.PropertyDesc == XDR.PropertyDescs.LocationID);
         _dictLocationIDs.Clear();
         //If clinics is off, this will only grab the program property with a 0 clinicNum (_listUserClinicNums will only have 0).
         foreach (ProgramProperty ppCur in listLocationIDs)
         {
             if (_dictLocationIDs.ContainsKey(ppCur.ClinicNum) || !_listUserClinicNums.Contains(ppCur.ClinicNum))
             {
                 continue;
             }
             _dictLocationIDs.Add(ppCur.ClinicNum, ppCur);
         }
     }
     catch (Exception ex) {
         ex.DoNothing();
         MsgBox.Show(this, "You are missing a program property for XDR.  Please contact support to resolve this issue.");
         DialogResult = DialogResult.Cancel;
         return;
     }
     FillForm();
 }