FrmImportNumbers.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace LYFZ.Software.MainBusiness.SMSManagement.ShortSmsMessage
  10. {
  11. public partial class FrmImportNumbers : LYFZ.Software.UI.SMSManagement.ShortSmsMessage.FrmImportNumbers
  12. {
  13. public string Telphone;
  14. public FrmImportNumbers()
  15. {
  16. }
  17. #region 确定
  18. protected override void btnOk_Click(object sender, EventArgs e)
  19. {
  20. if (string.IsNullOrEmpty(txtProd_SalesPrice.Text))
  21. {
  22. MessageBoxCustom.Show("请输入正确手机号码!");
  23. return;
  24. }
  25. string phone = txtProd_SalesPrice.Text.Trim().Replace(",", ",").Replace("\r\n", ",").Replace("\n", ",").Replace("\t", ",").Trim(',').Replace('/', ',').Replace('\\', ',');
  26. string lawfulPhone = "";
  27. string retMsg = LYFZ.WinAPI.CustomPublicMethod.ValidationPhones(phone, ref lawfulPhone);
  28. if (retMsg.Trim().Length > 0)
  29. {
  30. MessageBoxCustom.Show("入正手机号有误:" + retMsg);
  31. }
  32. else {
  33. this.Telphone = lawfulPhone;
  34. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  35. }
  36. }
  37. #endregion
  38. #region 输入框设置
  39. protected override void txtProd_SalesPrice_KeyPress(object sender, KeyPressEventArgs e)
  40. {
  41. if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
  42. {
  43. e.Handled = true; //获取或设置一个值,指示是否处理过System.Windows.Forms.Control.KeyPress事件
  44. }
  45. else if (Char.IsPunctuation(e.KeyChar))
  46. {
  47. if (e.KeyChar != ',')
  48. {
  49. e.Handled = true;
  50. }
  51. }
  52. }
  53. #endregion
  54. #region 取消
  55. protected override void btnCanle_Click(object sender, EventArgs e)
  56. {
  57. this.Close();
  58. }
  59. #endregion
  60. }
  61. }