/// <summary> /// Valida los datos /// </summary> /// <history> /// [jorcanche] 12/Mar/2016 Created /// </history> private bool Validate() { // validamos el motivo de indisponibilidad if (!ValidateHelper.ValidateRequired(txtguum, "Unavailable Motive", condition: !chkguAvail.IsChecked.Value)) { return(false); } // validamos que el motivo de indisponibilidad exista if (!chkguAvail.IsChecked.Value) { UnavailableMotive motive = BRUnavailableMotives.GetUnavailableMotive(Convert.ToInt16(txtguum.Text), true); if (motive == null) { UIHelper.ShowMessage("The unavailable motive does not exist"); txtguum.Focus(); return(false); } } // validamos los permisos if (!ValidatePermissions()) { return(false); } return(true); }
private void txtguum_LostFocus(object sender, RoutedEventArgs e) { _searchUmByTxt = true; int umid; if (txtguum.Text != string.Empty) { //validosmos q no ingrese datos numericos if (!int.TryParse(txtguum.Text, out umid)) { UIHelper.ShowMessage("you must enter a numeric value"); txtguum.Text = string.Empty; txtguum.Focus(); } else { // validamos que el motivo de indisponibilidad exista en los activos UnavailableMotive motive = BRUnavailableMotives.GetUnavailableMotive(Convert.ToInt32(txtguum.Text), true); if (motive == null) { UIHelper.ShowMessage("The unavailable motive does not exist"); txtguum.Text = string.Empty; txtguum.Focus(); } else { cboguum.SelectedValue = txtguum.Text; } } } else { cboguum.SelectedIndex = -1; } _searchUmByTxt = false; }