Ejemplo n.º 1
0
        private static SendServiceCallEntity GetSendBatch(AccountEntity account)
        {
            using (var dataBinding = new MessageDataAccessor())
            {
                var settings = dataBinding.GetSendSettings();
                if (settings != null)
                {
                    DateTime cutoffTime = TypeSafety.GetValue<DateTime>(ConfigurationManager.AppSettings["CutoffTime"], DateTime.Parse("20:00"));
                    DateTime startTime = TypeSafety.GetValue<DateTime>(ConfigurationManager.AppSettings["StartTime"], DateTime.Parse("08:00"));

                    if (DateTime.Compare(DateTime.Now, cutoffTime) > 0)
                    {
                        settings.DefaultTime = startTime.ToString("HH:mm");
                    }
                }

                SendServiceCallEntity data = new SendServiceCallEntity()
                {
                    Account = account,
                    Settings = settings
                };

                return data;
            }
        }
Ejemplo n.º 2
0
 private static void AddMessagesToServiceCallList(List<SendServiceCallEntity> dataList, SendServiceCallEntity data, List<MessageEntity> entries)
 {
     // Only add item to list if it contains messages.
     if (entries.Count() > 0)
     {
         foreach (var entry in entries)
         {
             data.Entries.Add(entry);
         }
         dataList.Add(data);
     }
 }
Ejemplo n.º 3
0
        private static void ProcessMessagesToServiceCall(List<SendServiceCallEntity> dataList, AccountEntity account, ref SendServiceCallEntity data, ref int counter, ref List<MessageEntity> entries, MessageEntity message)
        {
            message.HasPrefix = true;
            entries.Add(message);

            if (++counter == 1000)
            {
                AddMessagesToServiceCallList(dataList, data, entries);
                entries = new List<MessageEntity>();
                counter = 0;
                data = GetSendBatch(account);
            }
        }
Ejemplo n.º 4
0
        private static DataSet CreateSendSettings(SendServiceCallEntity account)
        {
            DataSet tempDataSet = null;
            DataTable tempDataTable = null;
            DataSet dataSet = null;

            try
            {
                tempDataSet = new DataSet("senddata");
                tempDataTable = new DataTable("settings");

                tempDataTable.Columns.Add("live"); // OPTIONAL - True/False (default - true)
                tempDataTable.Columns.Add("return_credits"); // OPTIONAL - True/False
                tempDataTable.Columns.Add("return_msgs_success_count"); // OPTIONAL - True/False (default - false)
                tempDataTable.Columns.Add("return_msgs_failed_count"); // OPTIONAL - True/False (default - false)
                tempDataTable.Columns.Add("return_entries_success_status"); // OPTIONAL - True/False (default - false)
                tempDataTable.Columns.Add("return_entries_failed_status"); // OPTIONAL - True/False (default - false)
                tempDataTable.Columns.Add("default_senderid"); // OPTIONAL - 11 Char alphanumeric or 15 char numeric (default - Repliable)
                tempDataTable.Columns.Add("default_date"); // REQUIRED - dd/MMM/yyyy
                tempDataTable.Columns.Add("default_time"); // REQUIRED - HH:mm
                tempDataTable.Columns.Add("default_data1"); // OPTIONAL - ""
                tempDataTable.Columns.Add("default_data2"); // OPTIONAL - ""
                tempDataTable.Columns.Add("default_flash"); // OPTIONAL - True/False (default - false)
                tempDataTable.Columns.Add("default_type"); // OPTIONAL - SMS / WPUSH / VCARD / PORT (default - SMS)
                tempDataTable.Columns.Add("default_costcentre"); // OPTIONAL - ""

                DataRow mainRow = tempDataTable.NewRow();
                mainRow["live"] = account.Settings.IsLive;
                mainRow["return_credits"] = account.Settings.ReturnCredits;
                mainRow["return_msgs_success_count"] = account.Settings.ReturnMessageSuccessCount;
                mainRow["return_msgs_failed_count"] = account.Settings.ReturnMessageFailedCount;
                mainRow["return_entries_success_status"] = account.Settings.ReturnEntriesSuccessStatus;
                mainRow["return_entries_failed_status"] = account.Settings.ReturnEntriesFailedStatus;
                mainRow["default_senderid"] = account.Settings.DefaultSender;
                mainRow["default_date"] = account.Settings.DefaultDate;
                mainRow["default_time"] = account.Settings.DefaultTime;
                mainRow["default_data1"] = account.Settings.DefaultText1;
                mainRow["default_data2"] = account.Settings.DefaultText2;
                mainRow["default_flash"] = account.Settings.Flash;
                mainRow["default_type"] = account.Settings.Type;
                mainRow["default_costcentre"] = account.Settings.CostCentre;

                tempDataTable.Rows.Add(mainRow);
                tempDataSet.Tables.Add(tempDataTable);

                dataSet = tempDataSet;

                tempDataTable = null;
                tempDataSet = null;
            }
            finally
            {
                if (tempDataTable != null)
                {
                    tempDataTable.Dispose();
                }
                if (tempDataSet != null)
                {
                    tempDataSet.Dispose();
                }
            }

            return dataSet;
        }