public BaseResponse GetMemberProfile(string memberId, bool debug)
        {
            methodName = "GetMemberProfile";
            LogMethodEntry(methodName);
            try
            {
                #region validate input
                // All params are required 
                if (memberId.Trim() == "")
                {
                    baseResponse.Messages.Add(new Message("ImproperValidationCriteriaException"));
                    return baseResponse;
                }
                #endregion

                GetMemberByMemberIdRequest request = new GetMemberByMemberIdRequest(memberId.Trim(), debug);
                baseResponse = Gatekeeper.GetMemberByMemberId(request);
            }
            catch (Exception ex)
            {
                LogMethodError(methodName, ex);
            }
            LogMethodExit(methodName);
            return baseResponse;
        }                
Exemplo n.º 2
0
        public static BaseResponse GetMemberByMemberId(GetMemberByMemberIdRequest ahRequest)
        {
            string className = "SFGWrapper.Gatekeeper.GetMemberByMemberId";
            BaseResponse baseResponse = new BaseResponse();
            try
            {
                using (GateKeeperService svc = new GateKeeperService())
                {
                    svc.Timeout = 20000;
                    System.Net.ServicePointManager.Expect100Continue = false;
                    svc.Credentials = new System.Net.NetworkCredential(ahRequest.ServiceUsername, ahRequest.ServicePassword);
                    argtype sfgRequest = GateKeeperTranslators.TranslateToGetMemberByMemberIdRequest(ahRequest);
                    baseResponse = GateKeeperTranslators.GetMemberByMemberId(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;
        }
Exemplo n.º 3
0
 private bool SyncMembership(string enc_username)
 {
     tbl_Customer customer = new tbl_Customer(Cryptography.Decrypt256FromHEX(enc_username), true);
     GetMemberByMemberIdRequest req = new GetMemberByMemberIdRequest(customer.SfgId.ToString(), false);
     BaseResponse res = Gatekeeper.GetMemberByMemberId(req);
     if (res.Messages.Count() <= 0 && res.TypedResponse != null)
     {
         GetMemberResponse tres = (GetMemberResponse)res.TypedResponse;
         if (tres.MemberData != null
             && tres.MemberData.Subscriptions != null
             && tres.MemberData.Subscriptions.Count() > 0)
         {
             Subscription current = null;
             foreach (Subscription sub in tres.MemberData.Subscriptions)
             {
                 if (current == null)
                 {
                     current = sub;
                 }
                 else if ((sub.StatusFlag == "P" || sub.StatusFlag == "O") && !sub.IsDonor)
                 {
                     try
                     {
                         if (DateTime.Parse(sub.ExpireDate).CompareTo(DateTime.Parse(current.ExpireDate)) > 0)
                         {
                             current = sub;
                         }
                     }
                     catch { }
                 }
             }
             //update netmembership, with latest from sfg
             tbl_NetMembership currentmembership = tbl_NetMembership.GetCurrentNetMembership(customer.cusID);
             if (currentmembership == null) { currentmembership = new tbl_NetMembership(); }
             currentmembership.cusID = customer.cusID;
             currentmembership.mtyCode = HarperLINQ.SFG_ProdCode.GetFromExtCode(current.PublicationCode).IntCode;
             currentmembership.nmbDateCreated = DateTime.Now;
             currentmembership.nmbDateEnd = DateTime.Parse(current.ExpireDate);
             currentmembership.nmbDateStart = DateTime.Parse(current.DateEntered);
             currentmembership.Save();
             return true;
         }
     }
     return false;
 }
 public BaseResponse GetSubscriptionOffers(string memberId, bool debug)
 {
     methodName = "GetSubscriptionOffers";
     LogMethodEntry(methodName);
     try
     {
         if (memberId.Trim() == "")
         {
             baseResponse.Messages.Add(new Message("ImproperValidationCriteriaException"));
             return baseResponse;
         }
         GetMemberByMemberIdRequest request = new GetMemberByMemberIdRequest(memberId.Trim(), debug);
         request.LoadRenewalOffers = true;
         request.OffersKeyCode = "E000764";
         baseResponse = Gatekeeper.GetMemberByMemberId(request);
     }
     catch (Exception ex)
     {
         LogMethodError(methodName, ex);
     }
     LogMethodExit(methodName);
     return baseResponse;
 }       
Exemplo n.º 5
0
        public BaseResponse GetMemberById(string memberId, bool issfgid)
        {
            methodName = "GetMemberByMemberId";
            
            if (!issfgid)
            {
                try
                {
                    using (SupportDataDataContext context = new SupportDataDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
                    {
                        memberId = (from a in context.SFG_CustomerNumbers
                                    where a.cusID.ToString() == memberId
                                    select a.SFGCustNum).Single();
                    }
                }
                catch
                {
                    baseResponse.Messages.Add(new Message(MessageSources.AndrewHarper, 0, "ImproperValidationCriteriaException", "Unable to get SFG id for cusid", "", "", null));
                    baseResponse.TypedResponse = new GetMemberResponse();
                    baseResponse.TypedResponse.Success = false;
                    return baseResponse;
                }
            }            
            try
            {
                
                #region validate input
                // All params are required 
                if (memberId.Trim() == "")
                {
                    baseResponse.Messages.Add(new Message("ImproperValidationCriteriaException"));
                    baseResponse.TypedResponse = new GetMemberResponse();
                    baseResponse.TypedResponse.Success = false;
                    return baseResponse;
                }
                #endregion

                GetMemberByMemberIdRequest request = new GetMemberByMemberIdRequest(memberId.Trim(), false);
                baseResponse = Gatekeeper.GetMemberByMemberId(request);
            }
            catch (Exception ex)
            {
                LogMethodError(methodName, ex);
            }
            
            return baseResponse;
        }