Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0ea711e

Browse files
authored
Merge pull request#240 from Resgrid/develop
Develop
2 parents963535b +2da2fb9 commit0ea711e

File tree

13 files changed

+226
-47
lines changed

13 files changed

+226
-47
lines changed

‎Core/Resgrid.Config/ChatConfig.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ public static class ChatConfig
1010
publicstaticstringNovuApplicationId="";
1111
publicstaticstringNovuSecretKey="";
1212

13-
publicstaticstringNovuUnitFcmProviderId="";
14-
publicstaticstringNovuUnitApnsProviderId="";
15-
publicstaticstringNovuResponderFcmProviderId="";
16-
publicstaticstringNovuResponderApnsProviderId="";
13+
publicstaticstringNovuUnitFcmProviderId="firebase-cloud-messaging-7Z5wHFPpQ";
14+
publicstaticstringNovuUnitApnsProviderId="unit-apns";
15+
publicstaticstringNovuResponderFcmProviderId="respond-firebase-cloud-messaging";
16+
publicstaticstringNovuResponderApnsProviderId="respond-apns";
1717
publicstaticstringNovuDispatchUnitWorkflowId="unit-dispatch";
1818
publicstaticstringNovuDispatchUserWorkflowId="user-dispatch";
1919
publicstaticstringNovuMessageUserWorkflowId="user-message";

‎Core/Resgrid.Config/InfoConfig.cs‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespaceResgrid.Config
1+
usingSystem.Collections.Generic;
2+
3+
namespaceResgrid.Config
24
{
35
publicstaticclassInfoConfig
46
{
@@ -21,5 +23,39 @@ public static class InfoConfig
2123
publicstaticstringRelayAppKey="RelayAppKey";
2224

2325
publicstaticstringEmailProcessorKey="EmailProcessorKey";
26+
27+
publicstaticList<ResgridSystemLocation>Locations=newList<ResgridSystemLocation>()
28+
{
29+
newResgridSystemLocation()
30+
{
31+
Name="US-West",
32+
DisplayName="Resgrid North America (Global)",
33+
LocationInfo=
34+
"This is the Resgrid system hosted in the Western United States (private datacenter). This system services most Resgrid customers.",
35+
IsDefault=true,
36+
ApiUrl="https://api.resgrid.com",
37+
AllowsFreeAccounts=true
38+
},
39+
newResgridSystemLocation()
40+
{
41+
Name="EU-Central",
42+
DisplayName="Resgrid Europe",
43+
LocationInfo=
44+
"This is the Resgrid system hosted in Central Europe (on OVH). This system services Resgrid customers in the European Union to help with data compliance requirements.",
45+
IsDefault=false,
46+
ApiUrl="https://api.eu.resgrid.com",
47+
AllowsFreeAccounts=false
48+
}
49+
};
50+
}
51+
52+
publicclassResgridSystemLocation
53+
{
54+
publicstringName{get;set;}
55+
publicstringDisplayName{get;set;}
56+
publicstringLocationInfo{get;set;}
57+
publicboolIsDefault{get;set;}
58+
publicstringApiUrl{get;set;}
59+
publicboolAllowsFreeAccounts{get;set;}
2460
}
2561
}

‎Core/Resgrid.Config/SystemBehaviorConfig.cs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ public static class SystemBehaviorConfig
185185
/// </summary>
186186
publicstaticstringBlogUrl="https://blog.resgrid.com";
187187

188+
/// <summary>
189+
/// Sets the name of the location this Resgrid system is running in
190+
/// </summary>
191+
publicstaticstringLocationName="US-West";
192+
188193
publicstaticstringGetEnvPrefix()
189194
{
190195
switch(Environment)

‎Core/Resgrid.Model/Services/ICommunicationService.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public interface ICommunicationService
1919
/// <param name="profile">The profile.</param>
2020
/// <returns>Task&lt;System.Boolean&gt;.</returns>
2121
Task<bool>SendMessageAsync(Messagemessage,stringsendersName,stringdepartmentNumber,intdepartmentId,
22-
UserProfileprofile=null);
22+
UserProfileprofile=null,Departmentdepartment=null);
2323

2424
/// <summary>
2525
/// Sends the call asynchronous.
@@ -110,6 +110,6 @@ Task<bool> SendTextMessageAsync(string userId, string title, string message, int
110110
/// <param name="profile">The profile.</param>
111111
/// <returns>Task&lt;System.Boolean&gt;.</returns>
112112
Task<bool>SendCalendarAsync(stringuserId,intdepartmentId,stringmessage,stringdepartmentNumber,
113-
stringtitle="Notification",UserProfileprofile=null);
113+
stringtitle="Notification",UserProfileprofile=null,Departmentdepartment=null);
114114
}
115115
}

‎Core/Resgrid.Services/CalendarService.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ public async Task<bool> NotifyNewCalendarItemAsync(CalendarItem calendarItem)
469469
// Notify the entire department
470470
foreach(varprofileinprofiles)
471471
{
472-
await_communicationService.SendCalendarAsync(profile.Key,calendarItem.DepartmentId,message,departmentNumber,title,profile.Value);
472+
await_communicationService.SendCalendarAsync(profile.Key,calendarItem.DepartmentId,message,departmentNumber,title,profile.Value,department);
473473
}
474474
}
475475
else
@@ -487,9 +487,9 @@ public async Task<bool> NotifyNewCalendarItemAsync(CalendarItem calendarItem)
487487
foreach(varmemberingroup.Members)
488488
{
489489
if(profiles.ContainsKey(member.UserId))
490-
await_communicationService.SendNotificationAsync(member.UserId,calendarItem.DepartmentId,message,departmentNumber,department,title,profiles[member.UserId]);
490+
await_communicationService.SendCalendarAsync(member.UserId,calendarItem.DepartmentId,message,departmentNumber,title,profiles[member.UserId],department);
491491
else
492-
await_communicationService.SendNotificationAsync(member.UserId,calendarItem.DepartmentId,message,departmentNumber,department,title,null);
492+
await_communicationService.SendCalendarAsync(member.UserId,calendarItem.DepartmentId,message,departmentNumber,title,null,department);
493493
}
494494
}
495495
}

‎Core/Resgrid.Services/CallEmailTemplates/OttawaKingstonTorontoTemplate.cs‎

Lines changed: 67 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -49,48 +49,84 @@ public async Task<Call> GenerateCall(CallEmail email, string managingUser, List<
4949
if(String.IsNullOrEmpty(email.Subject))
5050
returnnull;
5151

52-
string[]sections=email.TextBody.Split(new[]{" ALPHA 512 "},StringSplitOptions.None);
53-
string[]sectionOneParts=sections[0].Split(new[]{" "},StringSplitOptions.None);
54-
55-
Callc=newCall();
56-
c.Notes=email.TextBody;
57-
c.Name=sections[1].Trim();
58-
c.LoggedOn=DateTime.UtcNow;
59-
c.Priority=priority;
60-
c.ReportingUserId=managingUser;
61-
c.Dispatches=newCollection<CallDispatch>();
62-
c.CallSource=(int)CallSources.EmailImport;
63-
c.SourceIdentifier=email.MessageId;
64-
c.NatureOfCall=sections[1].Trim();
65-
c.IncidentNumber=sectionOneParts[0].Trim();
66-
c.ExternalIdentifier=sectionOneParts[0].Trim();
67-
68-
if(users!=null&&users.Any())
52+
try
6953
{
70-
foreach(varuinusers)
54+
string[]sections=email.TextBody.Split(new[]{" ALPHA 512 "},StringSplitOptions.None);
55+
string[]sectionOneParts=sections[0].Split(new[]{" "},StringSplitOptions.None);
56+
57+
Callc=newCall();
58+
c.Notes=email.TextBody;
59+
c.Name=sections[1].Trim();
60+
c.LoggedOn=DateTime.UtcNow;
61+
c.Priority=priority;
62+
c.ReportingUserId=managingUser;
63+
c.Dispatches=newCollection<CallDispatch>();
64+
c.CallSource=(int)CallSources.EmailImport;
65+
c.SourceIdentifier=email.MessageId;
66+
c.NatureOfCall=sections[1].Trim();
67+
c.IncidentNumber=sectionOneParts[0].Trim();
68+
c.ExternalIdentifier=sectionOneParts[0].Trim();
69+
70+
if(users!=null&&users.Any())
7171
{
72-
CallDispatchcd=newCallDispatch();
73-
cd.UserId=u.UserId;
72+
foreach(varuinusers)
73+
{
74+
CallDispatchcd=newCallDispatch();
75+
cd.UserId=u.UserId;
7476

75-
c.Dispatches.Add(cd);
77+
c.Dispatches.Add(cd);
78+
}
7679
}
77-
}
7880

79-
// Search for an active call
80-
if(activeCalls!=null&&activeCalls.Any())
81+
// Search for an active call
82+
if(activeCalls!=null&&activeCalls.Any())
83+
{
84+
varactiveCall=activeCalls.FirstOrDefault(x=>x.IncidentNumber==c.IncidentNumber);
85+
86+
if(activeCall!=null)
87+
{
88+
activeCall.Notes=c.Notes;
89+
activeCall.LastDispatchedOn=DateTime.UtcNow;
90+
91+
returnactiveCall;
92+
}
93+
}
94+
95+
returnc;
96+
}
97+
catch(Exceptionex)
8198
{
82-
varactiveCall=activeCalls.FirstOrDefault(x=>x.IncidentNumber==c.IncidentNumber);
99+
Callc=newCall();
100+
c.Name=email.Subject;
101+
c.NatureOfCall=$"ERROR PROCESSING DISPATCH EMAIL, Unprocessed email body:{email.TextBody}";
83102

84-
if(activeCall!=null)
103+
if(users!=null&&users.Any())
85104
{
86-
activeCall.Notes=c.Notes;
87-
activeCall.LastDispatchedOn=DateTime.UtcNow;
105+
foreach(varuinusers)
106+
{
107+
CallDispatchcd=newCallDispatch();
108+
cd.UserId=u.UserId;
88109

89-
returnactiveCall;
110+
c.Dispatches.Add(cd);
111+
}
90112
}
91-
}
92113

93-
returnc;
114+
// Search for an active call
115+
if(activeCalls!=null&&activeCalls.Any())
116+
{
117+
varactiveCall=activeCalls.FirstOrDefault(x=>x.IncidentNumber==c.IncidentNumber);
118+
119+
if(activeCall!=null)
120+
{
121+
activeCall.Notes=c.Notes;
122+
activeCall.LastDispatchedOn=DateTime.UtcNow;
123+
124+
returnactiveCall;
125+
}
126+
}
127+
128+
returnc;
129+
}
94130
}
95131
}
96132
}

‎Core/Resgrid.Services/CommunicationService.cs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public CommunicationService(ISmsService smsService, IEmailService emailService,
3939
_userStateService=userStateService;
4040
}
4141

42-
publicasyncTask<bool>SendMessageAsync(Messagemessage,stringsendersName,stringdepartmentNumber,intdepartmentId,UserProfileprofile=null)
42+
publicasyncTask<bool>SendMessageAsync(Messagemessage,stringsendersName,stringdepartmentNumber,intdepartmentId,UserProfileprofile=null,Departmentdepartment=null)
4343
{
4444
if(Config.SystemBehaviorConfig.DoNotBroadcast&&!Config.SystemBehaviorConfig.BypassDoNotBroadcastDepartments.Contains(departmentId))
4545
returnfalse;
@@ -79,6 +79,7 @@ public async Task<bool> SendMessageAsync(Message message, string sendersName, st
7979
{
8080
varspm=newStandardPushMessage();
8181
spm.MessageId=message.MessageId;
82+
spm.DepartmentCode=department?.Code;
8283

8384
if(message.SystemGenerated)
8485
spm.SubTitle="Msg from System";
@@ -124,6 +125,7 @@ public async Task<bool> SendCallAsync(Call call, CallDispatch dispatch, string d
124125
spc.Priority=call.Priority;
125126
spc.ActiveCallCount=1;
126127
spc.DepartmentId=departmentId;
128+
spc.DepartmentCode=call.Department?.Code;
127129

128130
if(call.CallPriority!=null&&!String.IsNullOrWhiteSpace(call.CallPriority.Color))
129131
{
@@ -335,7 +337,7 @@ public async Task<bool> SendNotificationAsync(string userId, int departmentId, s
335337
returntrue;
336338
}
337339

338-
publicasyncTask<bool>SendCalendarAsync(stringuserId,intdepartmentId,stringmessage,stringdepartmentNumber,stringtitle="Notification",UserProfileprofile=null)
340+
publicasyncTask<bool>SendCalendarAsync(stringuserId,intdepartmentId,stringmessage,stringdepartmentNumber,stringtitle="Notification",UserProfileprofile=null,Departmentdepartment=null)
339341
{
340342
if(Config.SystemBehaviorConfig.DoNotBroadcast&&!Config.SystemBehaviorConfig.BypassDoNotBroadcastDepartments.Contains(departmentId))
341343
returnfalse;
@@ -364,6 +366,7 @@ public async Task<bool> SendCalendarAsync(string userId, int departmentId, strin
364366
varspm=newStandardPushMessage();
365367
spm.Title="Calendar";
366368
spm.SubTitle=$"{title}{message}";
369+
spm.DepartmentCode=null;
367370

368371
try
369372
{
@@ -467,6 +470,7 @@ public async Task<bool> SendTroubleAlertAsync(TroubleAlertEvent troubleAlertEven
467470
spc.Priority=(int)CallPriority.Emergency;
468471
spc.ActiveCallCount=1;
469472
spc.DepartmentId=departmentId;
473+
spc.DepartmentCode=call.Department?.Code;
470474

471475
stringsubTitle=String.Empty;
472476
if(!String.IsNullOrWhiteSpace(unitAddress))

‎Core/Resgrid.Services/PushService.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ public async Task<bool> PushMessage(StandardPushMessage message, string userId,
112112

113113
try
114114
{
115-
await_novuProvider.SendUserMessage(message.Title,message.SubTitle,userId,message.DepartmentCode,string.Format("M{0}",message.MessageId),null);
115+
if(!string.IsNullOrWhiteSpace(message.DepartmentCode))
116+
await_novuProvider.SendUserMessage(message.Title,message.SubTitle,userId,message.DepartmentCode,string.Format("M{0}",message.MessageId),null);
116117
}
117118
catch(Exceptionex)
118119
{
@@ -143,7 +144,8 @@ public async Task<bool> PushNotification(StandardPushMessage message, string use
143144
}
144145
try
145146
{
146-
await_novuProvider.SendUserMessage(message.Title,message.SubTitle,userId,message.DepartmentCode,string.Format("N{0}",message.MessageId),null);
147+
if(!string.IsNullOrWhiteSpace(message.DepartmentCode))
148+
await_novuProvider.SendUserNotification(message.Title,message.SubTitle,userId,message.DepartmentCode,string.Format("N{0}",message.MessageId),null);
147149
}
148150
catch(Exceptionex)
149151
{

‎Providers/Resgrid.Providers.Messaging/NovuProvider.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ private async Task<bool> SendNotification(string title, string body, string reci
231231
{
232232
subject=title,
233233
body=body,
234+
id=eventCode
234235
},
235236
overrides=new
236237
{

‎Web/Resgrid.Web.Services/Controllers/v4/ConfigController.cs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ public ConfigController()
2424
}
2525
#endregion Members and Constructors
2626

27+
/// <summary>
28+
/// Gets the system config
29+
/// </summary>
30+
/// <returns></returns>
31+
[HttpGet("GetSystemConfig")]
32+
[ProducesResponseType(StatusCodes.Status200OK)]
33+
publicasyncTask<ActionResult<GetSystemConfigResult>>GetSystemConfig()
34+
{
35+
varresult=newGetSystemConfigResult();
36+
37+
result.PageSize=1;
38+
result.Status=ResponseHelper.Success;
39+
ResponseHelper.PopulateV4ResponseData(result);
40+
41+
returnresult;
42+
}
43+
2744
/// <summary>
2845
/// Gets the config values for a key
2946
/// </summary>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp