///<summary>Returns operatories that are associated to a WebSchedNewPatApptTypes definition.</summary> public static List<Operatory> GetOpsForWebSchedNewPatAppts(bool isShort=true) { //No need to check RemotingRole; no call to db. //Get all of the deflinks that are of type Operatory in order to get the operatory specific FKeys. List<long> listOperatoryNums=DefLinks.GetDefLinksForWebSchedNewPatApptOperatories() .Select(x => x.FKey) .Distinct() .ToList(); return GetWhere(x => listOperatoryNums.Contains(x.OperatoryNum),isShort); }
///<summary>Returns operatories that are associated to the WebSchedNewPatApptTypes definition passed in.</summary> public static List<Operatory> GetOpsForWebSchedNewPatApptDef(long defNum,bool isShort=true) { //No need to check RemotingRole; no call to db. List<long> listOperatoryNums=DefLinks.GetDefLinksForWebSchedNewPatApptOperatories() .Where(x => x.DefNum==defNum) .Select(x => x.FKey) .Distinct() .ToList(); return GetWhere(x => listOperatoryNums.Contains(x.OperatoryNum),isShort); }
///<summary>Inserts, updates, or deletes database rows to match supplied list. ///Also syncs each operatory's deflink entries if the operatory.ListWSNPAOperatoryDefNums is not null.</summary> public static void Sync(List<Operatory> listNew,List<Operatory> listOld) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),listNew,listOld);//never pass DB list through the web service return; } Crud.OperatoryCrud.Sync(listNew,listOld); //Regardless if changes were made during the sync, we need to make sure to sync the DefLinks for WSNPA appointment types. //This needs to happen after the sync call so that the PKs have been correctly set for listNew. List<DefLink> listDefLinksAll=DefLinks.GetDefLinksForWebSchedNewPatApptOperatories(); foreach(Operatory operatory in listNew) { DefLinks.SyncWebSchedNewPatApptOpLinks(operatory,listDefLinksAll); } //Delete any deflinks for operatories that are present within listOld but are not present within listNew. List<long> listDeleteOpNums=listOld.Where(x => !listNew.Any(y => y.OperatoryNum==x.OperatoryNum)) .Select(x => x.OperatoryNum) .Distinct() .ToList(); DefLinks.DeleteAllForFKeys(listDeleteOpNums,DefLinkType.Operatory); }