public async Task WarnMeeting(IRoom room, string uniqueId, Func <string, string> buildStartUrl, Func <string, string> buildCancelUrl) { var meeting = await SecurityCheck(room, uniqueId); if (meeting.Item1.IsNotManaged) { throw new Exception("Cannot manage this meeting"); } __log.DebugFormat("Warning {0} for {1}/{2}, which should start at {3}", uniqueId, room.RoomAddress, room.Id, meeting.Item2.Start); var startUrl = buildStartUrl(_signatureService.GetSignature(room, uniqueId)); var cancelUrl = buildCancelUrl(_signatureService.GetSignature(room, uniqueId)); await SendEmail(room, meeting.Item2, string.Format("WARNING: your meeting '{0}' in {1} is about to be cancelled.", meeting.Item2.Subject, meeting.Item2.Location?.DisplayName), "<p>Please start your meeting by using the RoomNinja on the wall outside the room or simply <a href='" + startUrl + "'>click here to START the meeting</a>.</p><p><a href='" + cancelUrl + "'>Click here to RELEASE the room</a> if you no longer need it so that others can use it.</p>"); }
public void WarnMeeting(IRoom room, string uniqueId, Func <string, string> buildStartUrl, Func <string, string> buildCancelUrl) { var meeting = SecurityCheck(room, uniqueId); if (meeting.IsNotManaged) { throw new Exception("Cannot manage this meeting"); } var item = ExchangeServiceExecuteWithImpersonationCheck(room.RoomAddress, svc => Appointment.Bind(svc, new ItemId(uniqueId))); __log.DebugFormat("Warning {0} for {1}/{2}, which should start at {3}", uniqueId, room.RoomAddress, room.Id, item.Start); var startUrl = buildStartUrl(_signatureService.GetSignature(room, uniqueId)); var cancelUrl = buildCancelUrl(_signatureService.GetSignature(room, uniqueId)); SendEmail(room, item, string.Format("WARNING: your meeting '{0}' in {1} is about to be cancelled.", item.Subject, item.Location), "<p>Please start your meeting by using the RoomNinja on the wall outside the room or simply <a href='" + startUrl + "'>click here to START the meeting</a>.</p><p><a href='" + cancelUrl + "'>Click here to RELEASE the room</a> if you no longer need it so that others can use it.</p>"); }
public async Task <IActionResult> GetSignature(string name, int id, string from = "") { if (name.Length > 4) { return(BadRequest("名字只支持1-4个字符")); } var ip = HttpContext.Request.Headers["X-Forwarded-For"].FirstOrDefault(); if (ip.IsNullOrEmpty()) { ip = Request.HttpContext.Connection.RemoteIpAddress.ToString(); } var url = await _signService.GetSignature(name, id, ip, from); return(Ok(new { result = url })); }
public string GetSignature(string signeeName, string[] waiverReasons) { try { return(_proxy.GetSignature(signeeName, waiverReasons)); } catch (Exception ex) { _retries--; if (_retries > 0) { Logger.Log("GetSignature: Retry", LogLevel.Information); Thread.Sleep(2000); StartShowCaseSigProcess(true); _channel = new ChannelFactory <ISignatureService>(new ServiceEndpoint(ContractDescription.GetContract(typeof(ISignatureService)), _binding, _add)); _proxy = _channel.CreateChannel(); return(GetSignature(signeeName, waiverReasons)); } throw new Exception("Unable to connect to the ShowCaseSignService ", ex); } }