protected void ui_send_button_Click(object sender, EventArgs e) { Supplier supplier = new SupplierController().actionGetSuppierByID(Convert.ToInt32(ui_to_dropdown.SelectedValue)); new PurchaseOrderController().actionCreateNewReOrderWithDefaultValue(stationery_id, supplier.id); if (ui_sentmail.Checked) { Helper.sendMail(supplier.email, ui_from_textbox.Text, ui_subject_textbox.Text, ui_message_textbox.Text); } if (ui_sentsms.Checked) { Stationery stationery = new StationeryController().actionGetStationeryByID(stationery_id); SMSController sms = new SMSController(); sms.sendSMS(supplier.phone_number, "Purchase Order\r\n Stationery : " + stationery.stationery_name + "\r\n Quantity : " + stationery.reorder_quantity); } //ui_from_textbox.Text = ""; //ui_subject_textbox.Text = ""; //ui_message_textbox.Text = ""; Response.Cookies.Add(new HttpCookie("flash_message", "Successfully Made Purchase Order.") { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-success") { Path = "/" }); Response.Redirect("~/StoreClerk/InventoryStatus.aspx"); }
private void Form1_Load(object sender, EventArgs e) { smsController = new SMSController(); /* * smsController = new SMSController(); // Default Port = 3000 , Default IP = Your default local Ip * * smsController = new SMSController(3333); // Start On different Port * * smsController = new SMSController("192.168.10.10",3333); // Start On different Port and different IP(In case of multiple NetworkInterfaces) * OR * * IPAddress address = IPAddress.Parse("192.168.10.19"); * IPEndPoint EndPoint = new IPEndPoint(address,3333) * smsController = new SMSController(EndPoint); // Pass an IPEndPoint * */ FillGridView(); if (smsController.StartWatching()) { WriteToConsole("Started watching for SMS on port: " + smsController.GetAddress()); smsController.OnDeviceBlocked += SmsController_OnDeviceBlocked; smsController.OnDeviceConnected += SmsController_OnDeviceConnected; smsController.OnDeviceDisconnected += SmsController_OnDeviceDisconnected; smsController.OnDeviceUnblocked += SmsController_OnDeviceUnblocked; smsController.OnMessageReceived += SmsController_OnMessageReceived; smsController.OnPassCodeVerified += SmsController_OnPassCodeVerified; smsController.OnMessageSent += SmsController_OnMessageSent; } }
private void Arrange() { test = new SMSController(); session = new Dictionary <string, Object>(); session["jokeID"] = null; session["chatStatus"] = 0; session["prevMessage"] = null; }
public void WhenSendingSMSThenSMSIsSent() { // Arrange var logger = Substitute.For <ILogger <SMSController> >(); var smartContract = Substitute.For <ISmartContract>(); var cntrl = new SMSController(logger, smartContract); // Act cntrl.SendSMS(new shared.model.SMSMessage() { body = "Hello, world", phonenumber = "+31612309890" }); // Assert }
private async Task SendSMSMessageAsync(OrderDBE dbOrderExploded, WebUrlConfigurationBE webUrlConfig) { // Step 1: calc the order total decimal orderTotal = (dbOrderExploded.OrderLineItems != null) ? dbOrderExploded.OrderLineItems.Sum(oli => oli.ItemUnitPrice) : 0.0M; // Step 2: Build the SMS Msg string payAwayURL = $"{webUrlConfig.HPPBaseUrl}/customerorder/{dbOrderExploded.OrderGuid}"; StringBuilder messageBody = new StringBuilder(); messageBody.AppendLine($"Hello {dbOrderExploded.CustomerName}"); // we do not know what culture the server is set for so we are explicit, we want to make it formats currency with a US $ var specificCulture = System.Globalization.CultureInfo.GetCultureInfo("en-US"); FormattableString formattableString = $"{dbOrderExploded.Merchant.MerchantName} is sending you this link to a secure payment page to enter your payment info for your Order Number: {dbOrderExploded.OrderId:0000} for: {orderTotal:C}"; messageBody.AppendLine(formattableString.ToString(specificCulture)); messageBody.AppendLine($"{payAwayURL}"); // Step 3: Send the SMS msg // convert the phone no to the "normalized format" +15131234567 that the SMS api accepts (bool isValidPhoneNo, string formattedPhoneNo, string normalizedPhoneNo) = Utilities.PhoneNoHelpers.NormalizePhoneNo(dbOrderExploded.PhoneNumber); var msgSid = SMSController.SendSMSMessage(String.Empty, formattedPhoneNo, messageBody.ToString()); // Step 4 Create & Save the SMS event var dbOrderEvent = new OrderEventDBE() { OrderId = dbOrderExploded.OrderId, EventDateTimeUTC = DateTime.UtcNow, OrderStatus = Enums.ORDER_STATUS.SMS_Sent, EventDescription = $"SMS sent to [{normalizedPhoneNo}]." }; await _dbContext.InsertOrderEventAsync(dbOrderEvent); // Step 5: Update the order status dbOrderExploded.Status = Enums.ORDER_STATUS.SMS_Sent; await _dbContext.UpdateOrderAsync(dbOrderExploded); }
public void SetUpClass() { controller = GetClient().SMS; }
public NResult <EUserInfo> Register(InUserReg userReg) { NResult <EUserInfo> result = new NResult <EUserInfo>(); EUserInfo ui = null; EUserQRInvite pQR = null; SMSController smsController = new SMSController(); try { if (string.IsNullOrEmpty(userReg.Phone)) { result.ErrorMsg = "手机号不能未空"; return(result); } if (string.IsNullOrEmpty(userReg.Pwd)) { result.ErrorMsg = "密码不能为空"; return(result); } if (string.IsNullOrEmpty(userReg.VerifyCode)) { result.ErrorMsg = "验证码不能为空"; return(result); } OutAPIResult smsResult = smsController.ConfirmVerification(userReg.Phone, userReg.VerifyCode); if (!smsResult.IsSuccess) { result.ErrorMsg = smsResult.ErrorMsg; return(result); } using (OOContent db = new OOContent()) { using (TransactionScope ts = new TransactionScope()) { //创建用户基本信息 ui = db.DBUserInfo.Where(a => a.Phone == userReg.Phone).FirstOrDefault(); if (ui != null) { result.ErrorMsg = "手机号已存在"; return(result); } ui = new EUserInfo(); //如果昵称或登陆名为空,则用手机号补充 if (string.IsNullOrEmpty(userReg.LoginName)) { ui.LoginName = userReg.Phone; } if (string.IsNullOrEmpty(userReg.NickName)) { ui.NickName = userReg.Phone; } ui.Phone = userReg.Phone; ui.Pwd = userReg.Pwd; ui.UserRole = IQBCore.OO.BaseEnum.UserRole.User; ui.RecordStatus = IQBCore.OO.BaseEnum.RecordStatus.Normal; ui.RegisterDateTime = DateTime.Now; ui.RegisterChannel = RegisterChannel.OOAPP; db.DBUserInfo.Add(ui); //检查邀请码 if (!string.IsNullOrEmpty(userReg.InviteCode)) { pQR = db.DBUserQRInvite.Where(a => a.InviteCode == userReg.InviteCode).FirstOrDefault(); if (pQR == null) { result.ErrorMsg = "邀请码没有找到对应的用户"; return(result); } } db.SaveChanges(); //创建用户邀请码 EUserQRInvite qr = new EUserQRInvite { InviteCode = StringHelper.GenerateUserInviteCode(ui.Phone), QRPath = "", QRUrl = "", UserId = ui.Id }; db.DBUserQRInvite.Add(qr); //用户关系 EUserRelation ur = new EUserRelation(); ur.UserId = ui.Id; ur.UserName = ui.NickName; if (pQR != null) { ur.PId = pQR.UserId; } db.DBUserRelation.Add(ur); //用户账户 EUserBalance ub = new EUserBalance(); ub.UserId = ui.Id; ub.Balance = 0; ub.CurrencyCode = CoreStatic.Instance.Sys.CurCurrencyCode; db.DBUserBalance.Add(ub); //用户回报 EUserReward reward = new EUserReward(); reward.UserId = ui.Id; reward.ADRewardRate = CoreStatic.Instance.Sys.ADRewardRate; reward.OrderRewardRate = CoreStatic.Instance.Sys.L1RewardRate; reward.IntroRate = CoreStatic.Instance.Sys.IntroRate; db.DBUserReward.Add(reward); //绑定用户设备和用户手机号 UpdateDevice(userReg.DeviceIdentify, userReg.Phone, db); db.SaveChanges(); ts.Complete(); } result.resultObj = ui; } } catch (Exception ex) { result.ErrorMsg = ex.Message; ErrorToDb(ex.Message); } return(result); }
public CocktailController() { context = new ApplicationDbContext(); SMS = new SMSController(); }
public SMSControllerTestBase() { this.MockSMSService = new Mock <ISMSService>(); this.Controller = new SMSController(this.MockSMSService.Object); }