using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.SMSManagement.ShortSmsMessage { public partial class FrmImportNumbers : LYFZ.Software.UI.SMSManagement.ShortSmsMessage.FrmImportNumbers { public string Telphone; public FrmImportNumbers() { } #region 确定 protected override void btnOk_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtProd_SalesPrice.Text)) { MessageBoxCustom.Show("请输入正确手机号码!"); return; } string phone = txtProd_SalesPrice.Text.Trim().Replace(",", ",").Replace("\r\n", ",").Replace("\n", ",").Replace("\t", ",").Trim(',').Replace('/', ',').Replace('\\', ','); string lawfulPhone = ""; string retMsg = LYFZ.WinAPI.CustomPublicMethod.ValidationPhones(phone, ref lawfulPhone); if (retMsg.Trim().Length > 0) { MessageBoxCustom.Show("入正手机号有误:" + retMsg); } else { this.Telphone = lawfulPhone; this.DialogResult = System.Windows.Forms.DialogResult.OK; } } #endregion #region 输入框设置 protected override void txtProd_SalesPrice_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar)) { e.Handled = true; //获取或设置一个值,指示是否处理过System.Windows.Forms.Control.KeyPress事件 } else if (Char.IsPunctuation(e.KeyChar)) { if (e.KeyChar != ',') { e.Handled = true; } } } #endregion #region 取消 protected override void btnCanle_Click(object sender, EventArgs e) { this.Close(); } #endregion } }