示例#1
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;
            }
        }
示例#2
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;
            }
        }
示例#3
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;
            }
        }
示例#4
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;
            }
        }
示例#5
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;
            }
        }