Beispiel #1
0
        static string CheckLength(string result, SMSTemplateEntity template)
        {
            if (template.RemoveNoSMSCharacters)
            {
                result = SMSCharacters.RemoveNoSMSCharacters(result);
            }

            int remainingLength = SMSCharacters.RemainingLength(result);

            if (remainingLength < 0)
            {
                switch (template.MessageLengthExceeded)
                {
                case MessageLengthExceeded.NotAllowed:
                    throw new ApplicationException(SMSCharactersMessage.TheTextForTheSMSMessageExceedsTheLengthLimit.NiceToString());

                case MessageLengthExceeded.Allowed:
                    break;

                case MessageLengthExceeded.TextPruning:
                    return(result.RemoveEnd(Math.Abs(remainingLength)));
                }
            }

            return(result);
        }
Beispiel #2
0
        static string CombineText(SMSTemplateEntity template, SMSTemplateMessageEmbedded templateMessage, List <Combination> combinations)
        {
            string text = templateMessage.Message;

            if (template.RemoveNoSMSCharacters)
            {
                text = SMSCharacters.RemoveNoSMSCharacters(templateMessage.Message);
                combinations.ForEach(c => c.Value = SMSCharacters.RemoveNoSMSCharacters(c.Value));
            }

            return(CombineText(text, combinations, template.MessageLengthExceeded));
        }
Beispiel #3
0
 public ContentResult RemoveNoSMSCharacters(string text)
 {
     return(Content(SMSCharacters.RemoveNoSMSCharacters(text)));
 }
Beispiel #4
0
        public int RemainingCharacters([FromBody] RemainingCharactersRequest request)
        {
            var message = request.RemoveNoSMSCharacters ? SMSCharacters.RemoveNoSMSCharacters(request.Message) : request.Message;

            return(SMSCharacters.RemainingLength(message));
        }
Beispiel #5
0
 private void removeNonSMSChars_Click(object sender, RoutedEventArgs e)
 {
     TemplateMessageDC.Message = SMSCharacters.RemoveNoSMSCharacters(TemplateMessageDC.Message);
     TemplateMessageDC         = TemplateMessageDC;
 }