예제 #1
0
        ///<summary>Will not create a group if there are less than 2 items in listProcs.  Also sends signal and refreshes cache.</summary>
        public static void CreateGroup(List <Procedure> listProcs)
        {
            //No need to check RemotingRole; no call to db.
            if (listProcs.Count < 2)           //No reason to make a "group" with 0 or 1 items.
            {
                return;
            }
            List <ProcMultiVisit> listPmvs = new List <ProcMultiVisit>();

            for (int i = 0; i < listProcs.Count; i++)
            {
                ProcMultiVisit pmv = new ProcMultiVisit();
                pmv.ProcNum    = listProcs[i].ProcNum;
                pmv.ProcStatus = listProcs[i].ProcStatus;
                listPmvs.Add(pmv);
            }
            bool isGroupInProcess       = ProcMultiVisits.IsGroupInProcess(listPmvs);    //Could be in process if grouped procs which are different statuses via menu.
            long groupProcMultiVisitNum = 0;

            for (int i = 0; i < listPmvs.Count; i++)
            {
                ProcMultiVisit pmv = listPmvs[i];
                pmv.IsInProcess = isGroupInProcess;
                if (i == 0)
                {
                    groupProcMultiVisitNum = ProcMultiVisits.Insert(pmv);
                    ProcMultiVisit oldPmv = pmv.Copy();
                    pmv.GroupProcMultiVisitNum = groupProcMultiVisitNum;
                    ProcMultiVisits.Update(pmv, oldPmv);                   //Have to update after insert, or else we cannot know what the primary key is.
                }
                else
                {
                    pmv.GroupProcMultiVisitNum = groupProcMultiVisitNum;
                    ProcMultiVisits.Insert(pmv);
                }
            }
            Signalods.SetInvalid(InvalidType.ProcMultiVisits);
            RefreshCache();
        }
예제 #2
0
 protected override void FillCacheIfNeeded()
 {
     ProcMultiVisits.GetTableFromCache(false);
 }