private void butOK_Click(object sender, System.EventArgs e)
 {
     if (OldFieldName != textName.Text && !IsNew)
     {
         if (!PrefC.GetBool(PrefName.DisplayRenamedPatFields) &&
             !MsgBox.Show(this, MsgBoxButtons.YesNo, "Changing the field name will cause existing information for this field to be hidden.  Continue?"))
         {
             textName.Text = OldFieldName;
             return;
         }
         if (PatFieldDefs.GetExists(x => x.FieldName == textName.Text))
         {
             MsgBox.Show(this, "Field name currently being used.");
             return;
         }
     }
     FieldDef.FieldName = textName.Text;
     FieldDef.IsHidden  = checkHidden.Checked;
     FieldDef.FieldType = (PatFieldType)comboFieldType.SelectedIndex;
     if (FieldDef.FieldType == PatFieldType.PickList)
     {
         if (textPickList.Text == "")
         {
             MsgBox.Show(this, "List cannot be blank.");
             return;
         }
         FieldDef.PickList = textPickList.Text;
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #2
0
 ///<summary>When using Arizona Primary Care, there must be a handful of pre-defined patient fields which are required  to generate the Arizona Primary Care reports. This function will return true if all of the required patient fields exist which are necessary to run the Arizona Primary Care reports. Otherwise, false is returned.</summary>
 public static bool UsingArizonaPrimaryCare()
 {
     PatFieldDefs.RefreshCache();
     string[] patientFieldNames = new string[] {
         "SPID#",
         "Eligibility Status",
         "Household Gross Income",
         "Household % of Poverty",
     };
     int[] fieldCounts = new int[patientFieldNames.Length];
     foreach (PatFieldDef pfd in PatFieldDefs.List)
     {
         for (int i = 0; i < patientFieldNames.Length; i++)
         {
             if (pfd.FieldName.ToLower() == patientFieldNames[i].ToLower())
             {
                 fieldCounts[i]++;
                 break;
             }
         }
     }
     for (int i = 0; i < fieldCounts.Length; i++)
     {
         //Each field must be defined exactly once. This verifies that each requied field
         //both exists and is not ambiguous with another field of the same name.
         if (fieldCounts[i] != 1)
         {
             return(false);
         }
     }
     return(true);
 }
Beispiel #3
0
 private void FormPatFieldDefs_Load(object sender, System.EventArgs e)
 {
     _listPatFieldDefs           = PatFieldDefs.GetDeepCopy();
     _listPatFieldDefsOld        = _listPatFieldDefs.Select(x => x.Copy()).ToList();
     checkDisplayRenamed.Checked = PrefC.GetBool(PrefName.DisplayRenamedPatFields);
     FillGrid();
 }
Beispiel #4
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (OldFieldName != textName.Text)
     {
         for (int i = 0; i < PatFieldDefs.List.Length; i++)
         {
             if (PatFieldDefs.List[i].FieldName == textName.Text)
             {
                 MsgBox.Show(this, "Field name currently being used.");
                 return;
             }
         }
     }
     FieldDef.FieldName = textName.Text;
     FieldDef.FieldType = (PatFieldType)comboFieldType.SelectedIndex;
     if (FieldDef.FieldType == PatFieldType.PickList)
     {
         if (textPickList.Text == "")
         {
             MsgBox.Show(this, "List cannot be blank.");
             return;
         }
         FieldDef.PickList = textPickList.Text;
     }
     if (IsNew)
     {
         PatFieldDefs.Insert(FieldDef);
     }
     else
     {
         PatFieldDefs.Update(FieldDef, OldFieldName);
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #5
0
        ///<summary>Adds the passed in pat fields to the grid. Adds any fields that have been renamed at the end of the grid if the preference is
        ///enabled. The tag on the row will be the PatFieldDef or the PatField if the PatFieldDef has been renamed.</summary>
        public static void AddPatFieldsToGrid(ODGrid grid, List <PatField> listPatFields, FieldLocations fieldLocation,
                                              List <FieldDefLink> listFieldDefLinks = null)
        {
            List <PatFieldDef> listPatFieldDefs = PatFieldDefs.GetDeepCopy(true);

            listFieldDefLinks = listFieldDefLinks ?? FieldDefLinks.GetForLocation(fieldLocation)
                                .FindAll(x => x.FieldDefType == FieldDefTypes.Patient);
            //Add a row for each existing PatFieldDef
            foreach (PatFieldDef patFieldDef in listPatFieldDefs)
            {
                if (listFieldDefLinks.Exists(x => x.FieldDefNum == patFieldDef.PatFieldDefNum))
                {
                    continue;
                }
                ODGridRow row   = new ODGridRow();
                PatField  field = listPatFields.FirstOrDefault(x => x.FieldName == patFieldDef.FieldName);
                if (patFieldDef.FieldType.ToString() == "InCaseOfEmergency")
                {
                    //Deprecated. Should never happen.
                    continue;
                }
                row.Cells.Add(patFieldDef.FieldName);
                if (field == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    if (patFieldDef.FieldType == PatFieldType.Checkbox)
                    {
                        row.Cells.Add("X");
                    }
                    else if (patFieldDef.FieldType == PatFieldType.Currency)
                    {
                        row.Cells.Add(PIn.Double(field.FieldValue).ToString("c"));
                    }
                    else
                    {
                        row.Cells.Add(field.FieldValue);
                    }
                }
                row.Tag = patFieldDef;
                grid.Rows.Add(row);
            }
            if (!PrefC.GetBool(PrefName.DisplayRenamedPatFields))
            {
                return;
            }
            //Now loop through the PatFields that do not have a matching PatFieldDef.
            foreach (PatField patField in listPatFields.Where(x => !listPatFieldDefs.Any(y => y.FieldName == x.FieldName)))
            {
                ODGridRow row = new ODGridRow();
                row.Cells.Add(patField.FieldName);
                row.Cells.Add(patField.FieldValue);
                row.Tag       = patField;
                row.ColorText = Color.DarkSlateGray;
                grid.Rows.Add(row);
            }
        }
Beispiel #6
0
 private void FillGrid()
 {
     PatFieldDefs.RefreshCache();
     listMain.Items.Clear();
     for (int i = 0; i < PatFieldDefs.List.Length; i++)
     {
         listMain.Items.Add(PatFieldDefs.List[i].FieldName);
     }
 }
 private void butOK_Click(object sender, System.EventArgs e)
 {
     FieldDef.FieldName = textName.Text;
     if (IsNew)
     {
         PatFieldDefs.Insert(FieldDef);
     }
     else
     {
         PatFieldDefs.Update(FieldDef, OldFieldName);
     }
     DialogResult = DialogResult.OK;
 }
 private void FormPatFieldDefs_Load(object sender, System.EventArgs e)
 {
     _listPatFieldDefs           = PatFieldDefs.GetDeepCopy();
     checkDisplayRenamed.Checked = PrefC.GetBool(PrefName.DisplayRenamedPatFields);
     if (_isSelectionMode)
     {
         _listPatFieldDefs = _listPatFieldDefs.FindAll(x => !x.IsHidden);
         butAdd.Visible    = false;
         butUp.Visible     = false;
         butDown.Visible   = false;
     }
     _listPatFieldDefsOld = _listPatFieldDefs.Select(x => x.Copy()).ToList();
     FillGrid();
 }
Beispiel #9
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     try{
         PatFieldDefs.Delete(FieldDef);
         DialogResult = DialogResult.OK;
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
     }
 }
        private void FormPatFieldPickEdit_Load(object sender, System.EventArgs e)
        {
            labelName.Text = _fieldCur.FieldName;
            string value = "";

            value = PatFieldDefs.GetPickListByFieldName(_fieldCur.FieldName);
            string[] valueArray = value.Split(new string[] { "\r\n" }, StringSplitOptions.None);
            foreach (string s in valueArray)
            {
                listBoxPick.Items.Add(s);
            }
            if (!IsNew)
            {
                listBoxPick.SelectedItem = _fieldCur.FieldValue;
            }
        }
Beispiel #11
0
        private void FillGridPat()
        {
            gridPat.BeginUpdate();
            gridPat.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("Field", 150);
            gridPat.Columns.Add(col);
            col = new ODGridColumn("Value", 200);
            gridPat.Columns.Add(col);
            gridPat.Rows.Clear();
            _arrayPatientFields = PatFields.Refresh(_patCur.PatNum);
            PatFieldDefs.RefreshCache();
            PatFieldL.AddPatFieldsToGrid(gridPat, _arrayPatientFields.ToList(), FieldLocations.OrthoChart);
            gridPat.EndUpdate();
        }
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     try{
         PatFieldDefs.Delete(FieldDef);                                                      //Throws if in use.
         FieldDefLinks.DeleteForFieldDefNum(FieldDef.PatFieldDefNum, FieldDefTypes.Patient); //Delete any FieldDefLinks to this PatFieldDef
         FieldDef     = null;
         DialogResult = DialogResult.OK;
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #13
0
 private void FormFieldDefLink_Load(object sender, EventArgs e)
 {
     string[] arrayFieldLocations = Enum.GetNames(typeof(FieldLocations));
     for (int i = 0; i < arrayFieldLocations.Length; i++)
     {
         comboFieldLocation.Items.Add(Lan.g("enumFieldLocations", arrayFieldLocations[i]));
         if (i == (int)_fieldLocation)
         {
             comboFieldLocation.SelectedIndex = i;
         }
     }
     _listFieldDefLinks = FieldDefLinks.GetAll();
     _listApptFieldDefs = ApptFieldDefs.GetDeepCopy();
     _listPatFieldDefs  = PatFieldDefs.GetDeepCopy(true);
     FillGridDisplayed();
     FillGridHidden();
 }
Beispiel #14
0
 private void FormPatFieldDefs_FormClosing(object sender, FormClosingEventArgs e)
 {
     //Fix the item order just in case there was a duplicate.
     for (int i = 0; i < _listPatFieldDefs.Count; i++)
     {
         if (_listPatFieldDefs[i].ItemOrder != i)
         {
             _hasChanged = true;
         }
         _listPatFieldDefs[i].ItemOrder = i;
     }
     if (_hasChanged)
     {
         PatFieldDefs.Sync(_listPatFieldDefs, _listPatFieldDefsOld);               //Update if anything has changed
         DataValid.SetInvalid(InvalidType.PatFields);
     }
 }
Beispiel #15
0
        private void FillGridPat()
        {
            gridPat.BeginUpdate();
            gridPat.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("Field", 150);
            gridPat.Columns.Add(col);
            col = new ODGridColumn("Value", 200);
            gridPat.Columns.Add(col);
            gridPat.Rows.Clear();
            listPatientFields = PatFields.Refresh(PatCur.PatNum);
            PatFieldDefs.RefreshCache();
            ODGridRow row;

            //define and fill rows in grid at the same time.
            for (int i = 0; i < PatFieldDefs.List.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(PatFieldDefs.List[i].FieldName);
                for (int j = 0; j <= listPatientFields.Length; j++)
                {
                    if (j == listPatientFields.Length)                   //no matches in the list
                    {
                        row.Cells.Add("");
                        break;
                    }
                    if (listPatientFields[j].FieldName == PatFieldDefs.List[i].FieldName)
                    {
                        if (PatFieldDefs.List[i].FieldType == PatFieldType.Checkbox)
                        {
                            row.Cells.Add("X");
                        }
                        else
                        {
                            row.Cells.Add(listPatientFields[j].FieldValue);
                        }
                        break;
                    }
                }
                gridPat.Rows.Add(row);
            }
            gridPat.EndUpdate();
        }