private bool CustomValidation() { bool hasError = true; errorProvider.Clear(); if (currentCustomer == null) { errorProvider.SetError(textCustomer, Constants.Messages.RequireMessage); hasError = false; textCustomer.Focus(); } if (!string.IsNullOrEmpty(txtRecipient.Text) && txtRecipient.Text.Length > 0) { var biz = new SmsBiz(); var sms = biz.LoadItem(Constants.SmsDeliveryInternal1); if (sms != null) { var content = sms.Content; content = content.Replace(Constants.SmsParameter1, txtRecipient.Text.Trim()); if (content.Length > 158) { errorProvider.SetError(txtRecipient, Constants.Messages.SmsOverRange); hasError = false; txtRecipient.Focus(); } } } if (!string.IsNullOrEmpty(textDuNo.Text)) { decimal value = 0; if (!decimal.TryParse(textDuNo.Text, out value)) { errorProvider.SetError(textDuNo, Constants.Messages.InvalidType); hasError = false; textDuNo.Focus(); } } return(hasError); }
public SmsForm(int id, User user) { InitializeComponent(); textName.Focus(); itemId = id; var biz = new SmsBiz(); var item = biz.LoadItem(id); textName.Text = item.Name; textContent.Text = item.Content; created = item.Created; createdBy = item.CreatedByUserId; modified = item.Modified; modifiedBy = item.ModifiedByUserId; InitForm(user); this.Text = "Sửa Sms"; }
private bool CustomValidation() { bool hasError = true; errorProvider.Clear(); if (string.IsNullOrEmpty(textTenSms.Text)) { errorProvider.SetError(textTenSms, Constants.Messages.RequireMessage); hasError = false; textTenSms.Focus(); } if (string.IsNullOrEmpty(textFullName.Text)) { errorProvider.SetError(textFullName, Constants.Messages.RequireMessage); hasError = false; textFullName.Focus(); } if (string.IsNullOrEmpty(textAddress1.Text)) { errorProvider.SetError(textAddress1, Constants.Messages.RequireMessage); hasError = false; textAddress1.Focus(); } if (string.IsNullOrEmpty(Convert.ToString(drlCity.SelectedItem))) { errorProvider.SetError(drlCity, Constants.Messages.RequireMessage); hasError = false; drlCity.Focus(); } if (string.IsNullOrEmpty(Convert.ToString(drlSegment.SelectedItem))) { errorProvider.SetError(drlSegment, Constants.Messages.RequireMessage); hasError = false; drlSegment.Focus(); } if (string.IsNullOrEmpty(textMobile1.Text)) { errorProvider.SetError(textMobile1, Constants.Messages.RequireMessage); hasError = false; textMobile1.Focus(); } if (string.IsNullOrEmpty(textEmail1.Text)) { errorProvider.SetError(textEmail1, Constants.Messages.RequireMessage); hasError = false; textEmail1.Focus(); } var biz = new SmsBiz(); var sms = biz.LoadItem(Constants.SmsDeliveryInternal1); if(sms != null) { var content = sms.Content; content = content.Replace(Constants.SmsParameter1, textTenSms.Text.Trim()); if(content.Length > 158) { errorProvider.SetError(textTenSms, Constants.Messages.SmsOverRange); hasError = false; textTenSms.Focus(); } } return hasError; }
private bool CustomValidation() { bool hasError = true; errorProvider.Clear(); if (currentCustomer == null) { errorProvider.SetError(textCustomer, Constants.Messages.RequireMessage); hasError = false; textCustomer.Focus(); } if (!string.IsNullOrEmpty(txtRecipient.Text) && txtRecipient.Text.Length > 0) { var biz = new SmsBiz(); var sms = biz.LoadItem(Constants.SmsDeliveryInternal1); if (sms != null) { var content = sms.Content; content = content.Replace(Constants.SmsParameter1, txtRecipient.Text.Trim()); if (content.Length > 158) { errorProvider.SetError(txtRecipient, Constants.Messages.SmsOverRange); hasError = false; txtRecipient.Focus(); } } } if(!string.IsNullOrEmpty(textDuNo.Text)) { decimal value = 0; if(!decimal.TryParse(textDuNo.Text, out value)) { errorProvider.SetError(textDuNo, Constants.Messages.InvalidType); hasError = false; textDuNo.Focus(); } } return hasError; }
private bool CustomValidation() { bool hasError = true; errorProvider.Clear(); if (string.IsNullOrEmpty(textTenSms.Text)) { errorProvider.SetError(textTenSms, Constants.Messages.RequireMessage); hasError = false; textTenSms.Focus(); } if (string.IsNullOrEmpty(textFullName.Text)) { errorProvider.SetError(textFullName, Constants.Messages.RequireMessage); hasError = false; textFullName.Focus(); } if (string.IsNullOrEmpty(textAddress1.Text)) { errorProvider.SetError(textAddress1, Constants.Messages.RequireMessage); hasError = false; textAddress1.Focus(); } if (string.IsNullOrEmpty(Convert.ToString(drlCity.SelectedItem))) { errorProvider.SetError(drlCity, Constants.Messages.RequireMessage); hasError = false; drlCity.Focus(); } if (string.IsNullOrEmpty(Convert.ToString(drlSegment.SelectedItem))) { errorProvider.SetError(drlSegment, Constants.Messages.RequireMessage); hasError = false; drlSegment.Focus(); } if (string.IsNullOrEmpty(textMobile1.Text)) { errorProvider.SetError(textMobile1, Constants.Messages.RequireMessage); hasError = false; textMobile1.Focus(); } if (string.IsNullOrEmpty(textEmail1.Text)) { errorProvider.SetError(textEmail1, Constants.Messages.RequireMessage); hasError = false; textEmail1.Focus(); } var biz = new SmsBiz(); var sms = biz.LoadItem(Constants.SmsDeliveryInternal1); if (sms != null) { var content = sms.Content; content = content.Replace(Constants.SmsParameter1, textTenSms.Text.Trim()); if (content.Length > 158) { errorProvider.SetError(textTenSms, Constants.Messages.SmsOverRange); hasError = false; textTenSms.Focus(); } } return(hasError); }