Пример #1
0
        public OfferResponseObject GetOffer(string keycode)
        {
            GetOfferRequest request = new GetOfferRequest(keycode, false);
            OfferResponseObject response = new OfferResponseObject();
            BaseResponse base_response = Gatekeeper.GetOffer(request);

            if (base_response.Messages.Count > 0)
            {
                response.ResponseCode = 100;
            }
            if (response.ResponseCode == 0)
            {
                GetMemberResponse member_response = base_response.TypedResponse as GetMemberResponse;
                response.RenewalOffers = member_response.RenewalOffers;
            }
            return response;
        }
Пример #2
0
        public static BaseResponse GetOffer(GetOfferRequest ahRequest)
        {
            string className = "SFGWrapper.Gatekeeper.GetOffer";
            BaseResponse baseResponse = new BaseResponse();
            try
            {
                using (GateKeeperService svc = new GateKeeperService())
                {
                    svc.Timeout = 20000; 
                    svc.Credentials = new System.Net.NetworkCredential(ahRequest.ServiceUsername, ahRequest.ServicePassword);
                    argtype sfgRequest = GateKeeperTranslators.TranslateToGetOfferRequest(ahRequest);
                    baseResponse = GateKeeperTranslators.GetOffer(svc.process_wsdl(sfgRequest));
                }
                if (baseResponse == null)
                {
                    baseResponse = new BaseResponse();
                    FatalErrorResponse fatalError = new FatalErrorResponse();
                    baseResponse.TypedResponse = fatalError;
                    baseResponse.Messages.Add(new Message("SFGFatalError"));
                }

            }
            catch (Exception ex)
            {
                baseResponse = new BaseResponse();
                FatalErrorResponse fatalError = new FatalErrorResponse();
                baseResponse.TypedResponse = fatalError;
                Message error = new Message("UnknownException");
                baseResponse.DebugStringLog.Add(ex.TargetSite.Name);
                baseResponse.DebugStringLog.Add(ex.Message);
                baseResponse.DebugStringLog.Add(ex.StackTrace);
                baseResponse.Messages.Add(error);
                EventLogger.LogError(className,
                    string.Format("Message: {0} \r\nStackTrace: {1}", ex.Message, ex.StackTrace));
            }
            return baseResponse;
        }