2021-03-22 15:48:08 +00:00
|
|
|
using System.Collections.Generic;
|
2022-01-13 11:19:39 +00:00
|
|
|
using System.Net.Http;
|
2021-02-24 16:50:07 +00:00
|
|
|
using System.Text;
|
2021-03-22 15:48:08 +00:00
|
|
|
using System.Text.Json.Serialization;
|
2021-02-24 16:50:07 +00:00
|
|
|
|
|
|
|
using ASC.Api.Core;
|
2020-04-14 18:59:32 +00:00
|
|
|
using ASC.Common;
|
2021-03-13 12:22:14 +00:00
|
|
|
using ASC.CRM.Api;
|
2021-03-22 15:48:08 +00:00
|
|
|
using ASC.CRM.ApiModels;
|
2021-05-05 14:09:05 +00:00
|
|
|
using ASC.CRM.HttpHandlers;
|
2021-03-17 11:50:13 +00:00
|
|
|
using ASC.CRM.Mapping;
|
2021-06-03 12:51:29 +00:00
|
|
|
using ASC.Web.CRM.Core.Search;
|
2021-03-13 12:22:14 +00:00
|
|
|
using ASC.Web.CRM.HttpHandlers;
|
2021-02-24 16:50:07 +00:00
|
|
|
|
2021-03-13 12:22:14 +00:00
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
2020-03-02 15:38:31 +00:00
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
|
|
|
namespace ASC.CRM
|
|
|
|
{
|
2021-05-05 14:09:05 +00:00
|
|
|
|
2021-02-24 16:50:07 +00:00
|
|
|
public class Startup : BaseStartup
|
2020-03-02 15:38:31 +00:00
|
|
|
{
|
2020-04-16 19:41:37 +00:00
|
|
|
public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment)
|
2021-02-24 16:50:07 +00:00
|
|
|
: base(configuration, hostEnvironment)
|
2020-03-02 15:38:31 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-02-24 16:50:07 +00:00
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
2020-03-02 15:38:31 +00:00
|
|
|
{
|
2021-02-24 16:50:07 +00:00
|
|
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
2020-03-02 15:38:31 +00:00
|
|
|
|
2021-03-13 12:22:14 +00:00
|
|
|
base.ConfigureServices(services);
|
|
|
|
|
2022-01-13 11:19:39 +00:00
|
|
|
services.AddHttpClient("DownloadCurrencyPage").ConfigurePrimaryHttpMessageHandler(() =>
|
|
|
|
{
|
|
|
|
return new HttpClientHandler()
|
|
|
|
{
|
|
|
|
AllowAutoRedirect = true,
|
|
|
|
MaxAutomaticRedirections = 2,
|
|
|
|
UseDefaultCredentials = true
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2021-04-15 15:20:43 +00:00
|
|
|
DIHelper.TryAdd<EntryPointApiController>();
|
2021-03-10 15:38:56 +00:00
|
|
|
DIHelper.TryAdd<CasesController>();
|
|
|
|
DIHelper.TryAdd<ContactInfosController>();
|
|
|
|
DIHelper.TryAdd<ContactsController>();
|
|
|
|
DIHelper.TryAdd<CurrencyRatesController>();
|
|
|
|
DIHelper.TryAdd<CustomFieldsController>();
|
|
|
|
DIHelper.TryAdd<TasksController>();
|
|
|
|
DIHelper.TryAdd<DealsController>();
|
|
|
|
DIHelper.TryAdd<InvoicesController>();
|
|
|
|
DIHelper.TryAdd<ListItemsController>();
|
|
|
|
DIHelper.TryAdd<RelationshipEventsController>();
|
2021-03-15 11:36:22 +00:00
|
|
|
DIHelper.TryAdd<ReportsController>();
|
2021-03-10 15:38:56 +00:00
|
|
|
DIHelper.TryAdd<TagsController>();
|
|
|
|
DIHelper.TryAdd<TasksController>();
|
|
|
|
DIHelper.TryAdd<TaskTemplateController>();
|
|
|
|
DIHelper.TryAdd<UtilsController>();
|
2021-03-15 11:36:22 +00:00
|
|
|
DIHelper.TryAdd<VoIPController>();
|
2021-03-17 11:50:13 +00:00
|
|
|
|
2021-03-19 16:56:26 +00:00
|
|
|
DIHelper.TryAdd<CasesDtoTypeConverter>();
|
|
|
|
DIHelper.TryAdd<ContactDtoTypeConverter>();
|
|
|
|
DIHelper.TryAdd<InvoiceBaseDtoTypeConverter>();
|
|
|
|
DIHelper.TryAdd<InvoiceDtoTypeConverter>();
|
|
|
|
DIHelper.TryAdd<InvoiceItemDtoTypeConverter>();
|
2021-04-06 17:33:28 +00:00
|
|
|
DIHelper.TryAdd<InvoiceTaxDtoTypeConverter>();
|
2021-03-19 16:56:26 +00:00
|
|
|
DIHelper.TryAdd<OpportunityDtoTypeConverter>();
|
|
|
|
DIHelper.TryAdd<RelationshipEventDtoTypeConverter>();
|
2021-03-23 15:41:56 +00:00
|
|
|
DIHelper.TryAdd<ListItemDtoTypeConverter>();
|
2021-03-19 16:56:26 +00:00
|
|
|
DIHelper.TryAdd<TaskDtoTypeConverter>();
|
2021-03-22 11:56:42 +00:00
|
|
|
DIHelper.TryAdd<CustomFieldDtoTypeConverter>();
|
2021-04-15 15:20:43 +00:00
|
|
|
DIHelper.TryAdd<DealMilestoneDtoTypeConverter>();
|
2021-06-04 16:27:44 +00:00
|
|
|
DIHelper.TryAdd<VoipCallDtoTypeConverter>();
|
2021-06-03 12:51:29 +00:00
|
|
|
|
|
|
|
DIHelper.TryAdd<FactoryIndexerCase>();
|
|
|
|
DIHelper.TryAdd<FactoryIndexerContact>();
|
|
|
|
DIHelper.TryAdd<FactoryIndexerContactInfo>();
|
|
|
|
DIHelper.TryAdd<FactoryIndexerDeal>();
|
|
|
|
DIHelper.TryAdd<FactoryIndexerEvents>();
|
|
|
|
DIHelper.TryAdd<FactoryIndexerFieldValue>();
|
|
|
|
DIHelper.TryAdd<FactoryIndexerInvoice>();
|
|
|
|
DIHelper.TryAdd<FactoryIndexerTask>();
|
2021-03-13 12:22:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
|
|
{
|
|
|
|
base.Configure(app, env);
|
|
|
|
|
2021-05-05 14:09:05 +00:00
|
|
|
app.UseMiddleware<TenantConfigureMiddleware>();
|
|
|
|
|
2021-03-13 12:22:14 +00:00
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("httphandlers/contactphotohandler.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseContactPhotoHandler();
|
|
|
|
});
|
|
|
|
|
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("httphandlers/filehandler.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseFileHandler();
|
|
|
|
});
|
|
|
|
|
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("httphandlers/fileuploaderhandler.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseFileUploaderHandler();
|
|
|
|
});
|
|
|
|
|
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("httphandlers/importfilehandler.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseImportFileHandlerHandler();
|
|
|
|
});
|
|
|
|
|
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("httphandlers/organisationlogohandler.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseOrganisationLogoHandler();
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("httphandlers/webtoleadfromhandler.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseWebToLeadFromHandlerHandler();
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
2021-03-22 15:48:08 +00:00
|
|
|
|
2022-05-19 15:47:59 +00:00
|
|
|
protected override JsonConverter[] Converters
|
2021-03-22 15:48:08 +00:00
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
var jsonConverters = new List<JsonConverter>
|
|
|
|
{
|
|
|
|
new ContactDtoJsonConverter()
|
|
|
|
};
|
|
|
|
|
|
|
|
return jsonConverters.ToArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 15:38:31 +00:00
|
|
|
}
|
|
|
|
}
|
2021-03-22 15:48:08 +00:00
|
|
|
|
|
|
|
|