///<summary>Changes the SubstOnlyIf after the user selects a new SubstitutionCondition.
        ///If the user modifies a procedure level substitution code, a new SubstitutionLink will be added for the inplan(override).
        ///The new SubstitutionLink will be added to _listDbSubstLinks</summary>
        private void gridMain_CellSelectionCommitted(object sender, ODGridClickEventArgs e)
        {
            if (e.Col != 2 || e.Row < 0 || e.Row >= gridMain.ListGridRows.Count)       //Return if not SubstOnlyIf column or invalid row
            {
                return;
            }
            //Get the grid tag
            ProcedureCode procCode = gridMain.ListGridRows[e.Row].Tag as ProcedureCode;

            if (procCode == null)
            {
                return;
            }
            //Get the selected substitution condition.
            SubstitutionCondition selectedCondition = (SubstitutionCondition)_listSubConditions.IndexOf(gridMain.ListGridRows[e.Row].Cells[e.Col].Text);
            //Get the SubstitutionLink if one exist
            SubstitutionLink subLink = _listSubstLinks.FirstOrDefault(x => x.CodeNum == procCode.CodeNum);

            if (subLink != null)           //Ins level sub code
            {
                subLink.SubstOnlyIf = selectedCondition;
            }
            else              //procedure code level substitution code
                              //Changing the SubstitutionCondition will not update the procedure code level SubstitutionCondition. We will create an insplan override.
                              //Create a new SubstitutionLink for ins plan override for this proccode.
            {
                subLink         = new SubstitutionLink();
                subLink.CodeNum = procCode.CodeNum;
                //SubstitutionCode will be the same as the procedure codes SubstitutionCode since all the user changed was the SubstitutionCondition
                subLink.SubstitutionCode = procCode.SubstitutionCode;
                subLink.PlanNum          = _insPlan.PlanNum;
                subLink.SubstOnlyIf      = selectedCondition;
                _listSubstLinks.Add(subLink);
            }
            FillGridMain();
        }
Пример #2
0
        public static SubstitutionLink CreateSubstitutionLink(long codeNum, string subCode, SubstitutionCondition substOnlyIf, long planNum)
        {
            SubstitutionLink subLink = new SubstitutionLink();

            subLink.CodeNum          = codeNum;
            subLink.SubstitutionCode = subCode;
            subLink.SubstOnlyIf      = substOnlyIf;
            subLink.PlanNum          = planNum;
            SubstitutionLinks.Insert(subLink);
            return(subLink);
        }