Esempio n. 1
0
        //public static void UpdateDeliveryStatus(long messageID, int deliveryStatus)
        //{
        //	Business.Sms smsController = new Business.Sms();
        //	smsController.UpdateDeliveryStatus(messageID, deliveryStatus);
        //}

        public static void UpdateDeliveryStatus(long[] messageIDs, long[] deliveryStatus)
        {
            Business.Sms smsController = new Business.Sms();
            Dictionary <long, List <long> > messageStatus = new Dictionary <long, List <long> >();
            string outerSystemMessageID = string.Empty;

            for (int i = 0; i < deliveryStatus.Length; i++)
            {
                if (!messageStatus.ContainsKey(deliveryStatus[i]))
                {
                    messageStatus.Add(deliveryStatus[i], new List <long>());
                }

                messageStatus[deliveryStatus[i]].Add(messageIDs[i]);
            }

            foreach (int state in messageStatus.Keys)
            {
                outerSystemMessageID = string.Empty;
                foreach (long smsID in messageStatus[state])
                {
                    outerSystemMessageID += string.Format("'{0}',", smsID);
                }

                smsController.UpdateDeliveryStatus(outerSystemMessageID.TrimEnd(','), state);
            }
        }
Esempio n. 2
0
        public static void GiveBackCreditToUser(Guid userGuid, SmsSendType smsSendType, Business.Operators operators,
                                                int smsPartCount, int encoding,
                                                int smsCount, Business.SmsSenderAgentReference agent, Guid smsSentGuid)
        {
            Business.Sms smsController = new Business.Sms();

            Business.SmsTypes smsType = encoding == (int)Business.Encoding.Utf8 ? Business.SmsTypes.Farsi : Business.SmsTypes.Latin;

            smsController.BeginTransaction();
            try
            {
                Transaction.IncreaseCostOfFaildSend(userGuid, smsSendType, operators, smsPartCount, smsType, smsCount, agent, smsSentGuid, smsController.DataAccessProvider);

                if (!smsController.UpdateBlackListSms(userGuid, smsSentGuid, agent, operators, smsPartCount, smsSendType, encoding))
                {
                    throw new Exception("ErrorRecord");
                }
                smsController.CommitTransaction();
            }
            catch (InnerTransactionException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                smsController.RollbackTransaction();
                throw ex;
            }
        }
Esempio n. 3
0
        public static void UpdateDeliveryStatus(string batchID, string[] numbers, int[] deliveryStatus)
        {
            Business.Sms smsController = new Business.Sms();
            Dictionary <int, List <string> > messageStatus = new Dictionary <int, List <string> >();

            for (int i = 0; i < deliveryStatus.Length; i++)
            {
                if (!messageStatus.ContainsKey(deliveryStatus[i]))
                {
                    messageStatus.Add(deliveryStatus[i], new List <string>());
                }

                messageStatus[deliveryStatus[i]].Add(numbers[i]);
            }

            foreach (int state in messageStatus.Keys)
            {
                string recievers = string.Empty;
                foreach (string number in messageStatus[state])
                {
                    recievers += string.Format("'{0}',", number);
                }

                smsController.UpdateDeliveryStatus(batchID, recievers.TrimEnd(','), state);
            }
        }
Esempio n. 4
0
        public static bool SendAdvancedSpecialGroupFutureSms(SmsSenderAgentReference smsSenderAgentRefrence, Guid userGuid, Guid smsSentGuid,
                                                             Guid sentboxGuid, string groupGuid, int downRange, int upRange, int smsPartCount, Encoding encoding)
        {
            Business.Sms      smsController = new Business.Sms();
            Business.SmsTypes smsType       = encoding == Business.Encoding.Utf8 ? Business.SmsTypes.Farsi : Business.SmsTypes.Latin;

            smsController.BeginTransaction();
            try
            {
                Dictionary <Business.Operators, int> operatorCountNumberDictionary = GeneralNumber.GetCountNumberOfOperators(groupGuid, downRange, upRange);

                //Transaction.DecreaseCostOfSmsSend(userGuid, Business.SmsSendType.SendAdvancedSpecialGroupFutureSms,
                //																	operatorCountNumberDictionary, smsPartCount, smsType, smsSenderAgentRefrence, smsSentGuid, smsController.DataAccessProvider);

                if (!smsController.SendAdvancedSpecialGroupFutureSms(sentboxGuid, groupGuid, downRange, upRange))
                {
                    throw new Exception(Language.GetString("ErrorRecord"));
                }

                smsController.CommitTransaction();
                return(true);
            }
            catch (InnerTransactionException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                smsController.RollbackTransaction();
                throw ex;
            }
        }
Esempio n. 5
0
        public static bool SendPostalCodeSms(SmsSenderAgentReference smsSenderAgentRefrence, Guid userGuid, Guid smsSentGuid,
                                             int recipientNumberCount, Guid sentboxGuid, int smsPartCount, Encoding encoding)
        {
            Business.Sms smsController = new Business.Sms();
            Dictionary <Business.Operators, int> operatorCountNumberDictionary = new Dictionary <Operators, int>();

            operatorCountNumberDictionary.Add(Operators.MCI, recipientNumberCount);

            Business.SmsTypes smsType = encoding == Business.Encoding.Utf8 ? Business.SmsTypes.Farsi : Business.SmsTypes.Latin;

            smsController.BeginTransaction();
            try
            {
                //Transaction.DecreaseCostOfSmsSend(userGuid, Business.SmsSendType.SendPostalCodeSms, operatorCountNumberDictionary,
                //																	smsPartCount, smsType, smsSenderAgentRefrence, smsSentGuid, smsController.DataAccessProvider);

                if (!smsController.SendPostalCodeSms(sentboxGuid))
                {
                    throw new Exception(Language.GetString("ErrorRecord"));
                }

                smsController.CommitTransaction();
                return(true);
            }
            catch (InnerTransactionException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                smsController.RollbackTransaction();
                throw ex;
            }
        }
Esempio n. 6
0
        public static DataTable GetUncertainDeleviryStatusSmsTable(Business.SmsSenderAgentReference smsSenderAgentRefrence)
        {
            Business.Sms smsController = new Business.Sms();
            List <long>  smsesInfoList = new List <long>();

            return(smsController.GetUncertainDeleviryStatusSms(smsSenderAgentRefrence));
        }
Esempio n. 7
0
        public static bool SendPeriodFutureSingleSms(SmsSenderAgentReference smsSenderAgentRefrence, Guid userGuid, Guid smsSentGuid, DateTime sendDateTime,
                                                     Guid sentboxGuid, string reciever, DateTime startDateTime, DateTime endDateTime,
                                                     int period, SmsSentPeriodType periodType, int smsPartCount, Encoding encoding)
        {
            Business.Sms      smsController = new Business.Sms();
            Business.SmsTypes smsType       = encoding == Business.Encoding.Utf8 ? Business.SmsTypes.Farsi : Business.SmsTypes.Latin;

            smsController.BeginTransaction();
            try
            {
                DateTime nextDateTime = Helper.AddDate(periodType.ToString(), period, sendDateTime);
                bool     sendIsFinish = false;
                if (nextDateTime > endDateTime)
                {
                    sendIsFinish = true;
                }

                List <string> lstNumbers = reciever.Split(',').ToList();
                Dictionary <Business.Operators, int> operatorCountNumberDictionary = GetCountNumberOfOperators(lstNumbers);

                //Transaction.DecreaseCostOfSmsSend(userGuid, Business.SmsSendType.SendPeriodFutureSingleSms,
                //																	operatorCountNumberDictionary, smsPartCount, smsType, smsSenderAgentRefrence, smsSentGuid, smsController.DataAccessProvider);

                XDocument doc  = new XDocument();
                XElement  root = new XElement("NewDataSet");

                foreach (string number in lstNumbers)
                {
                    XElement element = new XElement("Table");
                    element.Add(new XElement("Reciever", number));
                    root.Add(element);
                }
                doc.Add(root);


                if (!smsController.SendPeriodFutureSingleSms(sentboxGuid, doc.ToString(), nextDateTime, sendIsFinish))
                {
                    throw new Exception(Language.GetString("ErrorRecord"));
                }

                smsController.CommitTransaction();
                return(true);
            }
            catch (InnerTransactionException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                smsController.RollbackTransaction();
                throw ex;
            }
        }
Esempio n. 8
0
        public static List <long> GetUncertainDeleviryStatusSms(Business.SmsSenderAgentReference smsSenderAgentRefrence)
        {
            Business.Sms smsController = new Business.Sms();
            List <long>  smsesInfoList = new List <long>();
            DataTable    dtSmses       = smsController.GetUncertainDeleviryStatusSms(smsSenderAgentRefrence);

            foreach (DataRow item in dtSmses.Rows)
            {
                smsesInfoList.Add(Helper.GetLong(item["OuterSystemSmsID"]));
                smsesInfoList.Add(Helper.GetLong(item["DeliveryStatus"]));
            }
            return(smsesInfoList);
        }
Esempio n. 9
0
        public static void SendSmsForUsers(SmsSenderAgentReference smsSenderAgentRefrence, Guid userGuid,
                                           string userRoleGuid, Guid smsSentGuid, Guid sentboxGuid, string xmlSmsBody, bool decreaseFromUser, ref Guid SmsBodyGuid)
        {
            Business.Sms      smsController = new Business.Sms();
            Business.SmsTypes smsType;
            string            smsBody = string.Empty;

            try
            {
                DataView dvXmlSmsBody = new DataView(Helper.DeSerializeXml(xmlSmsBody));
                dvXmlSmsBody.RowFilter = string.Format(" CONVERT(SendDate,System.DateTime) <= '{0}' ", Helper.GetDateTimeForDB(DateTime.Now));

                for (int counterXmlNode = 0; counterXmlNode < dvXmlSmsBody.Count; counterXmlNode++)
                {
                    smsController.BeginTransaction();
                    try
                    {
                        smsBody     = dvXmlSmsBody[counterXmlNode]["SmsBody"].ToString();
                        SmsBodyGuid = Helper.GetGuid(dvXmlSmsBody[counterXmlNode]["Guid"]);
                        if (!decreaseFromUser)
                        {
                            Dictionary <Business.Operators, int> operatorCountNumberDictionary = User.GetCountRoleNumberOfOperators(userGuid, Helper.GetGuid(userRoleGuid));
                            smsType = Helper.HasUniCodeCharacter(smsBody) ? Business.SmsTypes.Farsi : Business.SmsTypes.Latin;
                            //Transaction.DecreaseCostOfSmsSend(userGuid, Business.SmsSendType.SendSmsForUsers,
                            //																	operatorCountNumberDictionary,
                            //																	Helper.GetSmsCount(smsBody),
                            //																	smsType, smsSenderAgentRefrence,
                            //																	smsSentGuid, smsController.DataAccessProvider);
                        }
                        //smsController.SendSmsForUsers(sentboxGuid, Helper.GetGuid(dvXmlSmsBody[counterXmlNode]["Guid"]), Helper.GetGuid(userRoleGuid),
                        //															decreaseFromUser, (int)Business.SmsSendType.SendSingleFutureSms);
                        smsController.CommitTransaction();
                    }
                    catch (InnerTransactionException ex)
                    {
                        throw ex;
                    }
                    catch (Exception ex)
                    {
                        smsController.RollbackTransaction();
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 10
0
        public static bool SendFutureSmsFormat(SmsSenderAgentReference smsSenderAgentRefrence, Guid userGuid, Guid smsSentGuid,
                                               Guid sentboxGuid, string groupGuid, Guid formatGuid, int smsPartCount, Encoding encoding)
        {
            Business.Sms smsController = new Business.Sms();
            Dictionary <Business.Operators, int> operatorCountNumberDictionary = new Dictionary <Operators, int>();

            Business.SmsTypes smsType;

            smsController.BeginTransaction();
            try
            {
                DataTable dataTableSmsInfo = Facade.PhoneNumber.GetCountNumberOfOperatorsForSendSmsFormat(formatGuid, groupGuid);

                foreach (DataRow row in dataTableSmsInfo.Rows)
                {
                    operatorCountNumberDictionary.Add((Business.Operators)Helper.GetInt(row["Operator"]), Helper.GetInt(row["Count"]));
                    smsType = Helper.GetInt(row["Encoding"]) == 1 ? Business.SmsTypes.Farsi : Business.SmsTypes.Latin;

                    //Transaction.DecreaseCostOfSmsSend(userGuid, Business.SmsSendType.SendFutureSmsFormat,
                    //																	operatorCountNumberDictionary,
                    //																	Helper.GetInt(row["SmsPartCount"]),
                    //																	smsType, smsSenderAgentRefrence, smsSentGuid, smsController.DataAccessProvider);
                    operatorCountNumberDictionary.Clear();
                }

                if (!smsController.SendFutureSmsFormat(sentboxGuid, groupGuid, formatGuid))
                {
                    throw new Exception("ErrorRecord");
                }

                smsController.CommitTransaction();
                return(true);
            }
            catch (InnerTransactionException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                smsController.RollbackTransaction();
                throw ex;
            }
        }
Esempio n. 11
0
        public static bool SendPeriodFutureGroupSms(SmsSenderAgentReference smsSenderAgentRefrence, Guid userGuid, Guid smsSentGuid,
                                                    string groupGuid, DateTime sendDateTime, Guid sentboxGuid, DateTime startDateTime, DateTime endDateTime,
                                                    int period, SmsSentPeriodType periodType, int smsPartCount, Encoding encoding)
        {
            Business.Sms      smsController = new Business.Sms();
            Business.SmsTypes smsType       = encoding == Business.Encoding.Utf8 ? Business.SmsTypes.Farsi : Business.SmsTypes.Latin;
            smsController.BeginTransaction();
            try
            {
                DateTime nextDateTime = Helper.AddDate(periodType.ToString(), period, sendDateTime);
                bool     sendIsFinish = false;
                if (nextDateTime > endDateTime)
                {
                    sendIsFinish = true;
                }

                Dictionary <Business.Operators, int> operatorCountNumberDictionary = PhoneNumber.GetCountNumberOfOperators(groupGuid, 0, 0, false);

                //Transaction.DecreaseCostOfSmsSend(userGuid, Business.SmsSendType.SendPeriodFutureGroupSms,
                //																	operatorCountNumberDictionary, smsPartCount, smsType, smsSenderAgentRefrence, smsSentGuid, smsController.DataAccessProvider);

                if (!smsController.SendPeriodFutureGroupSms(sentboxGuid, groupGuid, nextDateTime, sendIsFinish))
                {
                    throw new Exception(Language.GetString("ErrorRecord"));
                }

                smsController.CommitTransaction();
                return(true);
            }
            catch (InnerTransactionException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                smsController.RollbackTransaction();
                throw ex;
            }
        }
Esempio n. 12
0
 public static bool UpdateSmsSendInfo(string xmlSmsInfo)
 {
     Business.Sms smsController = new Business.Sms();
     return(smsController.UpdateSmsSendInfo(xmlSmsInfo));
 }
Esempio n. 13
0
 public static DataTable GetSentboxQueue(SmsSenderAgentReference smsSenderAgentRefrence, int agentQueueSize, int threadCount)
 {
     Business.Sms smsController = new Business.Sms();
     return(smsController.GetSentboxQueue(smsSenderAgentRefrence, agentQueueSize, threadCount));
 }
Esempio n. 14
0
 public static DataTable GetFailedSms(SmsSenderAgentReference smsSenderAgentRefrence, int count)
 {
     Business.Sms smsController = new Business.Sms();
     return(smsController.GetFailedSms(smsSenderAgentRefrence, count));
 }
Esempio n. 15
0
 public static void UpdateFailedSms(Common.Sms sms)
 {
     Business.Sms smsController = new Business.Sms();
     smsController.UpdateFailedSms(sms);
 }
Esempio n. 16
0
 public static DataTable GetBlackListNumber(Guid smsSentGuid, SmsSendError smsSendError)
 {
     Business.Sms smsController = new Business.Sms();
     return(smsController.GetBlackListNumber(smsSentGuid, smsSendError));
 }
Esempio n. 17
0
 public static DataSet GetCountSmsInPeriodDate(Guid userGuid)
 {
     Business.Sms smsController = new Business.Sms();
     return(smsController.GetCountSmsInPeriodDate(userGuid));
 }
Esempio n. 18
0
 public static DataTable GetPagedSmses(Common.Sms sms, Guid smsSenderAgentGuid, string userName, string senderNumber, string fromEffectiveDate, string fromTime, string toEffectiveDate, string toTime, int pageNo, int pageSize, string sortField, ref int resultCount)
 {
     Business.Sms smsController = new Business.Sms();
     return(smsController.GetPagedSmses(sms, smsSenderAgentGuid, userName, senderNumber, fromEffectiveDate, fromTime, toEffectiveDate, toTime, pageNo, pageSize, sortField, ref resultCount));
 }
Esempio n. 19
0
 public static void UpdateDeliveryStatus(long[][] deliveryStatus)
 {
     Business.Sms smsController = new Business.Sms();
     UpdateDeliveryStatus(deliveryStatus[0], deliveryStatus[1]);
 }
Esempio n. 20
0
 public static void InsertSms(Common.Sms sms)
 {
     Business.Sms smsController = new Business.Sms();
     smsController.Insert(sms);
 }
Esempio n. 21
0
 public static DataTable GetGiveBackCreditSms(SmsSenderAgentReference smsSenderAgentReference)
 {
     Business.Sms smsController = new Business.Sms();
     return(smsController.GetGiveBackCreditSms(smsSenderAgentReference));
 }