///<summary>Returns the SheetTypeEnum & Sheet Def defaults for a clinic, if clinics is not on/or user is altering HQ settings ///it will instead return user defaults, if neither is present then it will return the pratice default.</summary> public static Dictionary <SheetTypeEnum, SheetDef> GetDefaultSheetDefs(long clinicNum = 0, params SheetTypeEnum[] arrSheetTypes) { //No need to check RemotingRole; no call to db. Dictionary <SheetTypeEnum, SheetDef> retVal = new Dictionary <SheetTypeEnum, SheetDef>(); foreach (SheetTypeEnum sheetTypeEnum in arrSheetTypes) { SheetDef defaultSheetDef = GetSheetDef(PrefC.GetDefaultSheetDefNum(sheetTypeEnum), false); if (clinicNum == 0) { if (defaultSheetDef == null) { defaultSheetDef = SheetsInternal.GetSheetDef(sheetTypeEnum); } retVal.Add(sheetTypeEnum, defaultSheetDef); } else { ClinicPref clinicPrefCur = ClinicPrefs.GetPref(Prefs.GetSheetDefPref(sheetTypeEnum), clinicNum); defaultSheetDef = SheetsInternal.GetSheetDef(sheetTypeEnum); if (clinicPrefCur != null && PIn.Long(clinicPrefCur.ValueString) != 0) //If ValueString is 0 then we want to keep it as the internal sheet def. { defaultSheetDef = GetSheetDef(PIn.Long(clinicPrefCur.ValueString), false); } if (clinicPrefCur != null) //If there was a row in the clinicpref table, add whatever the sheetdef was to the retval dictionary. { retVal.Add(sheetTypeEnum, defaultSheetDef); } } } return(retVal); }
///<summary>Passing in a clinicNum of 0 will use the base default sheet def. Otherwise returns the clinic specific default sheetdef.</summary> public static SheetDef GetSheetsDefault(SheetTypeEnum sheetType, long clinicNum = 0) { //No need to check RemotingRole; no call to db. ClinicPref clinicPrefCur = ClinicPrefs.GetPref(Prefs.GetSheetDefPref(sheetType), clinicNum); SheetDef defaultSheetDef; if (clinicPrefCur == null) //If there wasn't a row for the specific clinic, use the base default sheetdef { defaultSheetDef = GetSheetDef(PrefC.GetDefaultSheetDefNum(sheetType), false); if (defaultSheetDef == null) { defaultSheetDef = SheetsInternal.GetSheetDef(sheetType); } return(defaultSheetDef); //Return the base default sheetdef } //Clinic specific sheet def found if (PIn.Long(clinicPrefCur.ValueString) == 0) //If ValueString is 0 then we want to keep it as the internal sheet def. { defaultSheetDef = SheetsInternal.GetSheetDef(sheetType); } else { defaultSheetDef = GetSheetDef(PIn.Long(clinicPrefCur.ValueString), false); } return(defaultSheetDef); }
public static Dictionary <SheetTypeEnum, SheetDef> GetDefaultSheetDefsForClinic(long clinicNum) { //No need to check RemotingRole; no call to db. Dictionary <SheetTypeEnum, SheetDef> retVal = new Dictionary <SheetTypeEnum, SheetDef>(); ClinicPref clinicPrefCur = ClinicPrefs.GetPref(Prefs.GetSheetDefPref(SheetTypeEnum.Rx), clinicNum); SheetDef defaultRxDef = SheetsInternal.GetSheetDef(SheetTypeEnum.Rx); if (clinicPrefCur != null && PIn.Long(clinicPrefCur.ValueString) != 0) //If ValueString is 0 then we want to keep it as the internal sheet def. { defaultRxDef = GetSheetDef(PIn.Long(clinicPrefCur.ValueString), false); } if (clinicPrefCur != null) //If there was a row in the clinicpref table, add whatever the sheetdef was to the retval dictionary. { retVal.Add(SheetTypeEnum.Rx, defaultRxDef); } return(retVal); }