示例#1
0
        public bool SendBulkMessage(SMSMessage msg, bool immediate, out String status)
        {
            if (msg.id == 0)
            {
                //billable, bulkbillable, astStatus, batchID, status, nextPolled, pollCount
                msg.id = dh.SaveOutboundMessage(msg.id, msg.building, msg.customer, msg.number, msg.reference, msg.message, msg.billable, msg.bulkbillable, msg.sent, msg.sender, msg.astStatus,
                                                msg.batchID, msg.status, msg.nextPolled, msg.pollCount, msg.cbal, msg.smsType, out status);
            }
            else
            {
                dh.SaveOutboundMessage(msg.id, msg.building, msg.customer, msg.number, msg.reference, msg.message, msg.billable, msg.bulkbillable, msg.sent, msg.sender, msg.astStatus,
                                       msg.batchID, msg.status, msg.nextPolled, msg.pollCount, msg.cbal, msg.smsType, out status);
            }
            String bid = "";

            String[] numbers = msg.number.Split(new String[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            if (immediate)
            {
                foreach (String number in numbers)
                {
                    bool success = SendSMS(number, String.Format("{0}", msg.message), out status, out bid);
                    if (success)
                    {
                        msg.batchID += bid + ";";
                    }
                }
                dh.SaveOutboundMessage(msg.id, msg.building, msg.customer, msg.number, msg.reference, msg.message, msg.billable, msg.bulkbillable, msg.sent, msg.sender, msg.astStatus,
                                       msg.batchID, msg.status, msg.nextPolled, msg.pollCount, msg.cbal, msg.smsType, out status);
            }
            return(true);
        }