コード例 #1
0
        public void RelayMessage(double latitude, double longitude, string emailAddress)
        {
            User          TempUser       = db.Users.Where(x => x.Email == emailAddress).FirstOrDefault();
            var           TempAlert      = db.AlertTypes.Where(x => x.UserId == TempUser.Id).FirstOrDefault();
            GeoCoordinate PersonLocation = new GeoCoordinate(latitude, longitude);
            var           locations      = db.NoGoZones.Where(x => x.User.Id == TempUser.Id);

            if (CompareLocations.CompareLocations.Compare(PersonLocation, locations.AsEnumerable()))
            {
                var msgData = new MessageData
                {
                    EMail     = TempUser.Email,
                    TelNr     = TempUser.TelNr,
                    MsgBody   = "You got too close to a no go zone!",
                    MsgHeader = "Alert"
                };

                if (!string.IsNullOrEmpty(TempUser.TelNr) && TempAlert.Text)
                {
                    INotifications notification = new SMSNotification();
                    notification.Send(msgData);
                }

                if (!string.IsNullOrEmpty(TempUser.Email) && TempAlert.EMail)
                {
                    INotifications notification = new EMailNotification();
                    notification.Send(msgData);
                }
                if (!string.IsNullOrEmpty(TempUser.Push) && TempAlert.Push)
                {
                    INotifications notification = new PushFirebase();
                    notification.Send(msgData);
                }
            }
        }
コード例 #2
0
        public Result RunBusinessRuleEngine(PaymentType type)
        {
            switch (type)
            {
            case PaymentType.PHYSICAL_PRODUCT:
            {
                var generateCommissionPayment = new GenerateCommissionPayment();
                var packingSlip = new GeneratePackingSlip(generateCommissionPayment);
                return(packingSlip.Process());
            }

            case PaymentType.BOOK:
            {
                var generateCommissionPayment = new GenerateCommissionPayment();
                var GeneratePackingSlipForRoyaltyDepartment = new GeneratePackingSlipForRoyaltyDepartment(generateCommissionPayment);
                return(GeneratePackingSlipForRoyaltyDepartment.Process());
            }

            case PaymentType.MEMBERSHIP_ACTIVATE:
            {
                var sendEmailNotifification = new EMailNotification();
                var activateMemberShip      = new ActivateMemberShip(sendEmailNotifification);
                return(activateMemberShip.Process());
            }

            case PaymentType.MEMBERSHIP_UPGRADE:
            {
                var sendEmailNotifification = new EMailNotification();
                var applyUpgrade            = new ApplyUpgrade(sendEmailNotifification);
                return(applyUpgrade.Process());
            }

            case PaymentType.VIDEO:
            {
                var addFirstAidVideo = new AddFirstAidVideo();
                var packingSlip      = new GeneratePackingSlip(addFirstAidVideo);
                return(packingSlip.Process());
            }

            default:
                return(new Result((int)Status.FAIL, "payment type is not found"));
            }
        }