Example #1
0
        public static string processRequest(string httpParamters)
        {
            string appBase64Data            = null;
            string appContentType           = null;
            string _deployProcessorTypeName = null;
            long   requestDeployEventID     = 0L;

            string[] _inParams = httpParamters.Split(new char[]
            {
                '|'
            });
            string result;

            if (_inParams.Length % 2 != 0 || _inParams.Length < 4)
            {
                result = null;
            }
            else
            {
                DataTable _dTableEvent;
                if (OperationResult.Error == new TokensBusinessEventsDAO().loadDeployEventInfo(_inParams[1], out _dTableEvent))
                {
                    result = null;
                }
                else
                {
                    if (_dTableEvent.Rows.Count != 1)
                    {
                        result = null;
                    }
                    else
                    {
                        TokenCryptoData _tokenCryptoData = new TokensDAO().loadTokenCryptoData(_dTableEvent.Rows[0][0].ToString());
                        if (_tokenCryptoData.ID == null)
                        {
                            result = null;
                        }
                        else
                        {
                            if (OperationResult.Success != HttpDeployProcessor._processTokenEvents(_dTableEvent.Rows[0][0].ToString(), _dTableEvent.Rows[0][2].ToString(), httpParamters, out requestDeployEventID))
                            {
                                result = null;
                            }
                            else
                            {
                                new DeployTokenDAO().loadDeployProcessor(_dTableEvent.Rows[0][1].ToString(), _inParams[3].Trim(), out _deployProcessorTypeName);
                                if (_deployProcessorTypeName == null)
                                {
                                    new TokensBusinessEventsDAO().updateEventStatus(requestDeployEventID.ToString(), 1);
                                    result = null;
                                }
                                else
                                {
                                    try
                                    {
                                        IDeployToken _deployProcessor = DeployTokenFactory.LoadAssembly(_deployProcessorTypeName);
                                        if (OperationResult.Success == _deployProcessor.AssembleTokenApplication(BaseFunctions.HexDecoder(_tokenCryptoData.CryptoData.SupportCryptoData), out appContentType, out appBase64Data))
                                        {
                                            if (OperationResult.Success == SAFBaseFunctions.tokenEnable(_dTableEvent.Rows[0][2].ToString(), _dTableEvent.Rows[0][0].ToString(), null))
                                            {
                                                result = appContentType + "|" + appBase64Data;
                                                return(result);
                                            }
                                        }
                                        new TokensBusinessEventsDAO().updateEventStatus(requestDeployEventID.ToString(), 1);
                                        result = null;
                                    }
                                    catch (Exception ex)
                                    {
                                        SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESSDEPLOY", new string[]
                                        {
                                            "http://sfexpand.SAFDeploy.DEPLOYJ1JAVAINFOSRV.softfinanca.com/",
                                            Assembly.GetExecutingAssembly().FullName.ToString(),
                                            ex.ToString()
                                        });
                                        new TokensBusinessEventsDAO().updateEventStatus(requestDeployEventID.ToString(), 1);
                                        result = null;
                                    }
                                    finally
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
        /// <summary>
        /// </summary>
        /// <param name="httpParamters"></param>
        /// <returns></returns>
        public static string processRequest(string httpParamters)
        {
            string appBase64Data            = null;
            string appContentType           = null;
            string _deployProcessorTypeName = null;
            long   requestDeployEventID     = 0;

            DataTable    _dTableEvent;
            IDeployToken _deployProcessor = null;

            string[] _inParams = httpParamters.Split(new char[] { '|' });
            if (_inParams.Length % 2 != 0 || _inParams.Length < 4)
            {
                return(null);
            }

            if (OperationResult.Error == new TokensBusinessEventsDAO().loadDeployEventInfo(_inParams[1], out _dTableEvent))
            {
                return(null);
            }
            if (_dTableEvent.Rows.Count != 1)
            {
                return(null);
            }
            TokenCryptoData _tokenCryptoData = new TokensDAO().loadTokenCryptoData(_dTableEvent.Rows[0][0].ToString());

            if (_tokenCryptoData.ID == null)
            {
                return(null);
            }
            if (OperationResult.Success != _processTokenEvents(_dTableEvent.Rows[0][0].ToString(), _dTableEvent.Rows[0][2].ToString(), httpParamters, out requestDeployEventID))
            {
                return(null);
            }
            new DeployTokenDAO().loadDeployProcessor(_dTableEvent.Rows[0][1].ToString(), _inParams[3].Trim(), out _deployProcessorTypeName);
            if (_deployProcessorTypeName == null)
            {
                new TokensBusinessEventsDAO().updateEventStatus(requestDeployEventID.ToString(), (byte)1);
                return(null);
            }
            try
            {
                _deployProcessor = DeployTokenFactory.LoadAssembly(_deployProcessorTypeName);
                if (OperationResult.Success == _deployProcessor.AssembleTokenApplication(BaseFunctions.HexDecoder(_tokenCryptoData.CryptoData.SupportCryptoData), out appContentType, out appBase64Data))
                {
                    if (OperationResult.Success == SAFBaseFunctions.tokenEnable(_dTableEvent.Rows[0][2].ToString(), _dTableEvent.Rows[0][0].ToString(), null))
                    {
                        return(appContentType + "|" + appBase64Data);
                    }
                }

                new TokensBusinessEventsDAO().updateEventStatus(requestDeployEventID.ToString(), (byte)1);
                return(null);
            }
            catch
            {
                new TokensBusinessEventsDAO().updateEventStatus(requestDeployEventID.ToString(), (byte)1);
                return(null);
            }
            finally
            {
                _deployProcessor = null;
            }
        }