/// <summary> /// Verify the Member is registered for given segment /// </summary> /// <returns></returns> public bool VerifyMemberIsAuthorized(string loyaltyCardNumber, List <int> segmentsList) { try { bool isMemberAuthorized = false; HouseHold objHousehold = objGetMemberDemographicsManager.GetDemographicData(loyaltyCardNumber).Result; MemberSegments memberSegments = objHousehold?.Members?.MemberMain.FirstOrDefault().MemberSegments; var houseHoldSegment = objHousehold?.HouseHoldSegments; foreach (int segmentId in segmentsList) { if ((memberSegments != null && memberSegments.Segment.Any(x => x.Id == Convert.ToInt32(segmentId))) || (houseHoldSegment != null && houseHoldSegment.Segment.Count > 0 && houseHoldSegment.Segment.Any(x => x.Id == Convert.ToInt32(segmentId)))) { isMemberAuthorized = true; break; } } return(isMemberAuthorized); }catch (Exception ex) { DBLogging.Error("Validate Register Promotion", ex); throw; } }
/// <summary> /// /// </summary> /// <param name="registerPromotionRequest"></param> /// <returns></returns> public MemberPromotion RegisterPromotion(MemberPromotion registerPromotionRequest) { try { RegisterPromotion registerPromoBS = new RegisterPromotion(); this.iRegisterPromotion = registerPromoBS.CreateRegisterPromotion(registerPromotionRequest); var memberPromotion = this.iRegisterPromotion.RegisterPromotion(registerPromotionRequest); return(memberPromotion); } catch (Exception ex) { DBLogging.Error("Register Promotion", ex); throw; } }