Ejemplo n.º 1
0
            protected override List <Operatory> TableToList(DataTable table)
            {
                List <Operatory> listOps = Crud.OperatoryCrud.TableToList(table);

                //The IsInHQView flag is not important enough to cause filling the cache to fail.
                ODException.SwallowAnyException(() => {
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        listOps[i].IsInHQView = PIn.Bool(table.Rows[i]["IsInHQView"].ToString());
                    }
                });
                //WSNPA operatory defs are important enough that we want this portion to fail if it has problems.
                //Create a dictionary comprised of Key: OperatoryNum and value: List of definition DefNums.
                Dictionary <long, List <long> > dictWSNPAOperatoryDefNums = DefLinks.GetDefLinksByType(DefLinkType.Operatory)
                                                                            .GroupBy(x => x.FKey)//FKey for DefLinkType.Operatory is OperatoryNum
                                                                            .ToDictionary(x => x.Key, x => x.Select(y => y.DefNum).ToList());

                foreach (long operatoryNum in dictWSNPAOperatoryDefNums.Keys)
                {
                    Operatory op = listOps.FirstOrDefault(x => x.OperatoryNum == operatoryNum);
                    if (op != null)
                    {
                        op.ListWSNPAOperatoryDefNums = dictWSNPAOperatoryDefNums[operatoryNum];
                    }
                }
                return(listOps);
            }
Ejemplo n.º 2
0
        ///<summary>Returns definitions that are associated to the defCat, fKey, and defLinkType passed in.</summary>
        public static List <Def> GetDefsByDefLinkFKey(DefCat defCat, long fKey, DefLinkType defLinkType)
        {
            //No need to check RemotingRole; no call to db.
            List <DefLink> listDefLinks = DefLinks.GetDefLinksByType(defLinkType).FindAll(x => x.FKey == fKey);

            return(Defs.GetDefs(defCat, listDefLinks.Select(x => x.DefNum).Distinct().ToList()));
        }
Ejemplo n.º 3
0
		///<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);
		}
Ejemplo n.º 4
0
		///<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);
		}
Ejemplo n.º 5
0
        ///<summary>Gets list of all appointment type specific DefLinks associated to the WebSchedNewPatApptTypes definition category.</summary>
        public static List <DefLink> GetDefLinksForWebSchedNewPatApptApptTypes()
        {
            //No need to check RemotingRole; no call to db.
            //Get all definitions that are associated to the WebSchedNewPatApptTypes category that are linked to an operatory.
            List <Def> listWSNPAATDefs = Defs.GetDefsForCategory(DefCat.WebSchedNewPatApptTypes);         //Cannot hide defs of this category at this time.

            //Return all of the deflinks that are of type Operatory in order to get the operatory specific deflinks.
            return(DefLinks.GetDefLinksByTypeAndDefs(DefLinkType.AppointmentType, listWSNPAATDefs.Select(x => x.DefNum).ToList()));
        }
Ejemplo n.º 6
0
        ///<summary>Returns the appointment type associated to the definition passed in.  Returns null if no match found.</summary>
        public static AppointmentType GetWebSchedNewPatApptTypeByDef(long defNum)
        {
            //No need to check RemotingRole; no call to db.
            List <DefLink> listDefLinks = DefLinks.GetDefLinksByType(DefLinkType.AppointmentType);
            DefLink        defLink      = listDefLinks.FirstOrDefault(x => x.DefNum == defNum);

            if (defLink == null)
            {
                return(null);
            }
            return(AppointmentTypes.GetFirstOrDefault(x => x.AppointmentTypeNum == defLink.FKey, true));
        }
Ejemplo n.º 7
0
		///<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);
		}
Ejemplo n.º 8
0
            protected override List <Clinic> GetCacheFromDb()
            {
                string command = "SELECT * FROM clinic ";

                if (PrefC.GetBool(PrefName.ClinicListIsAlphabetical))
                {
                    command += "ORDER BY Abbr";
                }
                else
                {
                    command += "ORDER BY ItemOrder";
                }
                List <Clinic> retval = Crud.ClinicCrud.SelectMany(command);
                Dictionary <long, List <DefLink> > dictClinSpecialties = DefLinks.GetDefLinksByType(DefLinkType.Clinic)
                                                                         .GroupBy(x => x.FKey)
                                                                         .ToDictionary(x => x.Key, x => x.ToList());
                List <DefLink> listLinks;

                retval.ForEach(x => x.ListClinicSpecialtyDefLinks = (dictClinSpecialties.TryGetValue(x.ClinicNum, out listLinks)?listLinks:new List <DefLink>()));
                return(retval);
            }