private bool CheckValue() { if (string.IsNullOrEmpty(TxtName.Text)) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('会议名称不能为空!');", true); TxtName.Focus(); return(false); } if (string.IsNullOrEmpty(TxtTheme.Text)) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('主题不能为空!');", true); TxtTheme.Focus(); return(false); } if (string.IsNullOrEmpty(TxtStartTime.Text)) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('开始时间不能为空!');", true); TxtStartTime.Focus(); return(false); } if (string.IsNullOrEmpty(TxtEndTime.Text)) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('结束时间不能为空!');", true); TxtEndTime.Focus(); return(false); } if (string.IsNullOrEmpty(TxtCity.Text)) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('所在城市不能为空!');", true); TxtCity.Focus(); return(false); } if (string.IsNullOrEmpty(TxtStreet.Text)) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('街道不能为空!');", true); TxtStreet.Focus(); return(false); } if (string.IsNullOrEmpty(TxtNumber.Text)) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('门牌号不能为空!');", true); TxtNumber.Focus(); return(false); } if (string.IsNullOrEmpty(TxtDept.Text)) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('所属部门不能为空!');", true); TxtDept.Focus(); return(false); } return(true); }
/// <summary> /// Filters Users based on the given citirions /// </summary> /// <param name="item"></param> /// <returns>if the given object is valid by filtering</returns> public bool FilterUsers(object item) { User user = item as User; int numOfevaluated = PropertiesToCheck(); int numOfValid = 0; if (user != null) { if (ChbFirstName) { if (user.FirstName.ToLower().Contains(TxtFirstName.ToLower())) { numOfValid++; } } if (ChbLastName) { if (user.LastName.ToLower().Contains(TxtLastName.ToLower())) { numOfValid++; } } if (ChbEmail) { if (user.Email.ToLower().Contains(TxtEmail.ToLower())) { numOfValid++; } } if (CurrentGender.ToString() == user.Gender) { numOfValid++; } if (ChbCountry) { if (user.Country.ToLower().Contains(TxtCountry.ToLower())) { numOfValid++; } } if (ChbCity) { if (user.City.ToLower().Contains(TxtCity.ToLower())) { numOfValid++; } } if (ChbStreet) { if (user.Street.ToLower().Contains(TxtStreet.ToLower())) { numOfValid++; } } if (ChbPhoneNumber) { if (user.PhoneNumber.ToLower().Contains(TxtPhoneNumber.ToLower())) { numOfValid++; } } return(numOfevaluated == numOfValid); } return(false); }