Exemplo n.º 1
0
        public static void Run(string data, Organization organization, Person runningPerson)
        {
            if (!data.StartsWith("\r\n<html>\r\n<head>\r\n    <style>\r\n        .tal"))
            {
                runningPerson.SendPhoneMessage("The file you uploaded does not appear to be a Payson export file. No processing done. The data has been discarded.");
                throw new ArgumentException("This does not appear to be a Payson file");
            }

            if (organization.Identity != 1)
            {
                runningPerson.SendPhoneMessage("Payson import is currently only supported for PPSE. No processing done. The data has been discarded.");
                throw new Exception("Payson is only supported for PPSE at the moment.");
            }

            ImportResult result = ImportPayson(data);

            ImportStats stats = ProcessImportedData(result, organization, runningPerson);

            try
            {
                runningPerson.SendPhoneMessage("The Payson file was processed. See mail for more details.");
            }
            catch (Exception)
            {
                // Ignore error on SMS transmit
            }

            string mailBody = string.Empty;

            mailBody += String.Format("Rows processed: {0,9:N0}\r\n", stats.ProcessedTransactionCount);
            mailBody += String.Format("Tx imported:    {0,9:N0}\r\n", stats.ImportedTransactionCount);
            mailBody += String.Format("Tx modified:    {0,9:N0}\r\n", stats.ModifiedTransactionCount - stats.ImportedTransactionCount);

            runningPerson.SendNotice("Payson file imported", mailBody, organization.Identity);
        }
Exemplo n.º 2
0
        public static void Run(string data, Organization organization, Person runningPerson)
        {
            if (!data.StartsWith("Date\t Time\t Time Zone\t Name\t Type"))
            {
                runningPerson.SendPhoneMessage("The file you uploaded does not appear to be a PayPal tab-delimited file of all activity. No processing done. The data has been discarded.");
                throw new ArgumentException("This does not appear to be a PayPal file");
            }

            ImportResult result = ImportPaypal(data);

            ImportStats stats = ProcessImportedData(result, organization, runningPerson);

            try
            {
                runningPerson.SendPhoneMessage("The PayPal file was processed. See mail for more details.");
            }
            catch (Exception)
            {
                // Ignore error on SMS transmit
            }

            string mailBody = string.Empty;

            mailBody += String.Format("Rows processed: {0,9:N0}\r\n", stats.ProcessedTransactionCount);
            mailBody += String.Format("Tx imported:    {0,9:N0}\r\n", stats.ImportedTransactionCount);
            mailBody += String.Format("Tx modified:    {0,9:N0}\r\n", stats.ModifiedTransactionCount - stats.ImportedTransactionCount);

            runningPerson.SendNotice("PayPal file imported", mailBody, organization.Identity);
        }
Exemplo n.º 3
0
        internal static bool SendReminderSms (Person person, string message)
        {
            bool result = false;

            try
            {
                person.SendPhoneMessage(message);
                result = true;
            }
            // ignore exceptions
            catch (Exception)
            {
            }

            return result;
        }