protected void txtProductGroupEditCode_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { //ASPxTextBox txt = sender as ASPxTextBox; //string oldCode = ""; //string oldName = ""; //UnitOfWork uow = XpoHelpers.GetNewUnitOfWork(); //if (hEditProductGroupId.Count > 0 && hEditProductGroupId.Get("id").ToString() != "") //{ // ViewBuyingProductCategory vpu = uow.GetObjectByKey<ViewBuyingProductCategory>(long.Parse(hEditProductGroupId.Get("id").ToString())); // if (vpu != null) // { // oldCode = vpu.Code; // oldName = vpu.Name; // } //} //BuyingProductCategory pu = uow.FindObject<BuyingProductCategory>(new BinaryOperator("Code", txtProductGroupEditCode.Text)); //if (pu != null && pu.RowStatus != Constant.ROWSTATUS_DELETED && oldCode != txtProductGroupEditCode.Text) //{ // e.IsValid = false; // e.ErrorText = "Mã nhóm hàng này đã tồn tại !"; //} }
protected void NameTextBox_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { if ((e.Value as string).Length < 2) { e.IsValid = false; } }
protected void eMailTextBox_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { if (!Page.IsCallback) { e.IsValid = e.Value != null; if (!e.IsValid) { e.ErrorText = "Email is required"; return; } Regex r = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"); e.IsValid = r.IsMatch(e.Value.ToString()); if (!e.IsValid) { e.ErrorText = "Email is invalid"; return; } e.IsValid = !GetIsEmailExist(e.Value.ToString()); if (!e.IsValid) { e.ErrorText = "Sorry, this email belongs to an existing account"; return; } } }
protected void password_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { e.IsValid = e.Value != null; if (!e.IsValid) { e.ErrorText = "Password is required"; return; } string password = e.Value.ToString(); e.IsValid = String.Compare(password, confirmPasswordTextBox.Text) == 0; if (!e.IsValid) { e.ErrorText = "The password you entered do not match"; return; } Regex r = new Regex(@"[A-Z]+|[a-z]+|\d+|[^\w\d\s]+"); e.IsValid = r.Matches(password).Count > 1; if (!e.IsValid) { e.ErrorText = "The password is too simple"; return; } }
protected void txtName_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { e.IsValid = validate(); if (txtName.ValidationSettings.ErrorText == "") { e.IsValid = true; } }
protected void requiredTextBox_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { e.IsValid = e.Value != null; if (e.IsValid) { e.ErrorText = "This field is required"; } }
protected void ASPxTextBox_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { ASPxTextBox tb = sender as ASPxTextBox; if (!tb.ClientVisible) { e.IsValid = true; } }
protected void txtNameProduct_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { /* * e.IsValid = validate(); * if (txtName.ValidationSettings.ErrorText == "") * { * e.IsValid = true; * } */ }
protected void txtUnitEditCode_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { string msg = ""; bool rs = validateDupplicateCode(out msg); if (!rs) { txtUnitEditCode.IsValid = false; txtUnitEditCode.ErrorText = msg; e.IsValid = false; e.ErrorText = msg; } }
protected void ArrivalDateEdit_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { if (!(e.Value is DateTime)) { return; } DateTime selectedDate = (DateTime)e.Value; DateTime currentDate = DateTime.Now; if (selectedDate.Year != currentDate.Year || selectedDate.Month != currentDate.Month) { e.IsValid = false; } }
protected void AgeTextBox_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { if (CommonUtils.IsNullValue(e.Value) || ((string)e.Value == "")) { return; } string strAge = ((string)e.Value).TrimStart('0'); if (strAge.Length == 0) { return; } UInt32 age = 0; if (!UInt32.TryParse(strAge, out age) || age < 18) { e.IsValid = false; } }
protected void txtNameDeviceCategory_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { }
protected void txtName_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { e.IsValid = validate(); }
protected void txtUnitEditName_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { }
protected void txtCodeService_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { }
/////2013-09-21 ERP-580 Khoa.Truong INS END protected void txtCodeWarehouseCategory_Validation(object sender, DevExpress.Web.ASPxEditors.ValidationEventArgs e) { }