Exemple #1
0
        private void GetSMSrecipientsDefinitions()
        {
            //create recipients reader instance
            SMSrecipientReader reader = new SMSrecipientReader(_realmProvider);

            //read all rcipients from DB
            List <SMSrecipientDefinition> allRecipients = reader.GetAllActualRecipients();

            //read all recipients to export definitions
            foreach (var item in _recipientsIDList)
            {
                try
                {
                    //convert realm DB model into export model
                    SMSrecipientDefinition definition = allRecipients.Where(x => x.Identity == item).First();

                    SMSrecipientDefinitionExportModel exportModel = new SMSrecipientDefinitionExportModel()
                    {
                        Identity    = definition.Identity,
                        FirstName   = definition.FirstName,
                        LastName    = definition.LastName,
                        AreaCode    = definition.AreaCode,
                        PhoneNumber = definition.PhoneNumber,
                        NoErrors    = true,
                    };

                    _recipientsList.Add(exportModel);
                }
                catch (Exception ex)
                {
                    var logger = NLog.LogManager.GetCurrentClassLogger();
                    logger.Error($"Error while searching for {item} identity in actual SMS recipients group. Error: {ex.Message}.");
                }
            }
        }
Exemple #2
0
        private bool CheckIfSMSrecipientWithThisNameExists(SMSrecipientDefinitionExportModel parsedRecipient)
        {
            //create instance of sms recipients reader
            SMSrecipientReader            reader        = new SMSrecipientReader(_realmProvider);
            List <SMSrecipientDefinition> allRecipients = reader.GetAllActualRecipients();

            return(allRecipients.Where(x => x.FirstName == parsedRecipient.FirstName && x.LastName == parsedRecipient.LastName).Count() > 0);
        }
Exemple #3
0
        private void SaveRecipientToDB(SMSrecipientCreator creator, SMSrecipientDefinitionExportModel definition)
        {
            bool added = creator.AddNewSMSrecipient(definition.FirstName, definition.LastName,
                                                    definition.AreaCode, definition.PhoneNumber);

            string message;

            if (added)
            {
                message = $"SMS recipient successfully added to database.";
            }
            else
            {
                message = $"SMS recipient NOT ADDED to Database.";
            }

            OnSingleImportDone(added, definition.FullName, message, false);
        }
Exemple #4
0
 private bool CheckCorrectnessOfData(SMSrecipientDefinitionExportModel parsedRecipient,
                                     SMSrecipientImportItemValidator validaror)
 {
     return(validaror.Validate(parsedRecipient).NoErrors);
 }