Ejemplo n.º 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;
            }
        }