-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathEbMeetingController.cs
More file actions
375 lines (358 loc) · 20 KB
/
EbMeetingController.cs
File metadata and controls
375 lines (358 loc) · 20 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ExpressBase.Common;
using ExpressBase.Objects.ServiceStack_Artifacts;
using ExpressBase.Web.BaseControllers;
using Microsoft.AspNetCore.Mvc;
using ServiceStack;
using ServiceStack.Redis;
using Newtonsoft.Json;
using ExpressBase.Common.Structures;
using ExpressBase.Objects;
using ExpressBase.Common.Objects;
using ExpressBase.Common.Extensions;
using System.Reflection;
using ExpressBase.Common.Objects.Attributes;
using ExpressBase.Common.Data;
using ExpressBase.Common.LocationNSolution;
using ExpressBase.Common.Constants;
using ExpressBase.Objects.Objects;
using System.IO;
namespace ExpressBase.Web.Controllers
{
public class EbMeetingController : EbBaseIntCommonController
{
public EbMeetingController(IServiceClient _ssclient, IRedisClient _redis) : base(_ssclient, _redis) { } // GET: /<controller>/
public IActionResult Index()
{
return View();
}
public string GetAllMeetingSlots(int MeetingId, string date)
{
GetMeetingSlotsResponse Resp = this.ServiceClient.Post<GetMeetingSlotsResponse>(new GetMeetingSlotsRequest { MeetingScheduleId = MeetingId, Date = date });
List<MeetingSlots> Slots = new List<MeetingSlots>();
foreach (var Obj in Resp.AllSlots)
{
if (Obj.SlotAttendeeCount >= Obj.Max_Attendee)
{
Slots.Add(
new MeetingSlots()
{
Meeting_Id = Obj.Meeting_Id,
Slot_id = Obj.Slot_id,
Is_approved = Obj.Is_approved,
Date = Obj.Date,
Description = Obj.Description,
Meeting_schedule_id = Obj.Meeting_schedule_id,
Time_from = Obj.Time_from,
Time_to = Obj.Time_to,
Title = Obj.Title,
IsHide = true,
Attendee_count = Obj.Attendee_count,
Host_count = Obj.Host_count,
}
);
}
else
{
Slots.Add(
new MeetingSlots()
{
Meeting_Id = Obj.Meeting_Id,
Slot_id = Obj.Slot_id,
Is_approved = Obj.Is_approved,
Date = Obj.Date,
Description = Obj.Description,
Meeting_schedule_id = Obj.Meeting_schedule_id,
Time_from = Obj.Time_from,
Time_to = Obj.Time_to,
Title = Obj.Title,
IsHide = false,
Attendee_count = Obj.Attendee_count,
Host_count = Obj.Host_count,
}
);
}
}
return JsonConvert.SerializeObject(Slots);
}
public string UpdateMeetingFromAttendee(SlotParticipants Obj)
{
MeetingSaveValidateResponse Resp = this.ServiceClient.Post<MeetingSaveValidateResponse>(new MeetingSaveValidateRequest { SlotParticipant = Obj });
return JsonConvert.SerializeObject(Resp.ResponseStatus);
}
public string AddMeetingTemp(AddMeetingSlotRequest obj)
{
AddMeetingSlotResponse Resp = this.ServiceClient.Post<AddMeetingSlotResponse>(new AddMeetingSlotRequest { Date = obj.Date });
return JsonConvert.SerializeObject(Resp.Status);
}
public string GetSlotDetails(int id)
{
GetMeetingsDetailsResponse Resp = this.ServiceClient.Post<GetMeetingsDetailsResponse>(new GetMeetingsDetailsRequest { MyActionId = id });
EbWebForm FormObj = EbFormHelper.GetEbObject<EbWebForm>(Resp.FormRefid, this.ServiceClient, this.Redis, null);
string htm = "";
string hosts = "";
string attendees = "";
EbMeetingScheduler MeetingObj = new EbMeetingScheduler();
GetScheduleUserDetailsResponse Partiinfo = new GetScheduleUserDetailsResponse();
MeetingResponse Response = new MeetingResponse();
for (int i = 0; i < FormObj.Controls.Count; i++)
{
if(FormObj.Controls[i].ObjType == "MeetingScheduler")
{
MeetingObj = (EbMeetingScheduler)FormObj.Controls[i];
}
}
if (Resp.IsDirectMeeting && Resp.ResponseStatus )
{
for (int i = 0; i < Resp.ParticipantList.Count; i++)
{
if (Resp.ParticipantList[i].ParticipantType == 1)
{
string con = Resp.ParticipantList[i].Confirmation == 2 ? "(Requested)" : "";
hosts += $@" <div class='mr-hosts'>{Resp.ParticipantList[i].Name} {con}</div>";
}
else
{
string con = Resp.ParticipantList[i].Confirmation == 2 ? "(Requested)" : "";
attendees += $@" <div class='mr-attendees'>{Resp.ParticipantList[i].Name} {con}</div>";
}
}
if (Resp.SlotList.Count == 1)
{
string TimeFrom = Convert.ToDateTime(Resp.SlotList[0].TimeFrom).ToString("hh:mm tt");
string TimeTo = Convert.ToDateTime(Resp.SlotList[0].TimeTo).ToString("hh:mm tt");
string Date = Convert.ToDateTime(Resp.SlotList[0].Date).ToString("dddd, dd MMMM yyyy");
htm += $@" <div class='mr-t'><div class='mr-title'> {Resp.MeetingScheduleDetails.Title} </div></div>
<div id='tabs'>
<ul>
<li><a href='#tabs-1'>Details</a></li>
<li><a href='#tabs-2'>Participants</a></li>
</ul>
<div id='tabs-1'>
<div class='mr'>
<div class='mr-description'> <i class='fa fa-info-circle' aria-hidden='true'></i> <div>{Resp.MeetingScheduleDetails.Description} </div> </div>
<div class='meeting-details'>
<div class='mr-venue'> <i class='fa fa-map-marker' aria-hidden='true'></i> <div>{Resp.MeetingScheduleDetails.Location}</div> </div>
<div class='mr-date'> <i class='fa fa-calendar-o' aria-hidden='true'></i> <div>{Date}</div> </div>
<div class='mr-time'> <div>{TimeFrom}</div> <span>to</span> <div>{TimeTo}</div></div></div>
</div></div>
<div id='tabs-2'>
<div class='mr-list'>
<div class='mr-hosts-list'><h5>Hosts</h5> {hosts}</div>
<div class='mr-attendees-list'><h5>Attendees</h5> {attendees}</div> </div> </div>
</div>
</div>
</div>
<div class='mr-btn-grp'>
<button id='reject-meeting' data-id='{Resp.SlotList[0].SlotId}' class='mr-btn'> Reject Meeting</button>
<button id='cancel-meeting' data-id='{Resp.SlotList[0].SlotId}' class='mr-btn'> Cancel Meeting</button>
<button id='accept-meeting' data-id='{Resp.SlotList[0].SlotId}' class='mr-btn'> Accept Meeting</button>
</div>
";
}
else
{
htm += $@"</div> in valid request </div>";
}
}
else if (Resp.IsDirectMeeting == false && Resp.SlotList.Count > 1 && Resp.ResponseStatus)
{
string Date = Convert.ToDateTime(Resp.MeetingScheduleDetails.Date).ToString("dddd, dd MMMM yyyy");
string Slots = "";
for (int i = 0; i < Resp.SlotList.Count; i++)
{
string TimeTo = Convert.ToDateTime(Resp.SlotList[i].TimeTo).ToString("hh:mm tt");
string TimeFrom = Convert.ToDateTime(Resp.SlotList[i].TimeFrom).ToString("hh:mm tt");
if (Resp.SlotList[i].IsApproved == "F")
{
Slots += $@"<div id='{Resp.SlotList[i].SlotId}' m-id='{Resp.SlotList[i].MeetingScheduleId}' is-approved='{Resp.SlotList[i].IsApproved}'
class='slots-div unblocked-slot'> <i class='fa fa-dot-circle-o' aria-hidden='true'></i>{TimeFrom} to {TimeTo}</div>";
}
else
{
Slots += $@"<div id='{Resp.SlotList[i].SlotId}' m-id='{Resp.SlotList[i].MeetingScheduleId}' is-approved='{Resp.SlotList[i].IsApproved}'
class='solts-div blocked-slot'> <i class='fa fa-dot-circle-o' aria-hidden='true'></i> {TimeFrom} to {TimeTo}</div>";
}
}
htm += $@"<div class='mr'>
<div class='mr-title'> {Resp.MeetingScheduleDetails.Title} </div>
<div class='mr-description'> <i class='fa fa-info-circle' aria-hidden='true'></i> <div>{Resp.MeetingScheduleDetails.Description} </div> </div>
<div class='meeting-details'>
<div class='mr-venue'> <i class='fa fa-map-marker' aria-hidden='true'></i> <div>{Resp.MeetingScheduleDetails.Location}</div> </div>
<div class='mr-date'> <i class='fa fa-calendar-o' aria-hidden='true'></i> <div>{Date}</div> </div>
<div class='slots'> <div class='tm-h'>Pick a time slot </div><div style='display:flex;'>{Slots}</div> </div>
</div></div>
<div class='mr-btn-grp'>
<button id='pick-slot' data-id='{Resp.SlotList[0].SlotId}' class='mr-btn'> Pick Selected Slot</button>
</div>
";
htm += $@"<div></div>";
}
else if (Resp.IsDirectMeeting == false && Resp.SlotList.Count == 1 && Resp.ResponseStatus)
{
string Date = Convert.ToDateTime(Resp.MeetingScheduleDetails.Date).ToString("dddd, dd MMMM yyyy");
string TimeFrom = Convert.ToDateTime(Resp.SlotList[0].TimeFrom).ToString("hh:mm tt");
string TimeTo = Convert.ToDateTime(Resp.SlotList[0].TimeTo).ToString("hh:mm tt");
htm += $@"<div class='mr'>
<div class='mr-title'> {Resp.MeetingScheduleDetails.Title} </div>
<div class='mr-description'> <i class='fa fa-info-circle' aria-hidden='true'></i> <div>{Resp.MeetingScheduleDetails.Description} </div> </div>
<div class='meeting-details'>
<div class='mr-venue'> <i class='fa fa-map-marker' aria-hidden='true'></i> <div>{Resp.MeetingScheduleDetails.Location}</div> </div>
<div class='mr-date'> <i class='fa fa-calendar-o' aria-hidden='true'></i> <div>{Date}</div> </div>
<div class='mr-time'> <div>{TimeFrom}</div> <span>to</span> <div>{TimeTo}</div></div></div>
</div></div>
<div class='mr-btn-grp'>
<button id='pick-slot' data-id='{Resp.SlotList[0].SlotId}' class='mr-btn'> Accept Meeting </button>
</div>
";
htm += $@"<div></div>";
}
if (MeetingObj.SameHost)
{
Partiinfo = this.ServiceClient.Post<GetScheduleUserDetailsResponse>(new GetScheduleUserDetailsRequest { MyActionId = id });
if (Partiinfo.ParticipantType == ParticipantType.Host)
{
htm = "";
string Date = Convert.ToDateTime(Resp.MeetingScheduleDetails.Date).ToString("dddd, dd MMMM yyyy");
string Slots = "";
List<int> IdSlots = new List<int>();
for (int i = 0; i < Resp.SlotList.Count; i++)
{
string TimeTo = Convert.ToDateTime(Resp.SlotList[i].TimeTo).ToString("hh:mm tt");
string TimeFrom = Convert.ToDateTime(Resp.SlotList[i].TimeFrom).ToString("hh:mm tt");
IdSlots.Add(Resp.SlotList[i].SlotId);
// if (Resp.SlotList[i].IsApproved == "F")
// {
// Slots += $@"<div id='{Resp.SlotList[i].SlotId}' m-id='{Resp.SlotList[i].MeetingScheduleId}' is-approved='{Resp.SlotList[i].IsApproved}'
//class='slots-div unblocked-slot'> <i class='fa fa-dot-circle-o' aria-hidden='true'></i>{TimeFrom} to {TimeTo}</div>";
// }
// else
// {
// Slots += $@"<div id='{Resp.SlotList[i].SlotId}' m-id='{Resp.SlotList[i].MeetingScheduleId}' is-approved='{Resp.SlotList[i].IsApproved}'
//class='solts-div blocked-slot'> <i class='fa fa-dot-circle-o' aria-hidden='true'></i> {TimeFrom} to {TimeTo}</div>";
// }
Slots += $@"<tr><td>{TimeFrom}</td><td>{TimeTo}</td></tr>";
}
string joinedStr = string.Join(",", IdSlots);
htm += $@"<div class='mr'>
<div class='mr-title'> {Resp.MeetingScheduleDetails.Title} </div>
<div class='mr-description'> <i class='fa fa-info-circle' aria-hidden='true'></i> <div>{Resp.MeetingScheduleDetails.Description} </div> </div>
<div class='meeting-details'>
<div class='mr-venue'> <i class='fa fa-map-marker' aria-hidden='true'></i> <div>{Resp.MeetingScheduleDetails.Location}</div> </div>
<div class='mr-date'> <i class='fa fa-calendar-o' aria-hidden='true'></i> <div>{Date}</div> </div>
<div class='slots'><div style='display:flex;'>
<table class='table'><tr><th>Time From</th><th>Time To</th></tr>
{ Slots}</table></div> </div>
</div></div>
<div class='mr-btn-grp'>
<button id='pick-multiple-slot' data-id='{joinedStr}' class='mr-btn'> Accept Meeting</button>
</div>
";
htm += $@"<div></div>";
}
}
Response.Html = htm;
Response.ResponseStatus = Resp.ResponseStatus;
return JsonConvert.SerializeObject(Response);
}
public string AcceptMeeting(int Slot, int myactionid)
{
MeetingUpdateByUsersResponse Resp = this.ServiceClient.Post<MeetingUpdateByUsersResponse>(new MeetingUpdateByUsersRequest { Id = Slot, UserInfo = this.LoggedInUser, MyActionId = myactionid });
return JsonConvert.SerializeObject(Resp);
}
public string CancelMeeting(int Slot, int myactionid)
{
MeetingCancelByHostResponse Resp = this.ServiceClient.Post<MeetingCancelByHostResponse>(new MeetingCancelByHostRequest { SlotId = Slot, UserInfo = this.LoggedInUser, MyActionId = myactionid });
return JsonConvert.SerializeObject(Resp);
}
public string GetMeetingsDetails(int meetingid)
{
GetMeetingDetailsResponse Resp = this.ServiceClient.Post<GetMeetingDetailsResponse>(new GetMeetingDetailRequest { MeetingId = meetingid });
string htm = "";
string hosts = "";
string attendees = "";
for (int i = 0; i < Resp.MeetingRequest.Count; i++)
{
if (Resp.MeetingRequest[i].ParticipantType == 1)
{
hosts += $@" <div class='mr-hosts'>{Resp.MeetingRequest[i].Fullname}</div>";
}
else
{
if (Resp.MeetingRequest[i].TypeofUser == 2)
{
string abc = JsonConvert.SerializeObject(new List<Param> (){ new Param() { Name = "id", Type = "7", Value = Convert.ToString(Resp.MeetingRequest[i].FormDataId) } });
string Url = "";
string b64 = abc.ToBase64();
//int loc = this.LoggedInUser.LocationIds
if (Resp.MeetingRequest[i].FormRefid != "")
Url = $@"/WebForm/Index?_r={Resp.MeetingRequest[i].FormRefid}&_p={b64}&_m=1&_l=1";
attendees += $@"<a href='{Url}' class='mr-attendees'>{Resp.MeetingRequest[i].Fullname}</a>";
}
else
attendees += $@" <div class='mr-attendees'>{Resp.MeetingRequest[i].Fullname}</div>";
}
}
if (Resp.MeetingRequest.Count > 0)
{
string TimeFrom = Convert.ToDateTime(Resp.MeetingRequest[0].TimeFrom).ToString("hh:mm tt");
string TimeTo = Convert.ToDateTime(Resp.MeetingRequest[0].TimeTo).ToString("hh:mm tt");
string Date = Convert.ToDateTime(Resp.MeetingRequest[0].MeetingDate).ToString("dddd, dd MMMM yyyy");
htm += $@" <div class='mr-t'><div class='mr-title'> {Resp.MeetingRequest[0].Title} </div></div>
<div id='tabs'>
<ul>
<li><a href='#tabs-1'>Details</a></li>
<li><a href='#tabs-2'>Participants</a></li>
</ul>
<div id='tabs-1'>
<div class='mr'>
<div class='mr-description'> <i class='fa fa-info-circle' aria-hidden='true'></i> <div>{Resp.MeetingRequest[0].Description} </div> </div>
<div class='meeting-details'>
<div class='mr-venue'> <i class='fa fa-map-marker' aria-hidden='true'></i> <div>{Resp.MeetingRequest[0].Venue}</div> </div>
<div class='mr-date'> <i class='fa fa-calendar-o' aria-hidden='true'></i> <div>{Date}</div> </div>
<div class='mr-time'> <div>{TimeFrom}</div> <span>to</span> <div>{TimeTo}</div></div></div>
</div></div>
<div id='tabs-2'>
<div class='mr-list'>
<div class='mr-hosts-list'><h5>Hosts</h5> {hosts}</div>
<div class='mr-attendees-list'><h5>Attendees</h5> {attendees}</div>
</div></div>
</div>
</div>
</div>
";
}
else
{
htm += $@"</div> in valid request </div>";
}
return JsonConvert.SerializeObject(htm);
}
//pick single meeting request
public string PickSlot(int Slot, int myactionid)
{
PickMeetingSLotResponse Resp = this.ServiceClient.Post<PickMeetingSLotResponse>(new PickMeetingSLotRequest { MyActionId = myactionid, SlotId = Slot, UserInfo = this.LoggedInUser });
return JsonConvert.SerializeObject(Resp);
}
//pick multiple meeting request
public string PickMultipleSlot(List<int> Slots, int myactionid)
{
PickMultipleMeetingResponse Resp = this.ServiceClient.Post<PickMultipleMeetingResponse>(new PickMultipleMeetingRequest { MyActionId = myactionid, SlotIds = Slots, UserInfo = this.LoggedInUser });
return JsonConvert.SerializeObject(Resp);
}
//Meeting Scheduler Participant List who already in a meeting
public string ParticipantBlackList(List<MeetingSuggestion> meetingConfig, string timefrom, string timeto)
{
ParticipantsListAjaxResponse Resp = this.ServiceClient.Post<ParticipantsListAjaxResponse>(new ParticipantsListAjaxRequest { MeetingConfig = meetingConfig, TimeFrom = timefrom, TimeTo = timeto });
return JsonConvert.SerializeObject(Resp);
}
public class MeetingResponse
{
public bool ResponseStatus { get; set; }
public string Html { get; set; }
}
}
}