예제 #1
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;
            }
        }