Compare commits
No commits in common. "b8fdcf2561446a77772d6ae8336cf734e4f39cde" and "3682a17d53621adddc9b71e20b2db064231fae2d" have entirely different histories.
b8fdcf2561
...
3682a17d53
@ -36,8 +36,7 @@ using System.Net.Http;
|
|||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Abp.Json;
|
using Abp.Json;
|
||||||
using System.Diagnostics;
|
|
||||||
using static Grpc.Core.Metadata;
|
|
||||||
|
|
||||||
namespace BCS.BMC.CompanyMasters
|
namespace BCS.BMC.CompanyMasters
|
||||||
{
|
{
|
||||||
@ -126,7 +125,7 @@ namespace BCS.BMC.CompanyMasters
|
|||||||
protected async Task<int> Create(CreateOrUpdateCompanyMasterInput input)
|
protected async Task<int> Create(CreateOrUpdateCompanyMasterInput input)
|
||||||
{
|
{
|
||||||
int companyId = 0;
|
int companyId = 0;
|
||||||
// await GetUrlIsValid(input.Url);
|
|
||||||
var company = from m in _companyMaster.GetAllList().Where(m => m.Url.ToLower().Trim() == input.Url.ToLower().Trim())
|
var company = from m in _companyMaster.GetAllList().Where(m => m.Url.ToLower().Trim() == input.Url.ToLower().Trim())
|
||||||
|
|
||||||
select m;
|
select m;
|
||||||
@ -159,53 +158,6 @@ namespace BCS.BMC.CompanyMasters
|
|||||||
return companyId;
|
return companyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ValidUrlResponseDto> UrlIsValid(string url)
|
|
||||||
{
|
|
||||||
bool istrue = false;
|
|
||||||
var entity= new ValidUrlResponseDto();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest;
|
|
||||||
request.Timeout = 5000; //set the timeout to 5 seconds to keep the user from waiting too long for the page to load
|
|
||||||
request.Method = "HEAD"; //Get only the header information -- no need to download any content
|
|
||||||
|
|
||||||
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
|
|
||||||
{
|
|
||||||
int statusCode = (int)response.StatusCode;
|
|
||||||
if (statusCode >= 100 && statusCode < 400) //Good requests
|
|
||||||
{
|
|
||||||
entity.IsSuccess = true;
|
|
||||||
Uri uri = new Uri(url, UriKind.Absolute);
|
|
||||||
var host = uri.Host;
|
|
||||||
|
|
||||||
if (host.Split('.').Length > 2)
|
|
||||||
{
|
|
||||||
int lastIndex = host.LastIndexOf(".");
|
|
||||||
int index = host.LastIndexOf(".", lastIndex - 1);
|
|
||||||
var subdomain = host.Substring(0, index);
|
|
||||||
if (subdomain != "www")
|
|
||||||
{
|
|
||||||
entity.TenantName = subdomain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (statusCode >= 500 && statusCode <= 510) //Server Errors
|
|
||||||
{
|
|
||||||
//log.Warn(String.Format("The remote server has thrown an internal error. Url is not valid: {0}", url));
|
|
||||||
Debug.WriteLine(String.Format("The remote server has thrown an internal error. Url is not valid: {0}", url));
|
|
||||||
istrue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
// log.Error(String.Format("Could not test url {0}.", url), ex);
|
|
||||||
}
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
protected async Task Update(CreateOrUpdateCompanyMasterInput input)
|
protected async Task Update(CreateOrUpdateCompanyMasterInput input)
|
||||||
{
|
{
|
||||||
var entity = await _companyMaster.FirstOrDefaultAsync(x => x.Id == input.Id);
|
var entity = await _companyMaster.FirstOrDefaultAsync(x => x.Id == input.Id);
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BCS.BMC.CompanyMasters.Dto
|
|
||||||
{
|
|
||||||
public class ValidUrlResponseDto
|
|
||||||
{
|
|
||||||
public bool IsSuccess { get; set; }
|
|
||||||
public string TenantName { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -28,6 +28,5 @@ namespace BCS.BMC.CompanyMasters
|
|||||||
Task DeleteCompany(EntityDto<int> input);
|
Task DeleteCompany(EntityDto<int> input);
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
Task<HttpStatusCodeResult> TokenByCompanyUrl(GetInputUrl input);
|
Task<HttpStatusCodeResult> TokenByCompanyUrl(GetInputUrl input);
|
||||||
Task<ValidUrlResponseDto> UrlIsValid(string url);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,5 @@ namespace BCS.BMC.FirebaseCloudMessaging.Dto
|
|||||||
public bool Status { get; set; }
|
public bool Status { get; set; }
|
||||||
[FirestoreProperty]
|
[FirestoreProperty]
|
||||||
public List<string> UserId { get; set; }
|
public List<string> UserId { get; set; }
|
||||||
[FirestoreProperty]
|
|
||||||
public int CompanyId { get; set; }
|
|
||||||
[FirestoreProperty]
|
|
||||||
public string ScheduleGenerationId { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,13 @@ namespace BCS.BMC.FirebaseCloudMessaging.Dto
|
|||||||
[AutoMapTo(typeof (FirebaseCloudMessageDetails))]
|
[AutoMapTo(typeof (FirebaseCloudMessageDetails))]
|
||||||
public class NotificationModel
|
public class NotificationModel
|
||||||
{
|
{
|
||||||
public string FcmToken { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
//[JsonProperty("title")]
|
||||||
|
//public List<string> Title { get; set; }
|
||||||
|
//[JsonProperty("body")]
|
||||||
|
public string FcmToken { get; set; }
|
||||||
|
//public List<string> Id { get; set; }
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
public DateTime? MessageSentDateTime { get; set; }
|
public DateTime? MessageSentDateTime { get; set; }
|
||||||
|
|
||||||
@ -23,8 +28,7 @@ namespace BCS.BMC.FirebaseCloudMessaging.Dto
|
|||||||
|
|
||||||
public bool Status { get; set; }
|
public bool Status { get; set; }
|
||||||
public List<string> UserId { get; set; }
|
public List<string> UserId { get; set; }
|
||||||
public string CompanyUrl { get; set; }
|
|
||||||
public string ScheduleGenerationId { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//[AutoMapFrom(typeof(NotificationModel))]
|
//[AutoMapFrom(typeof(NotificationModel))]
|
||||||
|
@ -126,7 +126,5 @@
|
|||||||
<text name="CompanyMaster">Company Master</text>
|
<text name="CompanyMaster">Company Master</text>
|
||||||
<text name="Url">Url</text>
|
<text name="Url">Url</text>
|
||||||
<text name="Id">Id</text>
|
<text name="Id">Id</text>
|
||||||
<text name="CreateNewCompany">Create New Company</text>
|
|
||||||
<text name="EditCompany">Edit Company</text>
|
|
||||||
</texts>
|
</texts>
|
||||||
</localizationDictionary>
|
</localizationDictionary>
|
||||||
|
@ -267,12 +267,7 @@ namespace BCS.BMC.Controllers
|
|||||||
{
|
{
|
||||||
return BadRequest("Url Not Found");
|
return BadRequest("Url Not Found");
|
||||||
}
|
}
|
||||||
var result = new
|
return Ok("Success");
|
||||||
{
|
|
||||||
CompanyId = company.Id,
|
|
||||||
|
|
||||||
};
|
|
||||||
return Ok(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -37,10 +37,5 @@ namespace BCS.BMC.Web.Controllers
|
|||||||
|
|
||||||
return PartialView("_EditModal", output);
|
return PartialView("_EditModal", output);
|
||||||
}
|
}
|
||||||
//public async Task<bool> GetUrlIsValid(string url)
|
|
||||||
//{
|
|
||||||
// bool isSuccess = await _companyasterService.GetUrlIsValid(url);
|
|
||||||
// return isSuccess;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ namespace BCS.BMC.Web.Controllers
|
|||||||
private readonly IFirebaseNotificationAppService _notificationService;
|
private readonly IFirebaseNotificationAppService _notificationService;
|
||||||
private readonly IRepository<FirebaseCloudMessageDetails> _firebaseCloudMessageDetails;
|
private readonly IRepository<FirebaseCloudMessageDetails> _firebaseCloudMessageDetails;
|
||||||
private readonly IRepository<FirebaseToken, int> _firebaseToken;
|
private readonly IRepository<FirebaseToken, int> _firebaseToken;
|
||||||
private readonly IRepository<CompanyMaster, int> _companyMasterService;
|
|
||||||
//IFirebaseConfig config = new FirebaseConfig
|
//IFirebaseConfig config = new FirebaseConfig
|
||||||
//{
|
//{
|
||||||
// AuthSecret = "n6DTPQEbpnLahrrk2EYu4bJ2Wd3jCk2N8kocazdI",
|
// AuthSecret = "n6DTPQEbpnLahrrk2EYu4bJ2Wd3jCk2N8kocazdI",
|
||||||
@ -38,13 +37,11 @@ namespace BCS.BMC.Web.Controllers
|
|||||||
//IFirebaseClient client;
|
//IFirebaseClient client;
|
||||||
public NotificationController(IFirebaseNotificationAppService notificationService,
|
public NotificationController(IFirebaseNotificationAppService notificationService,
|
||||||
IRepository<FirebaseCloudMessageDetails> firebaseCloudMessageDetails,
|
IRepository<FirebaseCloudMessageDetails> firebaseCloudMessageDetails,
|
||||||
IRepository<FirebaseToken, int> firebaseToken,
|
IRepository<FirebaseToken, int> firebaseToken)
|
||||||
IRepository<CompanyMaster, int> companyMasterService)
|
|
||||||
{
|
{
|
||||||
_notificationService = notificationService;
|
_notificationService = notificationService;
|
||||||
_firebaseCloudMessageDetails = firebaseCloudMessageDetails;
|
_firebaseCloudMessageDetails = firebaseCloudMessageDetails;
|
||||||
_firebaseToken = firebaseToken;
|
_firebaseToken = firebaseToken;
|
||||||
_companyMasterService = companyMasterService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +62,7 @@ namespace BCS.BMC.Web.Controllers
|
|||||||
{
|
{
|
||||||
string path = AppDomain.CurrentDomain.BaseDirectory + @"firechat-57601-firebase-adminsdk-anscp-e04366c4d4.json";
|
string path = AppDomain.CurrentDomain.BaseDirectory + @"firechat-57601-firebase-adminsdk-anscp-e04366c4d4.json";
|
||||||
Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", path);
|
Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", path);
|
||||||
var companyDetails = _companyMasterService.GetAllList().Where(x => x.Url.Trim() == notification.CompanyUrl.Trim()).FirstOrDefault();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FirestoreDb db = FirestoreDb.Create("firechat-57601");
|
FirestoreDb db = FirestoreDb.Create("firechat-57601");
|
||||||
@ -80,8 +77,6 @@ namespace BCS.BMC.Web.Controllers
|
|||||||
data.SenderName = notification.SenderName;
|
data.SenderName = notification.SenderName;
|
||||||
data.Status = notification.Status;
|
data.Status = notification.Status;
|
||||||
data.UserId = notification.UserId;
|
data.UserId = notification.UserId;
|
||||||
data.CompanyId = companyDetails.Id;
|
|
||||||
data.ScheduleGenerationId = notification.ScheduleGenerationId;
|
|
||||||
await db.Collection("BMC_Notification").Document().SetAsync(data);
|
await db.Collection("BMC_Notification").Document().SetAsync(data);
|
||||||
|
|
||||||
int userId = 0;
|
int userId = 0;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div class="modal fade" id="ClientMasterCreateModal" tabindex="-1" role="dialog" aria-labelledby="UserCreateModalLabel" data-backdrop="static">
|
<div class="modal fade" id="ClientMasterCreateModal" tabindex="-1" role="dialog" aria-labelledby="UserCreateModalLabel" data-backdrop="static">
|
||||||
<div class="modal-dialog modal-lg" role="document">
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@await Html.PartialAsync("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("CreateNewCompany")))
|
@* @await Html.PartialAsync("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("CreateNewUser")))*@
|
||||||
<form name="clientMasterCreateForm" role="form" class="form-horizontal">
|
<form name="clientMasterCreateForm" role="form" class="form-horizontal">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@*<ul class="nav nav-tabs" role="tablist">
|
@*<ul class="nav nav-tabs" role="tablist">
|
||||||
@ -26,17 +26,15 @@
|
|||||||
<div class="tab-content mt-4">
|
<div class="tab-content mt-4">
|
||||||
<div role="tabpanel" class="tab-pane container active" id="create-client-details">
|
<div role="tabpanel" class="tab-pane container active" id="create-client-details">
|
||||||
<div class="form-group row required">
|
<div class="form-group row required">
|
||||||
<label class="col-md-2 col-form-label">@L("Url")</label>
|
<label class="col-md-3 col-form-label">@L("Company")</label>
|
||||||
<div class="col-md-8">
|
<div class="col-md-9">
|
||||||
<input type="text" class="form-control" id="Url" name="Url" required>
|
<input type="text" class="form-control" name="CompanyName" required maxlength="@AbpUserBase.MaxUserNameLength" minlength="2">
|
||||||
</div>
|
</div>
|
||||||
<input type="submit" value="Check Url" class="btn btn-secondary btn-sm download-button" name="submit">
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row required">
|
||||||
<div class="form-group row" id="div_CompanyName" style="visibility : hidden">
|
<label class="col-md-3 col-form-label">@L("Url")</label>
|
||||||
<label class="col-md-2 col-form-label">@L("Company")</label>
|
<div class="col-md-9">
|
||||||
<div class="col-md-8">
|
<input type="text" class="form-control" name="Url" required maxlength="@AbpUserBase.MaxNameLength">
|
||||||
<input type="text" class="form-control" name="CompanyName" id="CompanyName" readonly>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@* <div class="form-group row required">
|
@* <div class="form-group row required">
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
@{
|
@{
|
||||||
Layout = null;
|
Layout = null;
|
||||||
}
|
}
|
||||||
@await Html.PartialAsync("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("EditCompany")))
|
|
||||||
<form name="EditCompanyForm" role="form" class="form-horizontal">
|
<form name="EditCompanyForm" role="form" class="form-horizontal">
|
||||||
<input type="hidden" name="Id" value="@Model.Id" />
|
<input type="hidden" name="Id" value="@Model.Id" />
|
||||||
<input type="hidden" name="DomainName" value="@Model.DomainName" />
|
<input type="hidden" name="DomainName" value="@Model.DomainName" />
|
||||||
@ -23,20 +23,18 @@
|
|||||||
</ul>*@
|
</ul>*@
|
||||||
<div class="tab-content mt-4">
|
<div class="tab-content mt-4">
|
||||||
<div role="tabpanel" class="tab-pane container active" id="edit-company-details">
|
<div role="tabpanel" class="tab-pane container active" id="edit-company-details">
|
||||||
<div class="form-group row required">
|
|
||||||
<label class="col-md-3 col-form-label">@L("Url")</label>
|
|
||||||
<div class="col-md-9">
|
|
||||||
<input id="url" type="text" class="form-control" name="Url" value="@Model.Url" required maxlength="@AbpUserBase.MaxUserNameLength" minlength="2">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group row required">
|
<div class="form-group row required">
|
||||||
<label class="col-md-3 col-form-label">@L("Company")</label>
|
<label class="col-md-3 col-form-label">@L("Company")</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<input id="CompanyName" type="text" class="form-control" name="CompanyName" value="@Model.CompanyName" required maxlength="@AbpUserBase.MaxUserNameLength" minlength="2">
|
<input id="CompanyName" type="text" class="form-control" name="CompanyName" value="@Model.CompanyName" required maxlength="@AbpUserBase.MaxUserNameLength" minlength="2">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row required">
|
||||||
|
<label class="col-md-3 col-form-label">@L("Domain")</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input id="url" type="text" class="form-control" name="Url" value="@Model.Url" required maxlength="@AbpUserBase.MaxUserNameLength" minlength="2">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@* <div class="form-group row required">
|
@* <div class="form-group row required">
|
||||||
<label class="col-md-3 col-form-label">@L("ClientSubDomainName")</label>
|
<label class="col-md-3 col-form-label">@L("ClientSubDomainName")</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
@ -84,21 +84,6 @@
|
|||||||
$('input[type="checkbox"]', rows).prop('checked', this.checked);
|
$('input[type="checkbox"]', rows).prop('checked', this.checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
_$form.find('.download-button').on('click', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
var companydetails = _$form.serializeFormToObject();
|
|
||||||
//abp.ui.setBusy();
|
|
||||||
var companyUrl = companydetails.Url;
|
|
||||||
|
|
||||||
abp.notify.info(l('ValidatingUrl'));
|
|
||||||
var data = _companyService.urlIsValid(companyUrl);
|
|
||||||
data.done(function (result) {
|
|
||||||
$('#div_CompanyName').attr("style", "visibility : visible");
|
|
||||||
$('#CompanyName').val(result.tenantName);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
_$form.find('.save-button').on('click', (e) => {
|
_$form.find('.save-button').on('click', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user