/// <summary> /// Determines whether [is tariff exists] [the specified item code]. /// </summary> /// <param name="itemCode">The item code.</param> /// <param name="tariffBaseUnitCost">The tariff base unit cost.</param> /// <returns></returns> public static bool IsTariffExists(string itemCode, TariffBaseUnitCost tariffBaseUnitCost) { if (entities == null) { entities = new UmehlukoEntities1(); } return entities.Tariffs.Any(t => t.ItemCode == itemCode && t.TariffBaseUnitCostID == tariffBaseUnitCost.TariffBaseUnitCostID); }
/// <summary> /// Determines whether [is tariff exists] [the specified item code]. /// </summary> /// <param name="itemCode">The item code.</param> /// <param name="tariffBaseUnitCost">The tariff base unit cost.</param> /// <returns></returns> public static bool IsTariffExists(string itemCode, TariffBaseUnitCost tariffBaseUnitCost) { if (entities == null) { entities = new UmehlukoEntities1(); } return(entities.Tariffs.Any(t => t.ItemCode == itemCode && t.TariffBaseUnitCostID == tariffBaseUnitCost.TariffBaseUnitCostID)); }
/// <summary> /// Generates the insert script. /// </summary> /// <param name="tariffBaseUnitCost"> /// The tariff base unit cost. /// </param> /// <param name="fileItemCode"> /// The file item code. /// </param> /// <param name="fileDoctorRecommendedUnit"> /// The file doctor recommended unit. /// </param> /// <param name="newTariffNotLoadedPath"> /// The new tariff not loaded path. /// </param> /// <param name="doctorTariffData"> /// The doctor tariff data. /// </param> /// <param name="originalGazetteName"> /// Name of the original gazette. /// </param> /// <param name="dataAccessHelper"> /// The data access helper. /// </param> private static void GenerateInsertScript( TariffBaseUnitCost tariffBaseUnitCost, string fileItemCode, decimal fileDoctorRecommendedUnit, string newTariffNotLoadedPath, Tariff doctorTariffData, string originalGazetteName, TariffsDataAccessHelper dataAccessHelper) { var databaseName = tariffBaseUnitCost.Name; var pathologyGPValues = ConfigurationManager.AppSettings[Constant.PathologyGPConfigKey]; var pathologySpecialistValues = ConfigurationManager.AppSettings[Constant.PathologySpecialistConfigKey]; var clinicalProceduresGPValues = ConfigurationManager.AppSettings[Constant.ClinicalProcedureGPConfigKey]; var clinicalProceduresSpecialistValues = ConfigurationManager.AppSettings[Constant.ClinicalProcedureSpecialistConfigKey]; var radiologyGpValues = ConfigurationManager.AppSettings[Constant.RadiologyGPConfigKey]; var radiologySpecialistValues = ConfigurationManager.AppSettings[Constant.RadiologySpecialistConfigKey]; if (databaseName.Contains(Constant.Pathology, StringComparison.InvariantCultureIgnoreCase)) { InsertNewTariffScript( pathologyGPValues, fileItemCode, fileDoctorRecommendedUnit, tariffBaseUnitCost, newTariffNotLoadedPath, dataAccessHelper); return; } if (databaseName.Contains(Constant.Radiology, StringComparison.InvariantCultureIgnoreCase)) { InsertNewTariffScript( radiologyGpValues, fileItemCode, fileDoctorRecommendedUnit, tariffBaseUnitCost, newTariffNotLoadedPath, dataAccessHelper); return; } newTariffNotLoadedPath.WriteToFile( string.Format("{0} - {1}", doctorTariffData.ItemCode, originalGazetteName)); }
/// <summary> /// Inserts the tariff record. /// </summary> /// <param name="dataAccessHelper"> /// The data access helper. /// </param> /// <param name="fileItemCode"> /// The file item code. /// </param> /// <param name="recommendedUnits"> /// The recommended units. /// </param> /// <param name="correctBaseUnitCost1"> /// The correct base unit cost1. /// </param> /// <param name="newTariffNotLoadedPath"> /// The new tariff not loaded path. /// </param> /// <param name="radiologySpecialistValues"> /// The radiology specialist values. /// </param> private static void InsertTariffRecord( TariffsDataAccessHelper dataAccessHelper, string fileItemCode, decimal recommendedUnits, TariffBaseUnitCost correctBaseUnitCost1, string newTariffNotLoadedPath, string radiologySpecialistValues) { if (recommendedUnits == 0) { return; } InsertNewTariffScript( radiologySpecialistValues, fileItemCode, recommendedUnits, correctBaseUnitCost1, newTariffNotLoadedPath, dataAccessHelper); }
/// <summary> /// Inserts the new tariff script. /// </summary> /// <param name="practitionerTypeIds"> /// The practitioner type ids. /// </param> /// <param name="fileItemCode"> /// The file item code. /// </param> /// <param name="fileDoctorRecommendedUnit"> /// The file doctor recommended unit. /// </param> /// <param name="tariffBaseUnitCost"> /// The tariff base unit cost. /// </param> /// <param name="newTariffNotLoadedPath"> /// The new tariff not loaded path. /// </param> /// <param name="dataAccessHelper"> /// The data access helper. /// </param> private static void InsertNewTariffScript( string practitionerTypeIds, string fileItemCode, decimal fileDoctorRecommendedUnit, TariffBaseUnitCost tariffBaseUnitCost, string newTariffNotLoadedPath, TariffsDataAccessHelper dataAccessHelper) { if (string.IsNullOrEmpty(practitionerTypeIds)) { return; } var pathologyPractitionerTypes = practitionerTypeIds.Split(','); var units = fileDoctorRecommendedUnit.ToString(CultureInfo.InvariantCulture).Replace(',', '.'); var section = dataAccessHelper.GetTariff(fileItemCode); /*DateTime? validFrom = tariffBaseUnitCost.ValidFrom; * var currentDateTime = DateTime.Now; * DateTime? validTo = tariffBaseUnitCost.ValidTo; * * if (validFrom != null && validFrom.Value.Year < currentDateTime.Year) * { * var financialEnd = FinancialYearHelper.GetFinancialYearEnd(validFrom.Value); * validTo = DateTime.Parse(financialEnd); * }*/ foreach (var practitionerTypeId in pathologyPractitionerTypes) { var sectionId = 0; if (section != null) { sectionId = section.SectionID; } var validfromDate = tariffBaseUnitCost.ValidFrom; var financialStart = string.Empty; var financialEnd = string.Empty; if (validfromDate.HasValue) { financialStart = FinancialYearHelper.GetFinancialYearStart(validfromDate.Value); financialEnd = FinancialYearHelper.GetFinancialYearEnd( DateTime.ParseExact(financialStart, Constant.DateFormat, null)); } var scriptLine = string.Format( "EXEC Medical.USP_MaintainMedicalTariff '{0}',{1},{2},{3},'{4}','{5}',{6},{7},{8},NULL,'{9}','{10}'", fileItemCode, Constant.CoidTariffTypeId, units, tariffBaseUnitCost.TariffBaseUnitCostID, financialStart, financialEnd, practitionerTypeId, Constant.VatConstId, sectionId, "Tariff Upload - Gazzette", DateTime.Now); newTariffNotLoadedPath.WriteToFile(scriptLine); } }
/// <summary> /// Inserts the tariff codes. /// </summary> /// <param name="dataAccessHelper"> /// The data access helper. /// </param> /// <param name="correctName"> /// Name of the correct. /// </param> /// <param name="fileItemCode"> /// The file item code. /// </param> /// <param name="fileDoctorRecommendedUnit"> /// The file doctor recommended unit. /// </param> /// <param name="fileSpecialistRecommendedUnit"> /// The file specialist recommended unit. /// </param> /// <param name="correctBaseUnitCost1"> /// The correct base unit cost1. /// </param> /// <param name="newTariffNotLoadedPath"> /// The new tariff not loaded path. /// </param> private static void InsertTariffCodes( TariffsDataAccessHelper dataAccessHelper, string correctName, string fileItemCode, decimal fileDoctorRecommendedUnit, decimal fileSpecialistRecommendedUnit, TariffBaseUnitCost correctBaseUnitCost1, string newTariffNotLoadedPath) { if (correctName.Contains(Constant.RadiationOncology, StringComparison.InvariantCultureIgnoreCase)) { var radiologySpecialistValues = ConfigurationManager.AppSettings[Constant.RadOncoSpecialistConfigKey]; InsertTariffRecord( dataAccessHelper, fileItemCode, fileSpecialistRecommendedUnit, correctBaseUnitCost1, newTariffNotLoadedPath, radiologySpecialistValues); return; } if (correctName.Contains(Constant.ClinicalProcedures, StringComparison.InvariantCultureIgnoreCase)) { var clinicalProcedures = ConfigurationManager.AppSettings[Constant.ClinicalProcedureGPConfigKey]; var clinicalProceduresSpecialist = ConfigurationManager.AppSettings[Constant.ClinicalProcedureSpecialistConfigKey]; InsertTariffRecord( dataAccessHelper, fileItemCode, fileDoctorRecommendedUnit, correctBaseUnitCost1, newTariffNotLoadedPath, clinicalProcedures); InsertTariffRecord( dataAccessHelper, fileItemCode, fileSpecialistRecommendedUnit, correctBaseUnitCost1, newTariffNotLoadedPath, clinicalProceduresSpecialist); return; } if (correctName.Contains(Constant.Radiology, StringComparison.InvariantCultureIgnoreCase)) { var radiologistDoctors = ConfigurationManager.AppSettings[Constant.RadiologyGPConfigKey]; var radiologistDoctorsSpecialist = ConfigurationManager.AppSettings[Constant.RadiologySpecialistConfigKey]; InsertTariffRecord( dataAccessHelper, fileItemCode, fileDoctorRecommendedUnit, correctBaseUnitCost1, newTariffNotLoadedPath, radiologistDoctors); InsertTariffRecord( dataAccessHelper, fileItemCode, fileSpecialistRecommendedUnit, correctBaseUnitCost1, newTariffNotLoadedPath, radiologistDoctorsSpecialist); return; } if (!correctName.Contains(Constant.Pathology, StringComparison.InvariantCultureIgnoreCase)) { return; } var pathologyDoctors = ConfigurationManager.AppSettings[Constant.PathologyGPConfigKey]; var pathologyDoctorsSpecialist = ConfigurationManager.AppSettings[Constant.PathologySpecialistConfigKey]; InsertTariffRecord( dataAccessHelper, fileItemCode, fileDoctorRecommendedUnit, correctBaseUnitCost1, newTariffNotLoadedPath, pathologyDoctors); InsertTariffRecord( dataAccessHelper, fileItemCode, fileSpecialistRecommendedUnit, correctBaseUnitCost1, newTariffNotLoadedPath, pathologyDoctorsSpecialist); }