예제 #1
0
        internal static bool SelectLogonUser(ABUtil.ABCommandArgs AbArgs)
        {
            BCDWSProxy.SelectLogonRequest  selectLogon = new BCDWSProxy.SelectLogonRequest();
            BCDWSProxy.SelectLogonResponse response    = new BCDWSProxy.SelectLogonResponse();
            string selectLogonResult = "";
            bool   bLogonOK          = false;

            selectLogon.BarclaysBankAccountSettings = new BCDWSProxy.BarclaysBankAccountSettings();
            selectLogon.BarclaysBankAccountSettings.ApplicationID = ConfigurationManager.AppSettings["ApplicationID"];
            selectLogon.BarclaysBankAccountSettings.UserRequester = AbArgs.USERNT;
            selectLogon.BarclaysBankAccountSettings.ClientName    = AbArgs.SN_HOSTNAME;

            BCDWSProxy.BarclaysBTSSoapClient client = new BCDWSProxy.BarclaysBTSSoapClient();
            try
            {
                selectLogonResult          = client.SelectLogon(selectLogon.BarclaysBankAccountSettings, AbArgs.CUTILIZA, 0);
                response.SelectLogonResult = selectLogonResult;

                string sresponse  = response.SerializeToString();
                string _sresponse = sresponse.Replace("'1'", "1");

                bLogonOK = response.SelectLogonResult.Contains("status=\"0\"");

                WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapResponse, _sresponse, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
            }
            catch (Exception ex)
            {
                WriteLog.Log(System.Diagnostics.TraceLevel.Error, MultilinhasObjects.LogTypeName.WsSoapRequest, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                response = null;
            }

            return(bLogonOK);
        }
예제 #2
0
        public string GetMsgErroTATDescription(string msg, ABUtil.ABCommandArgs Abargs)
        {
            string outmsg = msg;

            try
            {
                WriteLog.Log(System.Diagnostics.TraceLevel.Info, LogTypeName.Internal, "GetMsgErroTATDescription", Abargs.USERNT, Abargs.SN_HOSTNAME);
                WriteLog.Log(System.Diagnostics.TraceLevel.Info, LogTypeName.Internal, msg, Abargs.USERNT, Abargs.SN_HOSTNAME);

                //Tabela de codigos de mensagem
                DataTable CodMsgs = GetCodMensagens(Abargs);

                if (CodMsgs != null && CodMsgs.Rows.Count > 0)
                {
                    //Encontra rows com descrição do codigo de erro
                    DataRow[] drs = CodMsgs.Select("CELEMTAB2 = '" + msg.PadLeft(3, '0') + "'");
                    if (drs.Count() > 0)
                    {
                        //Select first or default
                        outmsg = drs[0][1].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.Log(System.Diagnostics.TraceLevel.Error, LogTypeName.TAT2Request, ex, Abargs.USERNT, Abargs.SN_HOSTNAME);
            }

            return(outmsg);
        }
예제 #3
0
        public BCDWSProxy.LM35Transaction LM35Request(ABUtil.ABCommandArgs AbArgs, LM35_AssociacaoContasDO _LM35, string accao, bool pedido)
        {
            BCDWSProxy.LM35Transaction response = new BCDWSProxy.LM35Transaction();

            LM35.BarclaysBankAccountSettings = new BCDWSProxy.BarclaysBankAccountSettings();
            LM35.BarclaysBankAccountSettings.ApplicationID = ConfigurationManager.AppSettings["ApplicationID"];
            LM35.BarclaysBankAccountSettings.UserRequester = AbArgs.USERNT;
            LM35.BarclaysBankAccountSettings.ClientName    = AbArgs.SN_HOSTNAME;

            LM35.input              = new BCDWSProxy.LM35Input();
            LM35.input.caccao       = accao;
            LM35.input.pedido_dados = pedido;

            //LM35.input.cbalcao =
            LM35.input.cbalcaoml  = string.IsNullOrEmpty(_LM35.idmultilinha) ? "" : _LM35.idmultilinha.ToString().Substring(0, 3);
            LM35.input.cprodutoml = string.IsNullOrEmpty(_LM35.idmultilinha) ? "" : _LM35.idmultilinha.ToString().Substring(3, 3);
            LM35.input.cnumectaml = string.IsNullOrEmpty(_LM35.idmultilinha) ? "" : _LM35.idmultilinha.ToString().Substring(5, 6);
            LM35.input.cdigictaml = string.IsNullOrEmpty(_LM35.idmultilinha) ? "" : _LM35.idmultilinha.ToString().Substring(11, 1);

            LM35.input.cbalcao  = string.IsNullOrEmpty(_LM35.ncontado) ? "" : _LM35.ncontado.ToString().Substring(0, 3);
            LM35.input.cproduto = string.IsNullOrEmpty(_LM35.ncontado) ? "" : _LM35.ncontado.ToString().Substring(3, 3);
            LM35.input.cnumecta = string.IsNullOrEmpty(_LM35.ncontado) ? "" : _LM35.ncontado.ToString().Substring(5, 6);
            LM35.input.cdigicta = string.IsNullOrEmpty(_LM35.ncontado) ? "" : _LM35.ncontado.ToString().Substring(11, 1);

            //LM35.input.cproduto = _LM35.c
            LM35.input.zcliente = _LM35.Cliente.ToString();
            LM35.input.gnome    = _LM35.Nome;
            LM35.input.zsequen  = _LM35.zSeq;


            BCDWSProxy.BarclaysBTSSoapClient client = new BCDWSProxy.BarclaysBTSSoapClient();
            bool bRetry = false;

            atempt = 0;
            do
            {
                try
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapRequest, LM35.input.SerializeToString(), AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    response = client.LM35CONTASDOML(LM35.BarclaysBankAccountSettings, LM35.input);
                    string sresponse = response.SerializeToString();

                    WriteLog.Log(System.Diagnostics.TraceLevel.Error, LogTypeName.WsSoapRequest, sresponse, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    atempt++;
                }
                catch (Exception ex)
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.WsSoapResponse, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    response.Erro = new BCDWSProxy.TransactionError();
                    response.Erro.MensagemErro = tratamentoExcepcoes(ex, AbArgs, out bRetry);
                }
            } while (bRetry && atempt <= 1);

            return(response);
        }
예제 #4
0
        public BCDWSProxy.LM32Transaction LM32Request(ABUtil.ABCommandArgs AbArgs, LM32_PedidosContratoML _lm32, string accao, bool pedido)
        {
            BCDWSProxy.LM32Transaction response = new BCDWSProxy.LM32Transaction();

            LM32.BarclaysBankAccountSettings = new BCDWSProxy.BarclaysBankAccountSettings();
            LM32.BarclaysBankAccountSettings.ApplicationID = ConfigurationManager.AppSettings["ApplicationID"];
            LM32.BarclaysBankAccountSettings.UserRequester = AbArgs.USERNT;
            LM32.BarclaysBankAccountSettings.ClientName    = AbArgs.SN_HOSTNAME;

            LM32.input                  = new BCDWSProxy.LM32Input();
            LM32.input.btn_accept       = _lm32.btnAccept ? "S" : "N";
            LM32.input.btn_reject       = _lm32.btnReject ? "S" : "N";
            LM32.input.caccao           = accao;
            LM32.input.cbalcao          = _lm32.nBalcao.ToString();
            LM32.input.cbalcao_cidctrml = _lm32.txtidmultilinha_balcao;
            LM32.input.cdigictaml       = _lm32.idmultilinha.Length > 10 ? _lm32.idmultilinha.ToString().Substring(8, 1) : "";
            LM32.input.cnumectaml       = _lm32.idmultilinha.Length > 10 ? _lm32.idmultilinha.ToString().Substring(2, 6) : "";
            LM32.input.cprodutoml       = _lm32.idmultilinha.Length > 10 ? _lm32.idmultilinha.ToString().Substring(0, 2) : "";
            LM32.input.cprodml          = _lm32.ProductCode;
            LM32.input.csubprodml       = _lm32.SubProdutoCode;
            LM32.input.gbalcao          = _lm32.gBalcao;
            LM32.input.gcliente         = _lm32.Nome;
            LM32.input.gdescml          = _lm32.SubProductDescription;
            LM32.input.pedido_dados     = pedido;
            LM32.input.tppedido         = _lm32.TipoPedido;
            LM32.input.zcliente         = _lm32.Cliente.ToString();


            BCDWSProxy.BarclaysBTSSoapClient client = new BCDWSProxy.BarclaysBTSSoapClient();
            bool bRetry = false;

            atempt = 0;
            do
            {
                try
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapRequest, LM32.input.SerializeToString(), AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    response = client.LM32APROVACOESML(LM32.BarclaysBankAccountSettings, LM32.input);
                    string sresponse = response.SerializeToString();

                    WriteLog.Log(System.Diagnostics.TraceLevel.Error, LogTypeName.WsSoapRequest, sresponse, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    atempt++;
                }
                catch (Exception ex)
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.WsSoapResponse, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    response.Erro = new BCDWSProxy.TransactionError();
                    response.Erro.MensagemErro = tratamentoExcepcoes(ex, AbArgs, out bRetry);
                }
            } while (bRetry && atempt <= 1);


            return(response);
        }
예제 #5
0
        public DataTable GetCodMensagens(ABUtil.ABCommandArgs AbArgs)
        {
            try
            {
                DataTable CodMsgs = cache["CodigosMensagens"] as DataTable;

                WriteLog.Log(System.Diagnostics.TraceLevel.Info, LogTypeName.TAT2Request, "CodigosMensagens LM  - SYT05L", AbArgs.USERNT, AbArgs.SN_HOSTNAME);


                if (CodMsgs == null)
                {
                    //Vai lêr à tabela

                    OdbcConnection connection = new OdbcConnection(ConfigurationManager.ConnectionStrings["MASTERDB2LOCAL"].ConnectionString);
                    DataSet        ds         = new DataSet();

                    try
                    {
                        OdbcDataAdapter ad = new OdbcDataAdapter("SELECT CELEMTAB2, NELEMC01 FROM SYT05L WHERE CELEMTAB1 = 'LM' AND CELEMTAB3 = 'PO'", connection); //Tabela sistema SYT05
                        ad.Fill(ds);
                    }
                    finally
                    {
                        connection.Close();
                    }

                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.TAT2Request, "Setting cache for [CodigosMensagens]", AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    //Set Cache
                    CacheItemPolicy policy = new CacheItemPolicy();
                    policy.AbsoluteExpiration = DateTimeOffset.Now.AddDays(1);
                    cache.Set("CodigosMensagens", ds.Tables[0], policy);

                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.TAT2Request, "Retun value count: " + ds.Tables[0].Rows.Count, AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    return(ds.Tables[0]);
                }
                //Devolver valor em cache
                else
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.TAT2Request, "Cache found for [CodigosMensagens] : " + CodMsgs.Rows.Count, AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    return(CodMsgs);
                }
            }
            catch (Exception ex)
            {
                WriteLog.Log(System.Diagnostics.TraceLevel.Error, LogTypeName.TAT2Request, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                DataTable dt = new DataTable();

                return(dt);
            }
        }
예제 #6
0
        public DataTable GetProdutos(string connection, ABUtil.ABCommandArgs AbArgs)
        {
            try
            {
                DataTable Produtos = cache["Produtos"] as DataTable;

                WriteLog.Log(System.Diagnostics.TraceLevel.Info, LogTypeName.TAT2Request, "GetProdutos  - TB196 ", AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                //Vai lêr à tabela
                if (Produtos == null)
                {
                    OdbcConnection con = new OdbcConnection(connection);
                    DataSet        ds  = new DataSet();

                    try
                    {
                        OdbcDataAdapter ad = new OdbcDataAdapter("SELECT CELEMTAB1, GELEM30, NELEMC01, NELEMC02 FROM TB196 where NELEMC01 != '' AND NELEMC13 = 'S'  order by NELEMC01", con); //Tabela geral TB196
                        ad.Fill(ds);
                    }
                    finally
                    {
                        con.Close();
                    }

                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.TAT2Request, "Setting cache for [Produtos]", AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    //Set Cache
                    System.Runtime.Caching.CacheItemPolicy policy = new System.Runtime.Caching.CacheItemPolicy();
                    policy.AbsoluteExpiration = DateTimeOffset.Now.AddDays(1);
                    cache.Set("Produtos", ds.Tables[0], policy);

                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.TAT2Request, "Retun value count: " + ds.Tables[0].Rows.Count, AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    return(ds.Tables[0]);
                }
                //Devolver valor em cache
                else
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.TAT2Request, "Cache found for [Produtos] : " + Produtos.Rows.Count, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    return(Produtos);
                }
            }
            catch (Exception ex)
            {
                WriteLog.Log(System.Diagnostics.TraceLevel.Error, MultilinhasObjects.LogTypeName.TAT2Request, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                DataTable dt = new DataTable();

                return(dt);
            }
        }
예제 #7
0
        public BCDWSProxy.CL55Transaction CL55Request(ABUtil.ABCommandArgs AbArgs, int numerocliente, string accao, string tipoacesso, string tipoConsulta)
        {
            BCDWSProxy.CL55Transaction response = new BCDWSProxy.CL55Transaction();

            CL55.BarclaysBankAccountSettings = new BCDWSProxy.BarclaysBankAccountSettings();
            CL55.BarclaysBankAccountSettings.ApplicationID = ConfigurationManager.AppSettings["ApplicationID"];
            CL55.BarclaysBankAccountSettings.UserRequester = AbArgs.USERNT;
            CL55.BarclaysBankAccountSettings.ClientName    = AbArgs.SN_HOSTNAME;

            CL55.input              = new BCDWSProxy.CL55Input();
            CL55.input.caccao       = accao;
            CL55.input.zcliente     = numerocliente.ToString().PadLeft(7, '0');
            CL55.input.ctipcon      = Convert.ToInt64(tipoConsulta);
            CL55.input.cacesso      = tipoacesso;
            CL55.input.pedido_dados = false;


            BCDWSProxy.BarclaysBTSSoapClient client = new BCDWSProxy.BarclaysBTSSoapClient();
            bool bRetry = false;

            atempt = 0;
            do
            {
                try
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapRequest, CL55.input.SerializeToString(), AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    response = client.CL55ConsultaRelacoes(CL55.BarclaysBankAccountSettings, CL55.input);

                    string sresponse = response.SerializeToString();

                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapResponse, sresponse, AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    atempt++;
                }
                catch (Exception ex)
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Error, MultilinhasObjects.LogTypeName.WsSoapRequest, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    response.Erro = new BCDWSProxy.TransactionError();
                    response.Erro.MensagemErro = tratamentoExcepcoes(ex, AbArgs, out bRetry);
                }
            } while (bRetry && atempt <= 1);
            return(response);
        }
예제 #8
0
        public string GetSubProdDescriptionByCode(string productCode, string subProductCode, string connection, ABUtil.ABCommandArgs AbArgs)
        {
            WriteLog.Log(System.Diagnostics.TraceLevel.Info, MultilinhasObjects.LogTypeName.Internal, "GetSubProdDescriptionByCode", AbArgs.USERNT, AbArgs.SN_HOSTNAME);

            string    subproduto = "";
            DataTable produtos   = GetProdutos(connection, AbArgs);

            if (produtos != null && produtos.Rows.Count != 0)
            {
                //Encontra row com descrição do produto
                DataRow[] drs = produtos.Select("CELEMTAB1 = '" + productCode.ToUpper() + subProductCode.ToUpper() + "'");
                if (drs.Count() > 0)
                {
                    //Select first or default
                    subproduto = drs[0][1].ToString();
                }
            }
            return(subproduto);
        }
예제 #9
0
        public string GetBalcaoDesc(string codBalcao, string connection, ABUtil.ABCommandArgs AbArgs)
        {
            string desc = "";

            WriteLog.Log(System.Diagnostics.TraceLevel.Info, MultilinhasObjects.LogTypeName.Internal, "GetBalcaoDesc", AbArgs.USERNT, AbArgs.SN_HOSTNAME);

            DataTable balcoes = GetBalcoes(connection, AbArgs);

            if (balcoes != null && balcoes.Rows.Count > 0)
            {
                DataRow[] drs = balcoes.Select("CELEMTAB1 = '" + codBalcao.ToUpper() + "'");

                //select first
                if (drs.Count() > 0)
                {
                    desc = drs[0]["NELEMC01"].ToString();
                }
            }
            return(desc);
        }
예제 #10
0
        public List <string> GetSubProdByProdCode(string productCode, string connection, ABUtil.ABCommandArgs AbArgs)
        {
            List <string> subprods = new List <string>();

            WriteLog.Log(System.Diagnostics.TraceLevel.Info, MultilinhasObjects.LogTypeName.Internal, "GetSubProdByProdCode", AbArgs.USERNT, AbArgs.SN_HOSTNAME);

            DataTable produtos = GetProdutos(connection, AbArgs);

            if (produtos != null && produtos.Rows.Count != 0)
            {
                //Encontra row com subprodutos
                DataRow[] drs = produtos.Select("NELEMC01 = '" + productCode.ToUpper() + "'");

                for (int i = 0; i < drs.Length; i++)
                {
                    //adiciona apenas subproduto
                    string dr = drs[i]["NELEMC02"].ToString();
                    subprods.Add(dr);
                }
            }
            return(subprods);
        }
예제 #11
0
        public DateTime DataOperacao_Fechas(ABUtil.ABCommandArgs AbArgs, string balcao)
        {
            DateTime fechasdt = new DateTime();

            try
            {
                WriteLog.Log(System.Diagnostics.TraceLevel.Info, LogTypeName.TAT2Request, "DataOperacao_Fechas  - FECHAS", AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                //Vai lêr à tabela
                OdbcConnection connection = new OdbcConnection(ConfigurationManager.ConnectionStrings["MASTERDB2LOCAL"].ConnectionString);
                DataSet        ds         = new DataSet();

                try
                {
                    string          query = "SELECT FE_COD_BALCAO, FE_OPER FROM FECHAS WHERE FE_COD_BALCAO = " + balcao;
                    OdbcDataAdapter ad    = new OdbcDataAdapter(query, connection); //Tabela sistema DATAS
                    ad.Fill(ds);
                }
                finally
                {
                    connection.Close();
                }

                WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.TAT2Request, "Retun value count: " + ds.Tables[0].Rows.Count, AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                string dtacol = ds.Tables[0].Rows[0][1].ToString(); //coluna 1 da 1a linha

                //retorna data
                DateTime.TryParseExact(dtacol, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out fechasdt);
                return(fechasdt);
            }
            catch (Exception ex)
            {
                WriteLog.Log(System.Diagnostics.TraceLevel.Error, MultilinhasObjects.LogTypeName.TAT2Request, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                DataTable dt = new DataTable();

                return(fechasdt);
            }
        }
예제 #12
0
        public BCDWSProxy.LM38Transaction LM38Request(ABUtil.ABCommandArgs AbArgs, LM38_HistoricoAlteracoes _LM38, string accao, bool pedido)
        {
            BCDWSProxy.LM38Transaction response = new BCDWSProxy.LM38Transaction();

            LM38.BarclaysBankAccountSettings = new BCDWSProxy.BarclaysBankAccountSettings();
            LM38.BarclaysBankAccountSettings.ApplicationID = ConfigurationManager.AppSettings["ApplicationID"];
            LM38.BarclaysBankAccountSettings.UserRequester = AbArgs.USERNT;
            LM38.BarclaysBankAccountSettings.ClientName    = AbArgs.SN_HOSTNAME;


            LM38.input = new BCDWSProxy.LM38Input();
            LM38.input.pedido_dados = pedido;
            LM38.input.caccao       = accao;

            LM38.input.cbalcao  = string.IsNullOrEmpty(_LM38.idmultilinha.ToString()) ? "" : _LM38.idmultilinha.ToString().Substring(0, 3);
            LM38.input.cprod    = string.IsNullOrEmpty(_LM38.idmultilinha.ToString()) ? "" : _LM38.idmultilinha.ToString().Substring(3, 2);
            LM38.input.cta      = string.IsNullOrEmpty(_LM38.idmultilinha.ToString()) ? "" : _LM38.idmultilinha.ToString().Substring(5, 6);
            LM38.input.dgt      = string.IsNullOrEmpty(_LM38.idmultilinha.ToString()) ? "" : _LM38.idmultilinha.ToString().Substring(11, 1);
            LM38.input.zcliente = _LM38.Cliente.ToString();
            //LM38.input. = _LM38.Nome;


            List <BCDWSProxy.LM38Row1> lstRow1 = new List <BCDWSProxy.LM38Row1>();

            foreach (var f in _LM38.HistoricoAlteracoes)
            {
                BCDWSProxy.LM38Row1 _row1 = new BCDWSProxy.LM38Row1();
                _row1.caccao       = accao;
                _row1.pedido_dados = false;
                _row1.dprocess_l   = f.dataProcessamento.ToString("yyyyMMdd");
                _row1.dtaltera_l   = f.dataValorAlteracao.ToString("yyyyMMdd");
                // _row1.n = f.nContratoProduto;
                _row1.vanterior_l  = f.valorAnterior;
                _row1.gtipo_l      = f.TipoAlteracao;
                _row1.zaltera_l    = Convert.ToInt64(f.idAlteracao);
                _row1.gtipo_l      = f.campoAlterado;
                _row1.vposterior_l = f.valorPosterior;
                _row1.cutulmod_l   = f.utilizador;
            }

            //LM38.input.Row = lstRow1.ToArray();
            BCDWSProxy.BarclaysBTSSoapClient client = new BCDWSProxy.BarclaysBTSSoapClient();
            bool bRetry = false;

            atempt = 0;
            do
            {
                try
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapRequest, LM38.input.SerializeToString(), AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    response = client.LM38HISTORICOML(LM38.BarclaysBankAccountSettings, LM38.input);
                    string sresponse = response.SerializeToString();

                    WriteLog.Log(System.Diagnostics.TraceLevel.Error, LogTypeName.WsSoapRequest, sresponse, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    atempt++;
                }
                catch (Exception ex)
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.WsSoapResponse, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    response.Erro = new BCDWSProxy.TransactionError();
                    response.Erro.MensagemErro = tratamentoExcepcoes(ex, AbArgs, out bRetry);
                }
            } while (bRetry && atempt <= 1);

            return(response);
        }
예제 #13
0
        public BCDWSProxy.LM33Transaction LM33Request(ABUtil.ABCommandArgs AbArgs, LM33_ContratoML _lm33, string accao, string acesso, bool pedido)
        {
            BCDWSProxy.LM33Transaction response = new BCDWSProxy.LM33Transaction();

            LM33.BarclaysBankAccountSettings = new BCDWSProxy.BarclaysBankAccountSettings();
            LM33.BarclaysBankAccountSettings.ApplicationID = ConfigurationManager.AppSettings["ApplicationID"];
            LM33.BarclaysBankAccountSettings.UserRequester = AbArgs.USERNT;
            LM33.BarclaysBankAccountSettings.ClientName    = AbArgs.SN_HOSTNAME;

            LM33.input              = new BCDWSProxy.LM33Input();
            LM33.input.caccao       = accao;
            LM33.input.pedido_dados = pedido;
            LM33.input.acesso       = acesso;
            LM33.input.cbalcaoml    = string.IsNullOrEmpty(_lm33.idmultilinha) ? "" : _lm33.idmultilinha.ToString().Substring(0, 3);
            LM33.input.cprodutoml   = _lm33.Produtoml;
            LM33.input.cnumectaml   = string.IsNullOrEmpty(_lm33.idmultilinha) ? "" : _lm33.idmultilinha.ToString().Substring(5, 6);
            LM33.input.cdigictaml   = string.IsNullOrEmpty(_lm33.idmultilinha) ? "" : _lm33.idmultilinha.ToString().Substring(11, 1);
            LM33.input.ccontado     = _lm33.ncontado;
            LM33.input.csubprodml   = _lm33.Subprodutoml;
            LM33.input.dtfimcont    = _lm33.datafimcontrato.ToString("yyyy-MM-dd");
            LM33.input.dtinicont    = _lm33.datainiciocontrato.ToString("yyyy-MM-dd");
            LM33.input.dtprocess    = _lm33.dataProcessamento.ToString("yyyy-MM-dd");
            LM33.input.dproxgest    = _lm33.dataproximacobrancagestcontrato.ToString("yyyy-MM-dd");
            LM33.input.dproxrenov   = _lm33.dataproximacobrancagestrenovacao.ToString("yyyy-MM-dd");
            LM33.input.dtrenov      = _lm33.datarenovacao.ToString("yyyy-MM-dd");
            LM33.input.iestadoc     = _lm33.EstadoContrato != null?ML_Objectos.GetEstadosDoCatalogo().FirstOrDefault(x => x.Description.ToUpper() == _lm33.EstadoContrato.ToUpper()).Code : "";

            LM33.input.qgrau       = _lm33.graumorosidade.ToString();
            LM33.input.irenovac    = _lm33.IndRenovacao == true ? "S" : "N";
            LM33.input.idwf        = _lm33.idproposta;
            LM33.input.idenuncia   = _lm33.indicadorAcaoCancelamento == true ? "S" : "N";
            LM33.input.ienviocarta = _lm33.indicadorAcaoEnvioCartas == true ? "S" : "N";
            LM33.input.mlimglobal  = _lm33.limiteglobalmultilinha;
            LM33.input.mlimassin   = _lm33.sublimiteriscoAssinatura;
            LM33.input.mlimcomer   = _lm33.sublimitriscoComercial;
            LM33.input.mlimfinan   = _lm33.sublimiteriscoFinanceiro;
            LM33.input.qdiapaviso  = _lm33.NDiasPreAviso;
            LM33.input.qdiasincum  = _lm33.NDiasIncumprimento;
            LM33.input.zversao     = _lm33.NMinutaContrato;
            LM33.input.qperigest   = Convert.ToInt64(_lm33.PeriocidadeCobrancagestcontrato);
            LM33.input.qperirenov  = Convert.ToInt64(_lm33.PeriocidadeCobrancagestRenovacao);
            LM33.input.qprzcont    = _lm33.prazocontrato;
            LM33.input.qprzrenov   = _lm33.PrazoRenovacao;
            //LM33.input.tplriscass = _lm33.tipologiaRiscoA;
            //LM33.input.tplrisccom = _lm33.tipologiaRiscoC;
            //LM33.input.tplriscfin = _lm33.tipologiaRiscoF;
            LM33.input.comissabe   = _lm33.comissaoabertura;
            LM33.input.comissgct   = _lm33.comissaogestaocontrato;
            LM33.input.comissren   = _lm33.comissaorenovacao;
            LM33.input.vicomissabe = _lm33.valorimpostocomabert;
            LM33.input.vicomissgct = _lm33.valorimpostocomgestcontrato;
            LM33.input.vicomissren = _lm33.valorimpostocomgestrenovacao;
            LM33.input.zcliente    = _lm33.Cliente.ToString();
            LM33.input.bicomissabe = _lm33.baseincidenciacomabert;
            LM33.input.bicomissgct = _lm33.baseincidenciacomgestcontrato;
            LM33.input.bicomissren = _lm33.baseincidenciacomgestrenovacao;
            LM33.input.qminprod    = _lm33.NumeroMinimoProdutos;


            List <BCDWSProxy.LM33Row1> lstRow1 = new List <BCDWSProxy.LM33Row1>();


            foreach (var f in _lm33.produtosRiscoF)
            {
                BCDWSProxy.LM33Row1 _row1 = new BCDWSProxy.LM33Row1();

                _row1.l_cproduto_l   = f.prodsubproduto.Substring(0, 2);
                _row1.l_irisco_l     = f.tipologia;
                _row1.l_cfamprod_l   = f.familiaproduto;
                _row1.l_csubprod_l   = f.prodsubproduto.Substring(2, 2);
                _row1.l_iseleciona_l = f.selecionada == true? "S" : "N";
            }

            foreach (var a in _lm33.ProdutosRiscoAssinatura)
            {
                BCDWSProxy.LM33Row1 _row1 = new BCDWSProxy.LM33Row1();

                _row1.l_cproduto_l   = a.prodsubproduto.Substring(0, 2);
                _row1.l_irisco_l     = a.tipologia;
                _row1.l_cfamprod_l   = a.familiaproduto;
                _row1.l_csubprod_l   = a.prodsubproduto.Substring(2, 2);
                _row1.l_iseleciona_l = a.selecionada == true ? "S" : "N";
            }

            foreach (var c in _lm33.produtosRiscoC)
            {
                BCDWSProxy.LM33Row1 _row1 = new BCDWSProxy.LM33Row1();

                _row1.l_cproduto_l   = c.prodsubproduto.Substring(0, 2);
                _row1.l_irisco_l     = c.tipologia;
                _row1.l_cfamprod_l   = c.familiaproduto;
                _row1.l_csubprod_l   = c.prodsubproduto.Substring(2, 2);
                _row1.l_iseleciona_l = c.selecionada == true ? "S" : "N";
            }

            LM33.input.Row1 = lstRow1.ToArray();
            BCDWSProxy.BarclaysBTSSoapClient client = new BCDWSProxy.BarclaysBTSSoapClient();
            bool bRetry = false;

            atempt = 0;
            do
            {
                try
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapRequest, LM33.input.SerializeToString(), AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    response = client.LM33CONTRATOML(LM33.BarclaysBankAccountSettings, LM33.input);
                    string sresponse = response.SerializeToString();

                    WriteLog.Log(System.Diagnostics.TraceLevel.Error, LogTypeName.WsSoapRequest, sresponse, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    atempt++;
                }
                catch (Exception ex)
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.WsSoapResponse, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    response.Erro = new BCDWSProxy.TransactionError();
                    response.Erro.MensagemErro = tratamentoExcepcoes(ex, AbArgs, out bRetry);
                }
            } while (bRetry && atempt <= 1);

            return(response);
        }
예제 #14
0
        public BCDWSProxy.LM34Transaction LM34Request(ABUtil.ABCommandArgs AbArgs, LM34_SublimitesML _LM34, string accao, bool pedido)
        {
            BCDWSProxy.LM34Transaction response = new BCDWSProxy.LM34Transaction();

            LM34.BarclaysBankAccountSettings = new BCDWSProxy.BarclaysBankAccountSettings();
            LM34.BarclaysBankAccountSettings.ApplicationID = ConfigurationManager.AppSettings["ApplicationID"];
            LM34.BarclaysBankAccountSettings.UserRequester = AbArgs.USERNT;
            LM34.BarclaysBankAccountSettings.ClientName    = AbArgs.SN_HOSTNAME;

            LM34.input              = new BCDWSProxy.LM34Input();
            LM34.input.caccao       = accao;
            LM34.input.pedido_dados = pedido;

            LM34.input.cbalcaoml  = string.IsNullOrEmpty(_LM34.idmultilinha.ToString()) ? "" : _LM34.idmultilinha.ToString().Substring(0, 3);
            LM34.input.cprodutoml = _LM34.Produtoml;
            LM34.input.cnumectaml = string.IsNullOrEmpty(_LM34.idmultilinha.ToString()) ? "" : _LM34.idmultilinha.ToString().Substring(5, 6);
            LM34.input.cdigictaml = string.IsNullOrEmpty(_LM34.idmultilinha.ToString()) ? "" : _LM34.idmultilinha.ToString().Substring(11, 1);
            LM34.input.cbalcaoml  = string.IsNullOrEmpty(_LM34.ncontado) ? "" : _LM34.ncontado.Split('-')[0];
            //LM34.input.n = string.IsNullOrEmpty(_LM34.ncontado) ? "" : _LM34.ncontado.Split('-')[1].Replace("-", "").Trim().Substring(0, 2);
            //LM34.input.ctado = string.IsNullOrEmpty(_LM34.ncontado) ? "" : _LM34.ncontado.Split('-')[1].Replace("-", "").Trim().Substring(2, 6);
            //LM34.input.dgtdo = string.IsNullOrEmpty(_LM34.ncontado) ? "" : _LM34.ncontado.Split('-')[1].Replace("-", "").Trim().Substring(8, 1);
            LM34.input.csubprod  = _LM34.Subprodutoml;
            LM34.input.iestadoc  = _LM34.EstadoContrato;
            LM34.input.mlimtotal = _LM34.limiteglobalmultilinha;
            LM34.input.mlimassin = _LM34.sublimiteriscoAssinatura;
            LM34.input.mlimcomer = _LM34.sublimitriscoComercial;
            LM34.input.mlimfinan = _LM34.sublimiteriscoFinanceiro;
            LM34.input.zcliente  = _LM34.Cliente.ToString();
            LM34.input.isimula   = _LM34.idSimulacao.ToString();
            LM34.input.gnome     = _LM34.Nome;
            LM34.input.zcliente  = _LM34.Cliente.ToString();
            LM34.input.zsequen   = _LM34.zseq;

            //LM34.input.i = _LM34.idSimulacao.ToString();

            List <BCDWSProxy.LM34Row1> lstRow1 = new List <BCDWSProxy.LM34Row1>();

            foreach (var f in _LM34.produtosRiscoF)
            {
                BCDWSProxy.LM34Row1 _row1 = new BCDWSProxy.LM34Row1();

                _row1.l_irisco_l    = f.tipologia;
                _row1.l_famprod_l   = f.familiaproduto;
                _row1.l_mlimcomp_l  = f.sublimitecomprometido;
                _row1.l_mlimcont_l  = f.sublimiteContratado;
                _row1.l_mlimtotal_l = f.sublimiteAtual;
            }

            foreach (var a in _LM34.ProdutosRiscoAssinatura)
            {
                BCDWSProxy.LM34Row1 _row1 = new BCDWSProxy.LM34Row1();
                _row1.l_irisco_l    = a.tipologia;
                _row1.l_famprod_l   = a.familiaproduto;
                _row1.l_mlimcomp_l  = a.sublimitecomprometido;
                _row1.l_mlimcont_l  = a.sublimiteContratado;
                _row1.l_mlimtotal_l = a.sublimiteAtual;
            }

            foreach (var c in _LM34.produtosRiscoC)
            {
                BCDWSProxy.LM34Row1 _row1 = new BCDWSProxy.LM34Row1();
                _row1.l_irisco_l    = c.tipologia;
                _row1.l_famprod_l   = c.familiaproduto;
                _row1.l_mlimcomp_l  = c.sublimitecomprometido;
                _row1.l_mlimcont_l  = c.sublimiteContratado;
                _row1.l_mlimtotal_l = c.sublimiteAtual;
            }

            LM34.input.Row1 = lstRow1.ToArray();
            BCDWSProxy.BarclaysBTSSoapClient client = new BCDWSProxy.BarclaysBTSSoapClient();
            bool bRetry = false;

            atempt = 0;
            do
            {
                try
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapRequest, LM34.input.SerializeToString(), AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    response = client.LM34SUBLIMITESML(LM34.BarclaysBankAccountSettings, LM34.input);
                    string sresponse = response.SerializeToString();

                    WriteLog.Log(System.Diagnostics.TraceLevel.Error, LogTypeName.WsSoapRequest, sresponse, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    atempt++;
                }
                catch (Exception ex)
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.WsSoapResponse, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    response.Erro = new BCDWSProxy.TransactionError();
                    response.Erro.MensagemErro = tratamentoExcepcoes(ex, AbArgs, out bRetry);
                }
            } while (bRetry && atempt <= 1);

            return(response);
        }
예제 #15
0
        public BCDWSProxy.LM36Transaction LM36Request(ABUtil.ABCommandArgs AbArgs, LM36_ContratosProduto _LM36, LM36_ContratosProduto.ContratosProduto rotLM36, string accao, bool pedido)
        {
            BCDWSProxy.LM36Transaction response = new BCDWSProxy.LM36Transaction();

            LM36.BarclaysBankAccountSettings = new BCDWSProxy.BarclaysBankAccountSettings();
            LM36.BarclaysBankAccountSettings.ApplicationID = ConfigurationManager.AppSettings["ApplicationID"];
            LM36.BarclaysBankAccountSettings.UserRequester = AbArgs.USERNT;
            LM36.BarclaysBankAccountSettings.ClientName    = AbArgs.SN_HOSTNAME;


            LM36.input = new BCDWSProxy.LM36Input();
            LM36.input.pedido_dados = pedido;
            LM36.input.caccao       = accao;

            LM36.input.cbalcao    = string.IsNullOrEmpty(_LM36.idmultilinha.ToString()) ? "" : _LM36.idmultilinha.ToString().Substring(0, 3);
            LM36.input.cprodml    = string.IsNullOrEmpty(_LM36.idmultilinha.ToString()) ? "" : _LM36.idmultilinha.ToString().Substring(3, 2);
            LM36.input.cnumectaml = string.IsNullOrEmpty(_LM36.idmultilinha.ToString()) ? "" : _LM36.idmultilinha.ToString().Substring(5, 6);
            LM36.input.cdigictaml = string.IsNullOrEmpty(_LM36.idmultilinha.ToString()) ? "" : _LM36.idmultilinha.ToString().Substring(11, 1);
            LM36.input.csubprodml = _LM36.Subprodutoml;
            LM36.input.gdescml    = _LM36.Descritivo;
            LM36.input.mlimglobal = _LM36.limiteglobalmultilinha;
            LM36.input.mlimassin  = _LM36.sublimiteriscoAssinatura;
            LM36.input.mlimcomer  = _LM36.sublimitriscoComercial;
            LM36.input.mlimfinan  = _LM36.sublimiteriscoFinanceiro;
            LM36.input.zcliente   = _LM36.Cliente.ToString();
            LM36.input.gdescml    = _LM36.Nome;
            LM36.input.cgraumor   = _LM36.GrauMorosidade.ToString();
            LM36.input.iestado    = _LM36.EstadoContratoProduto;
            LM36.input.irisco     = _LM36.TipologiaRisco != "" ? ML_Objectos.GetTipologiasRisco().FirstOrDefault(x => x.Description == _LM36.TipologiaRisco).Code: "";
            try
            {
                LM36.input.cfamiprod = _LM36.FamiliaProduto != "" ? ArvoreFamiliaProdutos.SearchFamiliaProduto(_LM36.TipologiaRisco).FirstOrDefault(x => x.familiaProduto == _LM36.FamiliaProduto).codfamiliaProduto.ToString() : "";
            }
            catch
            {
            }
            LM36.input.dpd             = _LM36.DPD.ToString();
            LM36.input.gcliente        = _LM36.Nome;
            LM36.input.zcliente        = _LM36.Cliente.ToString();
            LM36.input.rot_ccontrprod  = rotLM36.NContratoProduto;
            LM36.input.rot_cfamiprod   = rotLM36.FamiliaProduto;
            LM36.input.rot_cgraumor    = rotLM36.GrauMorosidade;
            LM36.input.rot_cprodsubpml = rotLM36.SubProduto;
            LM36.input.rot_dpd         = rotLM36.DPD.ToString();
            LM36.input.rot_iestadocp   = rotLM36.EstadoContratoProduto;
            LM36.input.rot_irisco      = rotLM36.TipoRisco;
            LM36.input.rot_mexpoact    = rotLM36.ExposicaoAtual;
            LM36.input.rot_mvlrcompr   = rotLM36.ValorComprometido;
            LM36.input.rot_mvlrcontr   = rotLM36.ValorContratado;

            //List<BCDWSProxy.LM36Row1> lstRow1 = new List<BCDWSProxy.LM36Row1>();

            //foreach (var f in _LM36.ContratosProdutos)
            //{
            //    BCDWSProxy.LM36Row1 _row1 = new BCDWSProxy.LM36Row1();

            //    _row1.lista_ccontrprod_l = f.NContratoProduto;
            //    _row1.lista_cgraumor_l = f.GrauMorosidade;
            //    _row1.lista_cfamiprod_l = f.FamiliaProduto;
            //    _row1.lista_cprodsubpml_l = f.SubProduto;
            //    _row1.lista_dpd_l = f.DPD.ToString();
            //    _row1.lista_iestadocp_l = f.EstadoContratoProduto;
            //    _row1.lista_irisco_l = f.TipoRisco;
            //    _row1.lista_mexpoact_l = f.ExposicaoAtual;
            //    _row1.lista_mvlrcompr_l = f.ValorComprometido;
            //    _row1.lista_mvlrcontr_l = f.ValorContratado;


            //}

            //LM36.input. = lstRow1.ToArray();
            BCDWSProxy.BarclaysBTSSoapClient client = new BCDWSProxy.BarclaysBTSSoapClient();
            bool bRetry = false;

            atempt = 0;
            do
            {
                try
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapRequest, LM36.input.SerializeToString(), AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    response = client.LM36SUBPRODUTOSML(LM36.BarclaysBankAccountSettings, LM36.input);
                    string sresponse = response.SerializeToString();

                    WriteLog.Log(System.Diagnostics.TraceLevel.Error, LogTypeName.WsSoapRequest, sresponse, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    atempt++;
                }
                catch (Exception ex)
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.WsSoapResponse, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    response.Erro = new BCDWSProxy.TransactionError();
                    response.Erro.MensagemErro = tratamentoExcepcoes(ex, AbArgs, out bRetry);
                }
            } while (bRetry && atempt <= 1);

            return(response);
        }
예제 #16
0
        public BCDWSProxy.LM31Transaction LM31Request(ABUtil.ABCommandArgs AbArgs, LM31_CatalogoProdutoML _lm31, string accao, bool pedido)
        {
            BCDWSProxy.LM31Transaction response = new BCDWSProxy.LM31Transaction();

            LM31.BarclaysBankAccountSettings = new BCDWSProxy.BarclaysBankAccountSettings();
            LM31.BarclaysBankAccountSettings.ApplicationID = ConfigurationManager.AppSettings["ApplicationID"];
            LM31.BarclaysBankAccountSettings.UserRequester = AbArgs.USERNT;
            LM31.BarclaysBankAccountSettings.ClientName    = AbArgs.SN_HOSTNAME;

            LM31.input              = new BCDWSProxy.LM31Input();
            LM31.input.caccao       = accao;
            LM31.input.pedido_dados = pedido;
            LM31.input.cprodutoml   = _lm31.ProductCode;
            LM31.input.csubprodml   = _lm31.SubProdutoCode;
            //LM31.input.C = _lm31.SubProductDescription;
            LM31.input.dtinicomer = _lm31.DataInicioComercializacao.ToString("yyyy-MM-dd");
            LM31.input.dtfimcomer = _lm31.DataFimComercializacao.ToString("yyyy-MM-dd");;
            LM31.input.qprzminml  = _lm31.PrazoMinimo;
            LM31.input.qprzmaxml  = _lm31.PrazoMaximo;
            LM31.input.qminprod   = _lm31.NumeroMinimoProdutos;
            LM31.input.mlimminml  = _lm31.LimiteMinimoCredito;
            LM31.input.mlimmaxml  = _lm31.LimiteMaximoCredito;
            LM31.input.iestado    = _lm31.Estado != null?ML_Objectos.GetEstadosDoCatalogo().FirstOrDefault(x => x.Description.ToUpper() == _lm31.Estado.ToUpper()).Code : "";

            LM31.input.qdiaincum = _lm31.NDiasIncumprimento;
            LM31.input.irenovac  = _lm31.IndRenovacao != null?_lm31.IndRenovacao.ToString() : "N";

            LM31.input.qperigest  = Convert.ToInt32(_lm31.PeriocidadeCobranca);
            LM31.input.qprzrenov  = _lm31.PrazoRenovacao;
            LM31.input.qdiapaviso = _lm31.NDiasPreAviso;
            LM31.input.dtversao   = _lm31.DataVersao.ToString("yyyy-MM-dd");
            LM31.input.qperirnov  = Convert.ToInt32(_lm31.PeriocidadeCobComiRenovacao);

            List <BCDWSProxy.LM31Row1> lstRow1 = new List <BCDWSProxy.LM31Row1>();

            if (_lm31.produtosF != null)
            {
                foreach (var f in _lm31.produtosF)
                {
                    BCDWSProxy.LM31Row1 _row1 = new BCDWSProxy.LM31Row1();
                    _row1.caccao        = accao;
                    _row1.pedido_dados  = false;
                    _row1.l_cproduto_l  = f.produto;
                    _row1.l_tiporisco_l = f.tipologia;
                    _row1.l_famiprod_l  = f.familia.PadLeft(3, '0');
                    _row1.l_csubprod_l  = f.subproduto;

                    lstRow1.Add(_row1);
                }
            }

            if (_lm31.produtosA != null)
            {
                foreach (var a in _lm31.produtosA)
                {
                    BCDWSProxy.LM31Row1 _row1 = new BCDWSProxy.LM31Row1();
                    _row1.caccao        = accao;
                    _row1.pedido_dados  = false;
                    _row1.l_cproduto_l  = a.produto;
                    _row1.l_tiporisco_l = a.tipologia;
                    _row1.l_famiprod_l  = a.familia.PadLeft(3, '0');
                    _row1.l_csubprod_l  = a.subproduto;

                    lstRow1.Add(_row1);
                }
            }

            if (_lm31.produtosC != null)
            {
                foreach (var c in _lm31.produtosC)
                {
                    BCDWSProxy.LM31Row1 _row1 = new BCDWSProxy.LM31Row1();
                    _row1.caccao        = accao;
                    _row1.pedido_dados  = false;
                    _row1.l_cproduto_l  = c.produto;
                    _row1.l_tiporisco_l = c.tipologia;
                    _row1.l_famiprod_l  = c.familia.PadLeft(3, '0');
                    _row1.l_csubprod_l  = c.subproduto;

                    lstRow1.Add(_row1);
                }
            }

            LM31.input.Row1 = lstRow1.ToArray();
            BCDWSProxy.BarclaysBTSSoapClient client = new BCDWSProxy.BarclaysBTSSoapClient();
            bool bRetry = false;

            atempt = 0;
            do
            {
                try
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapRequest, LM31.input.SerializeToString(), AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    response = client.LM31CATALOGOML(LM31.BarclaysBankAccountSettings, LM31.input);
                    string sresponse = response.SerializeToString();

                    WriteLog.Log(System.Diagnostics.TraceLevel.Error, LogTypeName.WsSoapRequest, sresponse, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    atempt++;
                }
                catch (Exception ex)
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.WsSoapResponse, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    response.Erro = new BCDWSProxy.TransactionError();
                    response.Erro.MensagemErro = tratamentoExcepcoes(ex, AbArgs, out bRetry);
                }
            } while (bRetry && atempt <= 1);

            return(response);
        }
예제 #17
0
        public BCDWSProxy.LM37Transaction LM37Request(ABUtil.ABCommandArgs AbArgs, LM37_SimulacaoMl _LM37, string accao, bool pedido)
        {
            BCDWSProxy.LM37Transaction response = new BCDWSProxy.LM37Transaction();

            LM37.BarclaysBankAccountSettings = new BCDWSProxy.BarclaysBankAccountSettings();
            LM37.BarclaysBankAccountSettings.ApplicationID = ConfigurationManager.AppSettings["ApplicationID"];
            LM37.BarclaysBankAccountSettings.UserRequester = AbArgs.USERNT;
            LM37.BarclaysBankAccountSettings.ClientName    = AbArgs.SN_HOSTNAME;


            LM37.input = new BCDWSProxy.LM37Input();
            LM37.input.pedido_dados = pedido;
            LM37.input.caccao       = accao;
            if (_LM37.idmultilinha != null)
            {
                LM37.input.cbalcao = string.IsNullOrEmpty(_LM37.idmultilinha.ToString()) ? "" : _LM37.idmultilinha.ToString().Substring(0, 3);
                LM37.input.ccta    = string.IsNullOrEmpty(_LM37.idmultilinha.ToString()) ? "" : _LM37.idmultilinha.ToString().Substring(5, 6);
                LM37.input.cdgt    = string.IsNullOrEmpty(_LM37.idmultilinha.ToString()) ? "" : _LM37.idmultilinha.ToString().Substring(11, 1);
            }

            LM37.input.lcmv3700_cprod = _LM37.Produtoml;
            LM37.input.csubprdml      = _LM37.Subprodutoml;
            LM37.input.gdescml        = _LM37.Descritivo;
            LM37.input.mlmglbmlatual  = _LM37.limiteglobalmultilinha;
            LM37.input.msublmraatual  = _LM37.sublimiteriscoAssinatura;
            LM37.input.msublmrcatual  = _LM37.sublimitriscoComercial;
            LM37.input.msublmrfatual  = _LM37.sublimiteriscoFinanceiro;

            LM37.input.mlmglbmlnovo  = _LM37.limiteglobalmultilinhaNovo;
            LM37.input.mlmglbmltotal = _LM37.limiteglobalmultilinhaTotal;
            LM37.input.msublmranovo  = _LM37.sublimiteriscoAssinaturaNovo;
            LM37.input.msublmratotal = _LM37.sublimiteriscoAssinaturaTotal;
            LM37.input.msublmrcnovo  = _LM37.sublimitriscoComercialNovo;
            LM37.input.msublmrctotal = _LM37.sublimitriscoComercialTotal;
            LM37.input.msublmrfnovo  = _LM37.sublimiteriscoFinanceiroNovo;
            LM37.input.msublmrftotal = _LM37.sublimiteriscoFinanceiroTotal;
            LM37.input.zcliente      = _LM37.Cliente.ToString();
            LM37.input.gdescml       = _LM37.Nome;
            LM37.input.ctpsimulml    = _LM37.tipoSimulacao;


            List <BCDWSProxy.LM37Row1> lstRow1 = new List <BCDWSProxy.LM37Row1>();

            foreach (var f in _LM37.SimulacaoSublimites)
            {
                if (f.cons_Balcao != null || f.FamiliaProduto != null)
                {
                    BCDWSProxy.LM37Row1 _row1 = new BCDWSProxy.LM37Row1();
                    _row1.caccao            = accao;
                    _row1.pedido_dados      = false;
                    _row1.ntplprod_l        = f.FamiliaProduto;
                    _row1.ntprisco_l        = f.TipologiaRisco;
                    _row1.ccodtpl_l         = f.CodigoTipologia; //com 4
                    _row1.mpexpoatual_l     = f.ExposicaoAtual;
                    _row1.mpsublmcompnovo_l = f.SublimiteComprometidoNovo;
                    _row1.msublmcompatual_l = f.SublimiteComprometido;
                    _row1.msublmcontr_l     = f.SublimiteContratado;
                    _row1.nindpreco_l       = f.preco ? "S" : "N";

                    _row1.cons_cbalcao_l = f.cons_Balcao;
                    if (f.cons_idMultilinha != null)
                    {
                        _row1.cons_ccta_l  = string.IsNullOrEmpty(f.cons_idMultilinha.ToString()) ? "" : f.cons_idMultilinha.ToString().Substring(5, 6);
                        _row1.cons_cdgt_l  = string.IsNullOrEmpty(f.cons_idMultilinha.ToString()) ? "" : f.cons_idMultilinha.ToString().Substring(11, 1);
                        _row1.cons_cprod_l = string.IsNullOrEmpty(f.cons_idMultilinha.ToString()) ? "" : f.cons_idMultilinha.ToString().Substring(3, 2);
                    }
                    _row1.cons_cidsimulml_l = f.cons_idSimulacao.ToString();
                    _row1.cons_cprodsubp_l  = f.cons_ProdSub;
                    _row1.cons_cutulcria_l  = f.cons_utilizador;
                    _row1.cons_dsimulml_l   = f.cons_DataSimulacao.ToString("yyyyMMdd");
                    _row1.cons_mlmglbml_l   = f.cons_limiteML;
                    _row1.cons_msublmra_l   = f.cons_limiteRA;
                    _row1.cons_msublmra_l   = f.cons_limiteRA;
                    _row1.cons_msublmrc_l   = f.cons_limiteRC;
                    _row1.cons_msublmrf_l   = f.cons_limiteRF;
                    _row1.cons_zcliente_l   = f.cons_Cliente;
                }
            }

            LM37.input.Row1 = lstRow1.ToArray();
            BCDWSProxy.BarclaysBTSSoapClient client = new BCDWSProxy.BarclaysBTSSoapClient();
            bool bRetry = false;

            atempt = 0;
            do
            {
                try
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, MultilinhasObjects.LogTypeName.WsSoapRequest, LM37.input.SerializeToString(), AbArgs.USERNT, AbArgs.SN_HOSTNAME);

                    response = client.LM37SIMULACAOML(LM37.BarclaysBankAccountSettings, LM37.input);
                    string sresponse = response.SerializeToString();

                    WriteLog.Log(System.Diagnostics.TraceLevel.Error, LogTypeName.WsSoapRequest, sresponse, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    atempt++;
                }
                catch (Exception ex)
                {
                    WriteLog.Log(System.Diagnostics.TraceLevel.Verbose, LogTypeName.WsSoapResponse, ex, AbArgs.USERNT, AbArgs.SN_HOSTNAME);
                    response.Erro = new BCDWSProxy.TransactionError();
                    response.Erro.MensagemErro = tratamentoExcepcoes(ex, AbArgs, out bRetry);
                }
            } while (bRetry && atempt <= 1);

            return(response);
        }