/// <summary> /// Requests PackageService for a status of delivered package. /// </summary> /// <returns></returns> public List <DeliveryResult> GetDeliveryStatusResult(string pnrOrgNr) { var recipientHelper = new RecipientHelper(); var packageService = new PackageService(); var deliveryResult = packageService.GetPackageDelivery(Sender, pnrOrgNr, ConfigHelper.ConfigurationEntity.MaxAllowedStatusMessages); return(deliveryResult); }
/// <summary> /// Send mail to mina meddelanden, through webservice. /// </summary> private SendPackageResult sendMailToMinaMeddelanden(Mail mail, IsReachableResult isReachableResult) { var recipientHelper = new RecipientHelper(); mail.Recipient.To = recipientHelper.GetRecipientAdress(mail.Recipient.To); var result = sendMessage(mail, isReachableResult); return(result); }
/// <summary> /// Use internal webservice to check if recipient exists and isreachable in FaR. /// </summary> public bool IsReachable(string recipient, string senderOrg) { var recipientHelper = new RecipientHelper(); var recipientNumber = recipientHelper.GetRecipientAdress(recipient); // Call FaR, ask if recipient is reachable var service = new RecipientService(); var isReachableResult = service.IsReachable(recipientNumber, senderOrg); return(isReachableResult.IsReachable); }
/// <summary> /// Dialog with error information if something goes wrong calling FaRService to check if a recipient IsReachable. /// Contains message configured in Resource.xml, Id = 19. /// </summary> /// <param name="recipient"></param> public void ExceptionWhenCheckingReachableInFaRDialog(string recipient) { var errorMessage = ResourceHelper.Resources[17].Text; var recipientHelper = new RecipientHelper(); if (errorMessage.Contains("[placeholder]")) { errorMessage = errorMessage.Replace("[placeholder]", recipientHelper.GetRecipientAdress(recipient)); } // MessageBox.Show(errorMessage, ResourceHelper.Resources[1].Text, MessageBoxButtons.OK, MessageBoxIcon.Error); }
/// <summary> /// Validate incoming parameters and call recipient in FaR and check if a person got a mailbox connected. /// </summary> public IsReachableResponse IsReachable(IsReachableRequest request, string senderOrg) { //Set a new Id for this request, easier to follow request through logs. request.RequestId = Guid.NewGuid(); LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.FaR.FaRService: incoming IsReachable with RequestId: {0}", request.RequestId)); IsReachableResponse isReachableResponse = new IsReachableResponse() { IsReachable = false }; try { var recipientHelper = new RecipientHelper(); request.RecipientNumber = recipientHelper.GetRecipientAdress(request.RecipientNumber); var validated = recipientHelper.ValidateRecipient(request.RecipientNumber, request.RequestId); if (validated) { var recipientService = new SE.GOV.MM.Integration.FaR.Service.RecipientService(); var response = IsUserReachableInFaR(request.RecipientNumber, request.RequestId, senderOrg); if (response != null) { var reachabilityStatus = response[0]; isReachableResponse = ConvertReachabilityStatusToIsReachableResponse(reachabilityStatus, isReachableResponse, request.RequestId); } } } catch (ArgumentNullException nse) { string errorMessage = string.Format("SE.GOV.MM.Integration.FaR.FaRService: ArgumentNullException RequestId: {0} ", request.RequestId); LogManager.Log(new Log.Log() { Message = errorMessage, EventId = EventId.ArgumentException, Exception = nse, Level = Level.Error }); throw nse; } catch (Exception ex) { string errorMessage = string.Format("SE.GOV.MM.Integration.FaR.FaRService: Something went wrong in FaRService, RequestId: {0} ", request.RequestId); LogManager.Log(new Log.Log() { Message = errorMessage, EventId = EventId.GenerelizedException, Exception = ex, Level = Level.Error }); throw ex; } return(isReachableResponse); }
public void Validate(string recipient, string subject) { var rHelper = new RecipientHelper(); if (!rHelper.ValidRecipient(recipient)) { throw new ArgumentException(ResourceHelper.Resources[3].Text); } if (string.IsNullOrEmpty(subject)) { throw new ArgumentException(ResourceHelper.Resources[5].Text); } }
private PhoneNumber BuildPhoneNumber(string number) { PhoneNumber result = null; var sanitized = RecipientHelper.GetSanitizedMobileNumber(number); int countryCode = RecipientHelper.GetCountryCodeFromMobile(number); var regionCode = _util.GetRegionCodeForCountryCode(countryCode); try { result = _util.Parse(sanitized, regionCode); } catch { return(null); } return(result); }
/// <summary> /// Validate Recipient in mailitem, /// Only contains one recipient, valid personNo or OrgNo. /// </summary> public bool ValidateRecipientInMailItem(ref bool Cancel) { if (OutlookMailItem.Recipients.Count > 1) { MessageBox.Show(ResourceHelper.Resources[4].Text, ResourceHelper.Resources[1].Text, MessageBoxButtons.OK, MessageBoxIcon.Error); Cancel = true; return(false); } var recipientHelper = new RecipientHelper(); if (!recipientHelper.ValidRecipient(OutlookMailItem.To)) { MessageBox.Show(ResourceHelper.Resources[3].Text, ResourceHelper.Resources[1].Text, MessageBoxButtons.OK, MessageBoxIcon.Error); Cancel = true; return(false); } return(true); }
/// <summary> /// returns a object containing ServiceSupplier and if the recipient isReachable. /// </summary> /// <param name="recipient"></param> /// <returns></returns> public IsReachableResult IsReachableResult(string recipient, string senderOrg) { var isReachableResult = new IsReachableResult(); try { //Validate recipient var recipientHelper = new RecipientHelper(); var recipientService = new RecipientService(); // recipient = recipientHelper.GetRecipientAdress(recipient); //MG Not sure if we need this if (recipientHelper.ValidRecipient(recipient)) { isReachableResult = recipientService.IsReachable(recipient, senderOrg); } } catch (System.Exception e) { // LogManager.Log(new Log.Log() { EventId = EventId.GenerelizedException, Exception = e, Level = Level.Error, Message = "Something went wrong checking recipient against FaRService." }); return(null); } return(isReachableResult); }
public int GetCountryCode(string number) { return(RecipientHelper.GetCountryCodeFromMobile(number)); }