Exemplo n.º 1
0
        protected override RequestErrorType RecievedRequest(IDataAdapter httpRequestLog, SPChannelWrapper channel, out bool requestOK, out string errorMessage)
        {
            RequestType requestType = channel.GetRequestType(httpRequestLog);

            RequestErrorType requestError = RequestErrorType.NoError;

            errorMessage = "";

            requestOK = false;

            int feetime = Convert.ToInt32(channel.GetFeetime(httpRequestLog));

            string linkid = channel.GetLinkID(httpRequestLog);

            bool statusOk = true;

            if (requestType == RequestType.DataStatusReport)
            {
                statusOk = channel.GetStatus(httpRequestLog);
            }

            if (statusOk == false)
            {
                requestOK = true;
                return requestError;
            }

            for (int i = 0; i < feetime; i++)
            {
                IDataAdapter request = new HttpGetPostAdapter(httpRequestLog);

                string linkidKey = channel.ChannelParams[DictionaryConst.Dictionary_SPField_LinkID_Key];

                if (request.RequestParams.ContainsKey(linkidKey))
                {
                    request.RequestParams[linkidKey] = linkid + "-" + i.ToString();
                }
                else
                {
                    request.RequestParams.Add(linkidKey, linkid + "-" + i.ToString());
                }

                string feeTimeKey = channel.ChannelParams[DictionaryConst.Dictionary_SPField_FeeTime_Key];

                if (request.RequestParams.ContainsKey(feeTimeKey))
                {
                    request.RequestParams[feeTimeKey] = feetime.ToString();
                }
                else
                {
                    request.RequestParams.Add(feeTimeKey, feetime.ToString());
                }

                requestOK = channel.ProcessRequest(request, statusOk, out requestError, out errorMessage);
            }

            return requestError;
        }
        protected override RequestErrorType RecievedRequest(IDataAdapter httpRequestLog, SPChannelWrapper channel,
                                                            out bool requestOK, out string errorMessage)
        {
            RequestType requestType = channel.GetRequestType(httpRequestLog);

            RequestErrorType requestError = RequestErrorType.NoError;

            errorMessage = "";

            requestOK = false;

            if (requestType == RequestType.DataReport)
            {
                bool statusOk = true;

                if (channel.IsStateReport &&
                    (channel.StateReportType == DictionaryConst.Dictionary_ChannelStateReportType_SendTwiceTypeRequest_Key ||
                     channel.StateReportType == DictionaryConst.Dictionary_ChannelStateReportType_SendTwice_Key))
                {
                    statusOk = false;
                }

                requestOK = channel.ProcessRequest(httpRequestLog, statusOk, out requestError, out errorMessage);
            }
            else if (requestType == RequestType.StatusReport)
            {
                bool statusOk = channel.GetStatus(httpRequestLog);

                requestOK = channel.ProcessStatusReport(httpRequestLog, statusOk, out requestError, out errorMessage);
            }
            else if (requestType == RequestType.DataStatusReport)
            {
                bool statusOk = channel.GetStatus(httpRequestLog);

                requestOK = channel.ProcessRequest(httpRequestLog, statusOk, out requestError, out errorMessage);
            }
            return(requestError);
        }
        protected override RequestErrorType RecievedRequest(IDataAdapter httpRequestLog, SPChannelWrapper channel, out bool requestOK, out string errorMessage)
        {
            RequestType requestType = channel.GetRequestType(httpRequestLog);

            RequestErrorType requestError = RequestErrorType.NoError;

            errorMessage = "";

            requestOK = false;

            int feetime = Convert.ToInt32(channel.GetFeetime(httpRequestLog));

            string linkid = channel.GetLinkID(httpRequestLog);

            bool statusOk = true;


            if (requestType == RequestType.DataStatusReport)
            {
                statusOk = channel.GetStatus(httpRequestLog);
            }

            if (statusOk == false)
            {
                requestOK = true;
                return(requestError);
            }


            for (int i = 0; i < feetime; i++)
            {
                IDataAdapter request = new HttpGetPostAdapter(httpRequestLog);

                string linkidKey = channel.ChannelParams[DictionaryConst.Dictionary_SPField_LinkID_Key];

                if (request.RequestParams.ContainsKey(linkidKey))
                {
                    request.RequestParams[linkidKey] = linkid + "-" + i.ToString();
                }
                else
                {
                    request.RequestParams.Add(linkidKey, linkid + "-" + i.ToString());
                }

                string feeTimeKey = channel.ChannelParams[DictionaryConst.Dictionary_SPField_FeeTime_Key];

                if (request.RequestParams.ContainsKey(feeTimeKey))
                {
                    request.RequestParams[feeTimeKey] = feetime.ToString();
                }
                else
                {
                    request.RequestParams.Add(feeTimeKey, feetime.ToString());
                }


                requestOK = channel.ProcessRequest(request, statusOk, out requestError, out errorMessage);
            }

            return(requestError);
        }