Esempio n. 1
0
        public async Task <ValidationResult> Create(MobileRepair mobileRepair)
        {
            var validationResult = new ValidationResult();

            try
            {
                var alreadyCreated = await MobileRepairRequestAlreadyExists(mobileRepair.MobileNumber);

                if (!alreadyCreated.Succeeded)
                {
                    return(alreadyCreated);
                }
                mobileRepair.MobileRepairStateId = (int)MobileRepairRequestState.Created;
                var data = await _mobileDataService.CreateGetAsync(mobileRepair);
                await CreateMobileCoupon(mobileRepair.MobileNumber, mobileRepair.CouponCode);

                var message = $"Your request to repair is created.Request id :{data.MobileRepairId}. mumbile team will contact you on {data.MobileNumber}. Thank you for choosing mumbile.com";
                _smsBusinessService.SendSMS(mobileRepair.MobileNumber.ToString(), message);
                validationResult.Message   = "Request created successfully.";
                validationResult.Succeeded = true;
            }
            catch (Exception ex)
            {
                validationResult.Succeeded = false;
                validationResult.Message   = ex.Message;
            }
            return(validationResult);
        }
        public async Task <ValidationResult <AspNetUserMobileOtp> > CreateLoginOtp(decimal mobileNumber, string ipAddress)
        {
            var validationResult = await CreateOtp(mobileNumber, ipAddress, (int)OtpReason.Login);

            if (validationResult.Succeeded)
            {
                var message = $"Your OTP for login : {validationResult.Entity.OTP} .Do not share your OTP.";
                _smsBusinessService.SendSMS(mobileNumber.ToString(), message);
            }
            return(validationResult);
        }
        private void SendOrderSms(Order order, List <Seller> sellers, Personnel personnel, Entity.Mobile mobile)
        {
            var sellerData = sellers.First();

            if (!string.IsNullOrEmpty(personnel.Mobile))
            {
                //var msg = String.Format("Order Received: We have received your order request for {0} with order id {1}. Seller will contact you on {2}.", mobile.Name, order.OrderId, personnel.Mobile);
                var msg = $"Hi, we have received your request for {mobile.Name}.Seller {sellerData.Name} will contact you soon for best deal.";
                _smsBusinessService.SendSMS(personnel.Mobile, msg);
            }
            foreach (var seller in sellers)
            {
                if (!string.IsNullOrEmpty(seller.Contact1.ToString()))
                {
                    //var msg = String.Format("Order Received: We have received your order request for {0} from {1} {2} {3} with order id {4}. Kindly contact to customer on {5}.", mobile.Name, personnel.Title, personnel.Forenames, personnel.Surname, order.OrderId, personnel.Mobile);
                    var msg = $"Hi, {sellerData.Name} you have received a request for {mobile.Name}.Contact customer on {personnel.Mobile}.";
                    _smsBusinessService.SendSMS(seller.Contact1.ToString(), msg);
                }
            }
        }