/// <summary>
        /// This method discovers which SqlStatementBas to use and returns its
        /// underlying index. 999999 out of 1000000 it will be 0.
        /// </summary>
        /// <param name="icomsStatement"></param>
        /// <returns></returns>
        protected int getIcomsStatementIndex(Response.SQLSTMNT icomsStatement)
        {
            // if there is only 1, then return the 0 offset.
            //if (icomsStatement.SQLSTMNTBAS.Length == 1) return 0;

            //int i = 0, processControlId = 0, basProcessControlId = 0;
            //int length = icomsStatement.SQLSTMNTBAS.Length;
            //for (; i < length; i++)
            //{
            //    Response.SQLSTMNTBAS bas = icomsStatement.SQLSTMNTBAS[i];
            //    try { basProcessControlId = Convert.ToInt32(bas.PRCSSCNTRL); }
            //    catch { basProcessControlId = 0; }
            //    if (basProcessControlId > processControlId)
            //    {
            //        processControlId = basProcessControlId;
            //    }
            //}
            //return i;
            // Return below added due to the changes in this version of ICOMS
            return(0);
        }
Esempio n. 2
0
        /// <summary>
        /// Turn off EasyPay (Recurring Payments for the specified account.
        /// </summary>
        public void DeactivateRecurring()
        {
            // setup logging
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.DeactivateRecurring,
                this.m_can.AccountNumber16);

            using (Log log = CreateLog(logEntry))
            {
                // declare needed variables
                int intStatementCode = 0, intMopAccountSequence = 0, intMopCode = 0;
                // no need to wrap in try/catch (its already been validated).
                int intAccountStatementCode = int.Parse(m_can.StatementCode);
                // set the siteId information
                logEntry.SiteId = SiteId;

                try
                {
                    // execute ACSUM to get needed information
                    Response.ACSUM acsumOutput = (Response.ACSUM)Invoke((Request.ACSUM)
                                                                        new AcsumHelper(SiteId.ToString(), m_can.AccountNumber9));

                    // format the output
                    if (acsumOutput.Items != null)
                    {
                        // we need to look for the correct statement.
                        foreach (object item in acsumOutput.Items)
                        {
                            if (item is Response.SQLSTMNT)
                            {
                                // cast to correct type.
                                Response.SQLSTMNT icomsStatement = (Response.SQLSTMNT)item;

                                // now convert statementCode to an integer.
                                int intLocalStatementCode = 0;
                                try{ intLocalStatementCode = int.Parse(icomsStatement.STMNTCD); }
                                catch { /*don't care*/ }

                                // if we did not find the correct statement code then break now.
                                if (intLocalStatementCode == intAccountStatementCode)
                                {
                                    // set this.
                                    intStatementCode = intLocalStatementCode;
                                    try{ intMopAccountSequence = int.Parse(icomsStatement.SQLSTMNTBAS[0].MOPACNTSQNC); }
                                    catch { /*don't care*/ }

                                    try{ intMopCode = int.Parse(icomsStatement.SQLSTMNTBAS[0].MOPCD); }
                                    catch { /*don't care*/ }
                                    break;
                                }
                            }
                        }
                    }

                    // now let's validate to see if we found the statement.
                    if (intStatementCode == 0)
                    {
                        throw new InvalidStatementCodeException();
                    }

                    // if we have a statementCode but no MopCode, then recurring
                    // payments are not setup and there is no point in going further
                    if (intMopCode != 0)
                    {
                        // Build input elements
                        Request.INL00076 inl76 = new INL00076Helper(intMopCode,
                                                                    intMopAccountSequence, intStatementCode);

                        // build mac27 call.
                        Request.MAC00027 mac27 = new Mac00027Helper(SiteId.ToString(),
                                                                    m_can.AccountNumber9, CmConstant.kstrDefaultTaskCode, inl76);

                        // now invoke.
                        this.Invoke((Request.MAC00027)mac27);
                    }
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                }
            }
        }