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);
        }
Exemple #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();
        }
Exemple #3
0
 private void butAdd_Click(object sender, System.EventArgs e)
 {
     DiseaseDef def=new DiseaseDef();
     def.ItemOrder=DiseaseDefs.ListLong.Length;
     FormDiseaseDefEdit FormD=new FormDiseaseDefEdit(def);
     FormD.IsNew=true;
     FormD.ShowDialog();
     FillGrid();
 }
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            DiseaseDef def = new DiseaseDef();

            def.ItemOrder = DiseaseDefs.ListLong.Length;
            FormDiseaseDefEdit FormD = new FormDiseaseDefEdit(def);

            FormD.IsNew = true;
            FormD.ShowDialog();
            FillGrid();
        }
Exemple #5
0
 ///<summary>If IsSelectionMode, doubleclicking closes the form and returns the selected diseasedef.
 ///If !IsSelectionMode, doubleclicking opens FormDiseaseDefEdit and allows the user to edit or delete the selected diseasedef.
 ///Either way, validation always occurs first.</summary>
 private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
 {
     #region Validation
     if (!IsSelectionMode && !Security.IsAuthorized(Permissions.ProblemEdit))             //trying to double click to edit, but no permission.
     {
         return;
     }
     if (gridMain.SelectedIndices.Length == 0)
     {
         return;
     }
     #endregion
     DiseaseDef selectedDiseaseDef = (DiseaseDef)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag;
     #region Selection Mode. Close the Form
     if (IsSelectionMode)             //selection mode.
     {
         if (!IsMultiSelect && Snomeds.GetByCode(selectedDiseaseDef.SnomedCode) == null)
         {
             MsgBox.Show(this, "You have selected a problem with an unofficial SNOMED CT code.  Please correct the problem definition by going to "
                         + "Lists | Problems and choosing an official code from the SNOMED CT list.");
             return;
         }
         DialogResult = DialogResult.OK;              //FormClosing takes care of filling ListSelectedDiseaseDefs.
         return;
     }
     #endregion
     #region Not Selection Mode. Open FormDiseaseDefEdit
     //not selection mode. double-click to edit.
     bool hasDelete = true;
     if (_listDiseaseDefsNumsNotDeletable.Contains(selectedDiseaseDef.DiseaseDefNum))
     {
         hasDelete = false;
     }
     //everything below this point is _not_ selection mode.  User guaranteed to have permission for ProblemEdit.
     FormDiseaseDefEdit FormD = new FormDiseaseDefEdit(selectedDiseaseDef, hasDelete);
     FormD.ShowDialog();
     //Security log entry made inside that form.
     if (FormD.DialogResult != DialogResult.OK)
     {
         return;
     }
     #endregion
     _listSecurityLogMsgs.Add(FormD.SecurityLogMsgText);
     if (FormD.DiseaseDefCur == null)           //User deleted the DiseaseDef.
     {
         _listDiseaseDefs.Remove(selectedDiseaseDef);
     }
     _isChanged = true;
     FillGrid();
 }
Exemple #6
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();
        }
        private void listMain_DoubleClick(object sender, System.EventArgs e)
        {
            if (listMain.SelectedIndex == -1)
            {
                return;
            }
            if (IsSelectionMode)
            {
                SelectedDiseaseDefNum = DiseaseDefs.ListLong[listMain.SelectedIndex].DiseaseDefNum;
                DialogResult          = DialogResult.OK;
                return;
            }
            FormDiseaseDefEdit FormD = new FormDiseaseDefEdit(DiseaseDefs.ListLong[listMain.SelectedIndex]);

            FormD.ShowDialog();
            if (FormD.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillGrid();
        }
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.ProblemEdit))
            {
                return;
            }
            DiseaseDef def = new DiseaseDef();

            def.ItemOrder = DiseaseDefs.ListLong.Length;
            FormDiseaseDefEdit FormD = new FormDiseaseDefEdit(def);

            FormD.IsNew = true;
            FormD.ShowDialog();
            //Security log entry made inside that form.
            if (FormD.DialogResult != DialogResult.OK)
            {
                return;
            }
            IsChanged = true;
            FillGrid();
        }
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            if (!IsSelectionMode && !Security.IsAuthorized(Permissions.ProblemEdit))             //trying to double click to edit, but no permission.
            {
                return;
            }
            if (gridMain.SelectedIndices.Length == 0)
            {
                return;
            }
            if (IsSelectionMode)
            {
                if (IsMultiSelect)
                {
                    SelectedDiseaseDefNums = new List <long>();
                    SelectedDiseaseDefNums.Add(DiseaseDefs.List[gridMain.GetSelectedIndex()].DiseaseDefNum);
                }
                else
                {
                    SelectedDiseaseDefNum = DiseaseDefs.List[gridMain.GetSelectedIndex()].DiseaseDefNum;
                }
                DialogResult = DialogResult.OK;
                return;
            }
            //everything below this point is _not_ selection mode.  User guaranteed to have permission for ProblemEdit.
            FormDiseaseDefEdit FormD = new FormDiseaseDefEdit(DiseaseDefs.ListLong[gridMain.GetSelectedIndex()]);

            FormD.ShowDialog();
            //Security log entry made inside that form.
            if (FormD.DialogResult != DialogResult.OK)
            {
                return;
            }
            IsChanged = true;
            FillGrid();
        }
		private void butAdd_Click(object sender,System.EventArgs e) {
			if(!Security.IsAuthorized(Permissions.ProblemEdit)) {
				return;
			}
			DiseaseDef def=new DiseaseDef();
			def.ItemOrder=DiseaseDefs.ListLong.Length;
			FormDiseaseDefEdit FormD=new FormDiseaseDefEdit(def);
			FormD.IsNew=true;
			FormD.ShowDialog();
			//Security log entry made inside that form.
			if(FormD.DialogResult!=DialogResult.OK) {
				return;
			}
			IsChanged=true;
			FillGrid();
		}
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			if(!IsSelectionMode && !Security.IsAuthorized(Permissions.ProblemEdit)) {//trying to double click to edit, but no permission.
				return;
			}
			if(gridMain.SelectedIndices.Length==0) {
				return;
			}
			if(IsSelectionMode) {
				if(IsMultiSelect) {
					SelectedDiseaseDefNums=new List<long>();
					SelectedDiseaseDefNums.Add(DiseaseDefs.List[gridMain.GetSelectedIndex()].DiseaseDefNum);
				}
				else {
					SelectedDiseaseDefNum=DiseaseDefs.List[gridMain.GetSelectedIndex()].DiseaseDefNum;
				}
				DialogResult=DialogResult.OK;
				return;
			}
			//everything below this point is _not_ selection mode.  User guaranteed to have permission for ProblemEdit.
			FormDiseaseDefEdit FormD=new FormDiseaseDefEdit(DiseaseDefs.ListLong[gridMain.GetSelectedIndex()]);
			FormD.ShowDialog();
			//Security log entry made inside that form.
			if(FormD.DialogResult!=DialogResult.OK) {
				return;
			}
			IsChanged=true;
			FillGrid();
		}
Exemple #12
0
 private void listMain_DoubleClick(object sender, System.EventArgs e)
 {
     if(listMain.SelectedIndex==-1){
         return;
     }
     if(IsSelectionMode){
         SelectedDiseaseDefNum=DiseaseDefs.ListLong[listMain.SelectedIndex].DiseaseDefNum;
         DialogResult=DialogResult.OK;
         return;
     }
     FormDiseaseDefEdit FormD=new FormDiseaseDefEdit(DiseaseDefs.ListLong[listMain.SelectedIndex]);
     FormD.ShowDialog();
     if(FormD.DialogResult!=DialogResult.OK) {
         return;
     }
     FillGrid();
 }
Exemple #13
0
		private void butAdd_Click(object sender,System.EventArgs e) {
			if(!Security.IsAuthorized(Permissions.ProblemEdit)) {
				return;
			}
			DiseaseDef def=new DiseaseDef();
			def.ItemOrder=_listDiseaseDefs.Count;
			FormDiseaseDefEdit FormD=new FormDiseaseDefEdit(def);//also sets ItemOrder correctly if using alphabetical during the insert diseaseDef call.
			FormD.IsNew=true;
			FormD.ShowDialog();
			//Security log entry made inside that form.
			if(FormD.DialogResult!=DialogResult.OK) {
				return;
			}
			//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
			for(int i=0;i<_listDiseaseDefs.Count;i++) {
				if(_listDiseaseDefs[i].ItemOrder>=def.ItemOrder) {
					_listDiseaseDefs[i].ItemOrder++;
				}
			}
			_listDiseaseDefs.Add(def);
			_listDiseaseDefs.Sort(DiseaseDefs.SortItemOrder);
			//RefreshList();
			IsChanged=true;
			FillGrid();
		}
Exemple #14
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			if(!IsSelectionMode && !Security.IsAuthorized(Permissions.ProblemEdit)) {//trying to double click to edit, but no permission.
				return;
			}
			if(gridMain.SelectedIndices.Length==0) {
				return;
			}
			if(IsSelectionMode) {
				if(IsMultiSelect) {
					SelectedDiseaseDefNums=new List<long>();
					SelectedDiseaseDefNums.Add(DiseaseDefs.List[gridMain.GetSelectedIndex()].DiseaseDefNum);
				}
				else {
					if(Snomeds.GetByCode(DiseaseDefs.List[gridMain.GetSelectedIndex()].SnomedCode)!=null) {
						SelectedDiseaseDefNum=DiseaseDefs.List[gridMain.GetSelectedIndex()].DiseaseDefNum;
					}
					else {
						MsgBox.Show(this,"You have selected a problem with an unofficial SNOMED CT code.  Please correct the problem definition by going to Lists | Problems and choosing an official code from the SNOMED CT list.");
						return;
					}
				}
				DialogResult=DialogResult.OK;
				return;
			}
			//everything below this point is _not_ selection mode.  User guaranteed to have permission for ProblemEdit.
			FormDiseaseDefEdit FormD=new FormDiseaseDefEdit(_listDiseaseDefs[gridMain.GetSelectedIndex()]);
			FormD.ShowDialog();
			//Security log entry made inside that form.
			if(FormD.DialogResult!=DialogResult.OK) {
				return;
			}
			if(FormD.DiseaseDefCur==null) {//User deleted the DiseaseDef.
				_listDiseaseDefs.RemoveAt(gridMain.GetSelectedIndex());
			}
			//RefreshList();
			IsChanged=true;
			FillGrid();
		}