private void AddProblem(SheetFieldDef SheetFieldDefCur)
        {
            if (!Security.IsAuthorized(Permissions.ProblemEdit))
            {
                return;
            }
            DiseaseDef def = new DiseaseDef()
            {
                ICD9Code    = "",
                Icd10Code   = "",
                SnomedCode  = "",
                ItemOrder   = DiseaseDefs.GetCount(),
                DiseaseName = SheetFieldDefCur?.FieldName.Replace("problem:", "") ?? ""
            };
            FormDiseaseDefEdit formDDE = new FormDiseaseDefEdit(def, false);

            formDDE.IsNew = true;
            formDDE.ShowDialog();
            if (formDDE.DialogResult != DialogResult.OK)
            {
                return;
            }
            DiseaseDefs.Insert(formDDE.DiseaseDefCur);
            DataValid.SetInvalid(InvalidType.Diseases);
            _listDiseaseDefs = DiseaseDefs.GetDeepCopy(true);
            SecurityLogs.MakeLogEntry(Permissions.ProblemEdit, 0, formDDE.SecurityLogMsgText);
            FillListMedical(MedicalListType.problem);
        }
Example #2
0
        ///<summary>Adds a new disease. New diseases get blank (not null) fields for ICD9, ICD10, and SnoMedCodes
        ///if they are not specified from FormDiseaseDefEdit so that we can do string searches on them.</summary>
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.ProblemEdit))
            {
                return;
            }
            //initialise the new DiseaseDef with blank fields instead of null so we can filter on them.
            DiseaseDef def = new DiseaseDef()
            {
                ICD9Code   = "",
                Icd10Code  = "",
                SnomedCode = "",
                ItemOrder  = DiseaseDefs.GetCount()
            };
            FormDiseaseDefEdit FormD = new FormDiseaseDefEdit(def, true);         //also sets ItemOrder correctly if using alphabetical during the insert diseaseDef call.

            FormD.IsNew = true;
            FormD.ShowDialog();
            if (FormD.DialogResult != DialogResult.OK)
            {
                return;
            }
            _listSecurityLogMsgs.Add(FormD.SecurityLogMsgText);
            //Need to invalidate cache for selection mode so that the new problem shows up.
            if (IsSelectionMode)
            {
                DataValid.SetInvalid(InvalidType.Diseases);
            }
            //Items are already in the right order in the DB, re-order in memory list to match
            _listDiseaseDefs.FindAll(x => x.ItemOrder >= def.ItemOrder).ForEach(x => x.ItemOrder++);
            _listDiseaseDefs.Add(def);
            _listDiseaseDefs.Sort(DiseaseDefs.SortItemOrder);
            IsChanged = true;
            FillGrid();
        }
Example #3
0
        ///<summary>Adds a new disease. New diseases get blank (not null) fields for ICD9, ICD10, and SnoMedCodes
        ///if they are not specified from FormDiseaseDefEdit so that we can do string searches on them.</summary>
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.ProblemEdit))
            {
                return;
            }
            //initialise the new DiseaseDef with blank fields instead of null so we can filter on them.
            DiseaseDef def = new DiseaseDef()
            {
                ICD9Code   = "",
                Icd10Code  = "",
                SnomedCode = "",
                ItemOrder  = DiseaseDefs.GetCount()
            };
            FormDiseaseDefEdit FormD = new FormDiseaseDefEdit(def, true);         //also sets ItemOrder correctly if using alphabetical during the insert diseaseDef call.

            FormD.IsNew = true;
            FormD.ShowDialog();
            if (FormD.DialogResult != DialogResult.OK)
            {
                return;
            }
            _listSecurityLogMsgs.Add(FormD.SecurityLogMsgText);
            //Need to invalidate cache for selection mode so that the new problem shows up.
            if (IsSelectionMode)
            {
                //In Middle Tier, the Sync in FormClosing() was not updating the PKs for the objects in each row tag for gridMain.
                //This was the assumption of what would happen to retain selection when going back to the calling form (ex. FormMedical).
                //As a result, any new defs added here did not have a PK when being sent to the calling form via grid.SelectedTags and threw a UE.
                DiseaseDefs.Insert(FormD.DiseaseDefCur);
                DataValid.SetInvalid(InvalidType.Diseases);
                //No need to re-order as the ItemOrder given is already at the end of the list, and you can't change item order in selection mode.
                _listDiseaseDefsOld.Add(FormD.DiseaseDefCur);
                _listDiseaseDefs.Add(FormD.DiseaseDefCur);
                //Sync on FormClosing() will not happen; we don't need it since Adding a new DiseaseDef is the only change user can make in SelectionMode.
            }
            else
            {
                //Items are already in the right order in the DB, re-order in memory list to match
                _listDiseaseDefs.FindAll(x => x.ItemOrder >= def.ItemOrder).ForEach(x => x.ItemOrder++);
                _listDiseaseDefs.Add(def);
                _listDiseaseDefs.Sort(DiseaseDefs.SortItemOrder);
                _isChanged = true;
            }
            FillGrid();
        }