Laden der Kunden Dlls im PluginLoader überarbeitet
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -650,3 +650,4 @@ obj
|
||||
/ReportImp/Lazy/Properties/licenses.licx
|
||||
/TestReportCustomization/Class1.cs
|
||||
/TestReportCustomization/TestReportCustomization.csproj
|
||||
/CustomerDlls
|
||||
|
||||
@@ -936,36 +936,15 @@ namespace Host
|
||||
}
|
||||
|
||||
String t = slicedToken["tenant"].ToString();
|
||||
AbstractReportCreator creator = null;
|
||||
#if DEBUG
|
||||
SessionFacade.Tenant = t;
|
||||
|
||||
|
||||
//Kundennummern zum Testen nur noch in PluginLoader eintragen:
|
||||
t = PluginLoader.Tenant;
|
||||
AbstractReportCreator creator = PluginLoader.FindClass<DefaultReportCreator>();
|
||||
|
||||
|
||||
String customerDllPath = HttpContext.Current.Server.MapPath(@"bin\" + t + "_reports.dll");
|
||||
#else
|
||||
String customerDllPath = HttpContext.Current.Server.MapPath(@"Customer\" + t + "_reports.dll");
|
||||
#endif
|
||||
if (File.Exists(customerDllPath))
|
||||
{
|
||||
var allTypes = Assembly.LoadFrom(customerDllPath).GetTypes();
|
||||
|
||||
var reportCreator = allTypes.FirstOrDefault(i => typeof(AbstractReportCreator).IsAssignableFrom(i));
|
||||
if (reportCreator != null)
|
||||
{
|
||||
creator = Activator.CreateInstance(reportCreator) as AbstractReportCreator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (creator == null)
|
||||
creator = new DefaultReportCreator();
|
||||
creator.TemplateOid = templateOid;
|
||||
creator.Tenant = t;
|
||||
creator.ReportPath = customerDllPath;
|
||||
|
||||
|
||||
#if DEBUG
|
||||
creator.TempPath = BS.Shared.Core.Utils.CreateSavePath(AppDomain.CurrentDomain.BaseDirectory, @"demo\temp");
|
||||
#else
|
||||
|
||||
@@ -219,6 +219,10 @@
|
||||
<add key="LicenseOrderUrl" value="https://support.bewoplaner.de/lizenzbestellung/?k=[TENANT]" />
|
||||
<add key="LicenseCancellationUrl" value="https://support.bewoplaner.de/api/licencecancellation.php?k=[TENANT]" />
|
||||
<add key="ContractStateUrl" value="https://support.bewoplaner.de/api/getcontractstate.php?CustomerID=[TENANT]" />
|
||||
|
||||
<add key="PluginBasePath" value="..\CustomerDlls" />
|
||||
<add key="PluginPath" value="..\CustomerDlls" />
|
||||
|
||||
<!--<add key="MaxDocumentSize" value="20971520" />-->
|
||||
<add key="MaxDocumentSize" value="20971520" />
|
||||
<add key="ICD10File" value="ICD10\icd10.xml" />
|
||||
|
||||
@@ -9,10 +9,6 @@ namespace BeWo.Report
|
||||
{
|
||||
public abstract class AbstractReportCreator
|
||||
{
|
||||
public String Tenant { get; set; }
|
||||
|
||||
public string ReportPath { get; set; }
|
||||
|
||||
public string TempPath { get; set; }
|
||||
public long? TemplateOid { get; set; }
|
||||
|
||||
|
||||
@@ -50,13 +50,10 @@ namespace BeWo.Report
|
||||
}
|
||||
}
|
||||
Type[] lAllReportTypes = null;
|
||||
var fullPath = Path.GetFullPath(ReportPath);
|
||||
if (Tenant != null && File.Exists(ReportPath))
|
||||
{
|
||||
lAllReportTypes = Assembly.LoadFrom(ReportPath).GetTypes();
|
||||
result = FindReportImp<T>(lAllReportTypes, specificReportId, typename, true);
|
||||
}
|
||||
|
||||
lAllReportTypes = PluginLoader.GetAllCustomerTypes();
|
||||
result = FindReportImp<T>(lAllReportTypes, specificReportId, typename, true);
|
||||
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Host\bin\</OutputPath>
|
||||
<OutputPath>..\..\CustomerDlls\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -25,7 +25,7 @@
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Host\bin\</OutputPath>
|
||||
<OutputPath>..\..\CustomerDlls\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
||||
@@ -306,7 +306,6 @@ namespace BeWoDarmstadt
|
||||
{
|
||||
AddValueToCell(zs.MinutenNachtSo21_6, datum, table1.Rows[7], nachtSo2Minuten);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void AddValueToTableLeistungen(ServiceRecord sr)
|
||||
@@ -470,6 +469,10 @@ namespace BeWoDarmstadt
|
||||
|
||||
private double CheckUhrzeiten(DateTime start, int startStunde, int endStunde, double minuten)
|
||||
{
|
||||
if (startStunde > 0 && start.Hour == 0 && start.Minute == 0 && start.Second > 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (startStunde > endStunde) //Nachts
|
||||
{
|
||||
DateTime nachtStartDt = start.Date.AddHours(startStunde);
|
||||
@@ -485,7 +488,7 @@ namespace BeWoDarmstadt
|
||||
return minutes;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
DateTime tagsStartDt = start.Date.AddHours(startStunde);
|
||||
DateTime tagsEndDt = start.Date.AddHours(endStunde);
|
||||
DateTime dtEnd = start.AddMinutes(minuten);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Host\bin\</OutputPath>
|
||||
<OutputPath>..\..\CustomerDlls\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -25,7 +25,7 @@
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Host\bin\</OutputPath>
|
||||
<OutputPath>..\..\CustomerDlls\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Host\bin\</OutputPath>
|
||||
<OutputPath>..\..\CustomerDlls\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -25,7 +25,7 @@
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Host\bin\</OutputPath>
|
||||
<OutputPath>..\..\CustomerDlls\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
||||
@@ -56,13 +56,7 @@ namespace ReportingService.Plugins
|
||||
private static DefaultReportCreator CreateReportCreator()
|
||||
{
|
||||
var reportCreator = PluginLoader.FindClass<DefaultReportCreator>();
|
||||
reportCreator.Tenant = PluginLoader.Tenant;
|
||||
|
||||
#if DEBUG
|
||||
reportCreator.ReportPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\" + PluginLoader.Tenant + "_reports.dll");
|
||||
#else
|
||||
reportCreator.ReportPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Customer\" + PluginLoader.Tenant + "_reports.dll");
|
||||
#endif
|
||||
|
||||
return reportCreator;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,92 +175,19 @@ namespace ReportingService.ServiceImplementations
|
||||
|
||||
private static AbstractReportCreator GetReportCreator()
|
||||
{
|
||||
var derTenant = MultitenancyOperationContextExt.Current.Tenant;
|
||||
|
||||
AbstractReportCreator creator = null;
|
||||
#if DEBUG
|
||||
//Kundennummern zum Testen nur noch in PluginLoader eintragen:
|
||||
derTenant = PluginLoader.Tenant;
|
||||
|
||||
|
||||
var customerDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\" + derTenant + "_reports.dll");
|
||||
#else
|
||||
var customerDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Customer\" + derTenant + "_reports.dll");
|
||||
#endif
|
||||
if (File.Exists(customerDllPath))
|
||||
{
|
||||
var allTypes = Assembly.LoadFrom(customerDllPath).GetTypes();
|
||||
|
||||
var reportCreator = allTypes.FirstOrDefault(i => typeof(AbstractReportCreator).IsAssignableFrom(i));
|
||||
if (reportCreator != null)
|
||||
{
|
||||
creator = Activator.CreateInstance(reportCreator) as AbstractReportCreator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (creator == null)
|
||||
creator = new DefaultReportCreator();
|
||||
|
||||
creator.Tenant = derTenant;
|
||||
creator.ReportPath = customerDllPath;
|
||||
AbstractReportCreator creator = PluginLoader.FindClass<DefaultReportCreator>();
|
||||
|
||||
#if DEBUG
|
||||
creator.TempPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"demo\temp");
|
||||
#else
|
||||
|
||||
creator.TempPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, derTenant + @"\temp");
|
||||
creator.TempPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, PluginLoader.Tenant + @"\temp");
|
||||
#endif
|
||||
|
||||
return creator;
|
||||
}
|
||||
|
||||
private static AbstractReportCreator GetReportCreator(string tenant)
|
||||
{
|
||||
AbstractReportCreator creator = null;
|
||||
#if DEBUG
|
||||
//Kundennummern zum Testen nur noch in PluginLoader eintragen:
|
||||
tenant = PluginLoader.Tenant;
|
||||
|
||||
// Ist "C:\Users\lyndo\BeWo\BeWoPlanerMobil\bin\2387527289_reports.dll"
|
||||
// statt "C:\Users\lyndo\BeWo\Host\bin\2387527289_reports.dll"
|
||||
|
||||
var path = @"..\Host\";
|
||||
|
||||
var customerDllPath = Path.Combine(path, @"bin\" + tenant + "_reports.dll");// Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\" + tenant + "_reports.dll");
|
||||
#else
|
||||
var customerDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Customer\" + tenant + "_reports.dll");
|
||||
#endif
|
||||
if (File.Exists(customerDllPath))
|
||||
{
|
||||
var allTypes = Assembly.LoadFrom(customerDllPath).GetTypes();
|
||||
|
||||
var reportCreator = allTypes.FirstOrDefault(i => typeof(AbstractReportCreator).IsAssignableFrom(i));
|
||||
if (reportCreator != null)
|
||||
{
|
||||
creator = Activator.CreateInstance(reportCreator) as AbstractReportCreator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (creator == null)
|
||||
{
|
||||
creator = new DefaultReportCreator();
|
||||
}
|
||||
|
||||
creator.Tenant = tenant;
|
||||
creator.ReportPath = customerDllPath;
|
||||
|
||||
#if DEBUG
|
||||
creator.TempPath = Path.Combine(path, @"demo\temp");
|
||||
#else
|
||||
|
||||
creator.TempPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, tenant + @"\temp");
|
||||
#endif
|
||||
|
||||
return creator;
|
||||
}
|
||||
|
||||
private static BeWoEntityBase LoadToBargeldkasseRelatedObject(TableID pObjectTid, long pObjectOid)
|
||||
{
|
||||
switch (pObjectTid)
|
||||
@@ -316,7 +243,7 @@ namespace ReportingService.ServiceImplementations
|
||||
// Zum Test im MoK
|
||||
public MemoryStream CreateKilometerauswertungForAllCustomersForWebVersion(List<long> customerOids, DateTime rangeDate, string tenant)
|
||||
{
|
||||
var reportCreator = GetReportCreator(tenant);
|
||||
var reportCreator = GetReportCreator();
|
||||
|
||||
var report = reportCreator.CreateKilometerauswertungForAllCustomers(customerOids, null, new DateTime(rangeDate.Year, rangeDate.Month, 1), new DateTime(rangeDate.Year, rangeDate.Month, 1).AddMonths(1).AddDays(-1));
|
||||
|
||||
@@ -325,7 +252,7 @@ namespace ReportingService.ServiceImplementations
|
||||
|
||||
public MemoryStream CreateMedikamentenlistenReport(long mvlOid, string tenant)
|
||||
{
|
||||
var reportCreator = GetReportCreator(tenant);
|
||||
var reportCreator = GetReportCreator();
|
||||
|
||||
var report = reportCreator.CreateMediVerordListenReport(mvlOid);
|
||||
|
||||
|
||||
@@ -26,78 +26,6 @@ namespace BeWo.Service.Core
|
||||
return true;
|
||||
}
|
||||
|
||||
//public static ICostBearerCalc GetCalcualtionsObjectForCostBearer(long pCostBearerOid)
|
||||
//{
|
||||
// var cb = DAOFactory.GenericDAO.LoadByID<CostBearer>(pCostBearerOid);
|
||||
|
||||
// if (!string.IsNullOrEmpty(cb.CalculationsDllName))
|
||||
// {
|
||||
// Type[] calcTypes = new Type[0];
|
||||
|
||||
// string customReportDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\" + cb.CalculationsDllName);
|
||||
// if (File.Exists(customReportDllPath))
|
||||
// {
|
||||
// calcTypes = Assembly.LoadFrom(customReportDllPath).GetTypes();
|
||||
|
||||
// foreach (var iType in calcTypes)
|
||||
// {
|
||||
// if (typeof(ICostBearerCalc).IsAssignableFrom(iType))
|
||||
// {
|
||||
// return Activator.CreateInstance(iType) as ICostBearerCalc;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// return new InvoiceCreation();
|
||||
//}
|
||||
|
||||
//public static List<CostRate> GetCostRateListForCostBearer(CostBearer costBearer)
|
||||
//{
|
||||
// List<CostRate> list = new List<CostRate>();
|
||||
|
||||
// if (costBearer != null && costBearer.CostRatePeriods != null)
|
||||
// {
|
||||
// foreach (CostRatePeriod crp in costBearer.CostRatePeriods)
|
||||
// {
|
||||
// CostRate cr = new CostRate();
|
||||
// cr.Amount = crp.CostRateValue;
|
||||
// switch (crp.CostRateType)
|
||||
// {
|
||||
// case CostRatePeriodType.HourlyRate:
|
||||
// cr.CostRateType = CostRateType.HourlyRate;
|
||||
// break;
|
||||
// case CostRatePeriodType.MinutesIntervall:
|
||||
// cr.CostRateType = CostRateType.MinutesIntervall;
|
||||
// break;
|
||||
// case CostRatePeriodType.RateFactor:
|
||||
// cr.CostRateType = CostRateType.RateFactor;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// cr.StartDate = crp.StartDate;
|
||||
// cr.EndDate = crp.EndDate;
|
||||
|
||||
// list.Add(cr);
|
||||
// }
|
||||
// }
|
||||
|
||||
// return list;
|
||||
//}
|
||||
|
||||
|
||||
//public static string GetNextInvoiceNumber(int increment, InvoiceBase invoiceBase)
|
||||
//{
|
||||
// string next = String.Empty;
|
||||
// InvoiceNumberDC invoiceNumber = new AccountingServiceImp().LoadInvoiceNumber();
|
||||
|
||||
// if (invoiceNumber != null && invoiceNumber.Use)
|
||||
// {
|
||||
// next = ApplyPattern(invoiceNumber.Pattern, invoiceNumber.CurrentNumber + increment, invoiceBase);
|
||||
// }
|
||||
// return next;
|
||||
//}
|
||||
|
||||
|
||||
public static void SetActivationType<T>(Dictionary<long, long> pOid2Version, ActivationTypeId activationType)
|
||||
where T : BeWoEntityBase, new()
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using BeWo.Data;
|
||||
using BS.Shared.Core;
|
||||
|
||||
@@ -10,7 +11,9 @@ namespace BeWo.Service.Plugins
|
||||
{
|
||||
public class PluginLoader
|
||||
{
|
||||
public static String Tenant
|
||||
private static object _Lock = string.Empty;
|
||||
|
||||
public static String Tenant
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -344,7 +347,7 @@ namespace BeWo.Service.Plugins
|
||||
//t = "6971328056"; // SKM Krefeld
|
||||
//t = "4199238586"; // MeZ Menden;
|
||||
//t = "3226307161"; // Roman Roger Puth
|
||||
//todo t = "3522103738"; // AWO Münsterland-Recklinghausen
|
||||
//t = "3522103738"; // AWO Münsterland-Recklinghausen
|
||||
//t = "5592509446"; // Kontakt Verein für psychosoziale Hilfen e.V
|
||||
//t = "5344902949"; // SHK Service GmbH SBD
|
||||
//t = "1422963536"; // Malteser-Johanniter-Johanneshaus gGmbH
|
||||
@@ -371,34 +374,112 @@ namespace BeWo.Service.Plugins
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String CustomerPluginPath()
|
||||
{
|
||||
var pluginPath = ConfigurationManager.AppSettings.Get("PluginPath");
|
||||
|
||||
#if DEBUG
|
||||
if(!(pluginPath is null))
|
||||
{
|
||||
var alt = Path.Combine(pluginPath, Tenant + "_Reports.dll");
|
||||
|
||||
pluginPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, alt);
|
||||
|
||||
return pluginPath;
|
||||
}
|
||||
#endif
|
||||
var pluginPath = ConfigurationManager.AppSettings.Get("PluginPath");
|
||||
|
||||
if (pluginPath != null)
|
||||
{
|
||||
return Path.Combine(pluginPath, Tenant + "_Reports.dll");
|
||||
var dllName = Tenant + "_Reports.dll";
|
||||
|
||||
if (!String.IsNullOrEmpty(pluginPath))
|
||||
{
|
||||
if (pluginPath.StartsWith(".."))
|
||||
{
|
||||
pluginPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, pluginPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if DEBUG
|
||||
return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\" + Tenant + "_Reports.dll");
|
||||
pluginPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin");
|
||||
#else
|
||||
return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Customer\" + Tenant + "_Reports.dll");
|
||||
pluginPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Customer");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static T FindClass<T>() where T : new()
|
||||
return Path.Combine(pluginPath, dllName);
|
||||
}
|
||||
|
||||
private static void CheckAndUpdateCustomerAssembly()
|
||||
{
|
||||
|
||||
var customerdll = CustomerPluginPath();
|
||||
var dllName = Path.GetFileName(customerdll);
|
||||
var pluginBasePath = ConfigurationManager.AppSettings.Get("PluginBasePath");
|
||||
if (!String.IsNullOrEmpty(pluginBasePath))
|
||||
{
|
||||
if (pluginBasePath.StartsWith(".."))
|
||||
{
|
||||
pluginBasePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, pluginBasePath);
|
||||
}
|
||||
}
|
||||
bool aktualisiereAssembly = false;
|
||||
|
||||
if (!String.IsNullOrEmpty(pluginBasePath))
|
||||
{
|
||||
//Prüfe, ob eine neuere Version der dll im Base Path existiert
|
||||
var baseDll = Path.Combine(pluginBasePath, dllName);
|
||||
|
||||
try
|
||||
{
|
||||
if (File.Exists(baseDll))
|
||||
{
|
||||
if (!File.Exists(customerdll))
|
||||
{
|
||||
aktualisiereAssembly = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.GetLastWriteTime(baseDll) > File.GetLastWriteTime(customerdll))
|
||||
{
|
||||
aktualisiereAssembly = true;
|
||||
}
|
||||
else if (File.GetLastWriteTime(baseDll) == File.GetLastWriteTime(customerdll))
|
||||
{
|
||||
var fibase = new FileInfo(baseDll);
|
||||
var fiwork = new FileInfo(customerdll);
|
||||
if (fibase.Length != fiwork.Length)
|
||||
{
|
||||
aktualisiereAssembly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aktualisiereAssembly)
|
||||
{
|
||||
try
|
||||
{
|
||||
Monitor.Enter(_Lock);
|
||||
|
||||
File.Copy(baseDll, customerdll, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Exit(_Lock);
|
||||
}
|
||||
}
|
||||
|
||||
if (aktualisiereAssembly || GetAssembliyForDll(dllName) == null)
|
||||
{
|
||||
Assembly.Load(File.ReadAllBytes(customerdll));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static T FindClass<T>() where T : new()
|
||||
{
|
||||
var t = FindClass<T>(null, null);
|
||||
if (t == null)
|
||||
@@ -421,9 +502,8 @@ namespace BeWo.Service.Plugins
|
||||
|
||||
if (Tenant != null)
|
||||
{
|
||||
if (File.Exists(CustomerPluginPath()))
|
||||
lAllTypes = Assembly.LoadFrom(CustomerPluginPath()).GetTypes();
|
||||
}
|
||||
lAllTypes = PluginLoader.GetAllCustomerTypes();
|
||||
}
|
||||
|
||||
T result = default(T);
|
||||
if (lAllTypes != null)
|
||||
@@ -432,7 +512,40 @@ namespace BeWo.Service.Plugins
|
||||
return result;
|
||||
}
|
||||
|
||||
public static T FindClass<T>(Type[] lAllTypes, string specificId, string typename)
|
||||
public static Type[] GetAllCustomerTypes()
|
||||
{
|
||||
var path = CustomerPluginPath();
|
||||
var dllName = Path.GetFileName(path);
|
||||
CheckAndUpdateCustomerAssembly();
|
||||
|
||||
var a = GetAssembliyForDll(dllName);
|
||||
|
||||
if (a != null)
|
||||
{
|
||||
return a.GetTypes();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Assembly GetAssembliyForDll(String dllName)
|
||||
{
|
||||
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
|
||||
for (int i = assemblies.Length - 1; i >= 0; i--)
|
||||
{
|
||||
var a = assemblies[i];
|
||||
|
||||
if (a.FullName.StartsWith(dllName.Replace(".dll", "")))
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static T FindClass<T>(Type[] lAllTypes, string specificId, string typename)
|
||||
{
|
||||
T result = default(T);
|
||||
|
||||
|
||||
@@ -189,8 +189,11 @@ namespace BS.Shared.Services
|
||||
ratefactor = (100 + factor.Value) / 100;
|
||||
}
|
||||
|
||||
|
||||
return (this.GetApprovedAmountTotal(relDC) / this.GetMonthCount(relDC.ApprovedStartDate.Value, relDC.ApprovedEndDate.Value)) / ratefactor;
|
||||
var monate = this.GetMonthCount(relDC.ApprovedStartDate.Value, relDC.ApprovedEndDate.Value);
|
||||
if (monate != 0)
|
||||
{
|
||||
return (this.GetApprovedAmountTotal(relDC) / monate) / ratefactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user