protected void CheckField(object sender, RemoteValidationEventArgs e) { TextField field = (TextField)sender; GetAccountRequest request = new GetAccountRequest(); request.Account = field.Text; Response <Account> response = _masterService.GetAccount(request); if (response.Success) { tbAccountName.IndicatorIcon = Icon.Accept; tbAccountName.IndicatorTip = "Identified"; e.Success = true; } else { tbAccountName.IndicatorIcon = Icon.Error; e.Success = false; tbAccountName.IndicatorTip = "Unidentified"; e.ErrorMessage = "Invalid Account";//should access local resources, just didn't figure how yet , only Resources.Common is accessible } }
/// <summary> /// 检查用户名是否重复 /// yuany /// 2013年1月31日 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void CheckDeptName(object sender, RemoteValidationEventArgs e) { TextField field = (TextField)sender; string deptname = field.Text; IList <SsbDept> deptList = deptManager.GetEntityList(new SsbDept() { DeptName = deptname }); if (deptList.Count == 0) { e.Success = true; } else { if (deptList[0].DeptName.ToString() == hidden_dept_name.Value.ToString()) { e.Success = true; } else { e.Success = false; e.ErrorMessage = "此部门名称已被使用!"; } } }
protected void AddTotalLibrasTxt_Blur(object sender, RemoteValidationEventArgs e) { try { string cantidadInventario = this.AddInventarioCafeTxt.Text; string cantidadLibras = this.AddTotalLibrasTxt.Text; int CantidadInventarioDisponible = string.IsNullOrEmpty(cantidadInventario) ? 0 : Convert.ToInt32(cantidadInventario); int CantidadLibrasLiquidar = string.IsNullOrEmpty(cantidadLibras) ? 0 : Convert.ToInt32(cantidadLibras); if (CantidadLibrasLiquidar <= CantidadInventarioDisponible) { e.Success = true; } else { e.Success = false; e.ErrorMessage = "La cantidad sobrepasa el inventario de café disponible por " + (CantidadLibrasLiquidar - CantidadInventarioDisponible) + " libras."; } } catch (Exception ex) { log.Fatal("Error fatal al validar cantidad de libras de inventario de cafe de socio.", ex); throw; } }
protected void CheckField(object sender, RemoteValidationEventArgs e) { TextField field = (TextField)sender; var fieldList = (List <EmailTemplateFieldDTO>)Session["FieldList"]; var isDuplicate = false; if (fieldList != null && fieldList.Count > 0) { switch (field.ID) { case "txFieldName": isDuplicate = fieldList.Select(f => f.FieldName).Contains(field.Text); break; case "txDisplayName": isDuplicate = fieldList.Select(f => f.DisplayName).Contains(field.Text); break; } } if (!isDuplicate) { e.Success = true; } else { e.Success = false; e.ErrorMessage = "Duplicate entry"; } System.Threading.Thread.Sleep(1000); }
protected void checkEdit(object sender, RemoteValidationEventArgs e) { int id = int.Parse(this.RecordID.Text); int count = ObjectContext.AssetTypes.Where(entity => entity.Name == this.txtName.Text && entity.Id != id).Count(); e.Success = count == 0; if (count > 0) e.ErrorMessage = "Asset type name already exists."; }
protected void checkDistrict(object sender, RemoteValidationEventArgs e) { int count = 0; using (var context = new FinancialEntities()) { count = context.ClassificationTypes.Where(entity => entity.District == this.District.Text).Count(); } e.Success = count == 0; if (count > 0) e.ErrorMessage = "Customer classification record already exists."; }
protected void AddLlaveTxt_Change(object sender, RemoteValidationEventArgs e) { try { string llave = this.AddLlaveTxt.Text; EstadoNotaDePesoLogic estadonotalogic = new EstadoNotaDePesoLogic(); if (estadonotalogic.EstadoDeNotaDePesoExiste(llave)) { e.Success = false; e.ErrorMessage = "La llave de estado de nota de peso ingresada ya existe."; return; } else { e.Success = true; } COCASJOL.LOGIC.Seguridad.PrivilegioLogic privilegiologic = new LOGIC.Seguridad.PrivilegioLogic(); if (privilegiologic.PrivilegioExiste(EstadoNotaDePesoLogic.PREFIJO_PRIVILEGIO + llave)) { e.Success = false; e.ErrorMessage = "La llave de privilegio para estado de nota de peso ya existe. Es necesario que cambie la llave."; return; } else { e.Success = true; } COCASJOL.LOGIC.Utiles.PlantillaLogic plantillalogic = new LOGIC.Utiles.PlantillaLogic(); if (plantillalogic.PlantillaDeNotifiacionExiste(EstadoNotaDePesoLogic.PREFIJO_PLANTILLA + llave)) { e.Success = false; e.ErrorMessage = "La llave de plantilla de notificacíon para estado de nota de peso ya existe. Es necesario que cambie la llave."; return; } else { e.Success = true; } } catch (Exception ex) { log.Fatal("Error fatal al validar existencia de estado de nota de peso y privilegio asociado.", ex); throw; } }
protected void CheckFieldInt(object sender, RemoteValidationEventArgs e) { TextField field = (TextField)sender; Regex regex = new Regex(@"^[\d]+$"); if (regex.IsMatch(field.Text) || field.Text == "") { e.Success = true; } else { e.Success = false; e.ErrorMessage = "此填入项必须为正整数!"; } }
protected void AddLlaveTxt_Change(object sender, RemoteValidationEventArgs e) { try { string llave = this.AddLlaveTxt.Text; EstadoNotaDePesoLogic estadonotalogic = new EstadoNotaDePesoLogic(); if (estadonotalogic.EstadoDeNotaDePesoExiste(llave)) { e.Success = false; e.ErrorMessage = "La llave de estado de nota de peso ingresada ya existe."; return; } else e.Success = true; COCASJOL.LOGIC.Seguridad.PrivilegioLogic privilegiologic = new LOGIC.Seguridad.PrivilegioLogic(); if (privilegiologic.PrivilegioExiste(EstadoNotaDePesoLogic.PREFIJO_PRIVILEGIO + llave)) { e.Success = false; e.ErrorMessage = "La llave de privilegio para estado de nota de peso ya existe. Es necesario que cambie la llave."; return; } else e.Success = true; COCASJOL.LOGIC.Utiles.PlantillaLogic plantillalogic = new LOGIC.Utiles.PlantillaLogic(); if (plantillalogic.PlantillaDeNotifiacionExiste(EstadoNotaDePesoLogic.PREFIJO_PLANTILLA + llave)) { e.Success = false; e.ErrorMessage = "La llave de plantilla de notificacíon para estado de nota de peso ya existe. Es necesario que cambie la llave."; return; } else e.Success = true; } catch (Exception ex) { log.Fatal("Error fatal al validar existencia de estado de nota de peso y privilegio asociado.", ex); throw; } }
protected void CheckField(object sender, RemoteValidationEventArgs e) { TextField field = (TextField)sender; GetAccountRequest request = new GetAccountRequest(); request.Account = field.Text; Response <Account> response = _masterService.GetAccount(request); if (response.Success) { e.Success = true; } else { } //tbAccountName.ShowIndicator(); }
protected void AddUsernameTxt_Change(object sender, RemoteValidationEventArgs e) { try { string username = this.AddUsernameTxt.Text; UsuarioLogic usuariologic = new UsuarioLogic(); if (usuariologic.UsuarioExiste(username)) { e.Success = false; e.ErrorMessage = "El nombre de usuario ingresado ya existe."; } else e.Success = true; } catch (Exception ex) { log.Fatal("Error fatal al validar existencia de nombre de usuario.", ex); throw; } }
public void CheckFeeNameChanged(object sender, RemoteValidationEventArgs e) { e.Success = false; //check fee name string name = txtFeeName.Text; if (hiddenId.Text == string.Empty) { //check productcategory int id = int.Parse(hiddenProductId.Value.ToString()); var feature = ProductFeature.GetByName(name); if (feature != null) { var pfa = ProductFeatureApplicability.GetActive(feature, FinancialProduct.GetById(id)); e.Success = pfa == null || pfa.Fee == null; } else e.Success = true; if (e.Success == false) { e.ErrorMessage = "The fee name already exist in the product feature table."; txtFeeName.InvalidText = "The fee name already exist in the product feature table."; } } if (e.Success == true || string.IsNullOrWhiteSpace(hiddenId.Text) == false) { LoanApplicationForm form = this.Retrieve<LoanApplicationForm>(ParentResourceGuid); //check if already has that name in the added items. e.Success = form.AvailableFees.Where(entity => entity.Name == name).Count() == 0; if (e.Success == false) { e.ErrorMessage = "The fee name already added in the loan application."; txtFeeName.InvalidText = "The fee name already added in the loan application."; } } if (e.Success == false) txtFeeName.MarkInvalid(txtFeeName.InvalidText); }
protected void AddCedulaTxt_Change(object sender, RemoteValidationEventArgs e) { try { string cedula = this.AddCedulaTxt.Text; UsuarioLogic usuarioLogic = new UsuarioLogic(); if (usuarioLogic.CedulaExiste(cedula)) { e.Success = false; e.ErrorMessage = "La cedula ingresada ya existe."; } else { e.Success = true; } } catch (Exception ex) { log.Fatal("Error fatal al validar existencia de cedula para usuario nuevo.", ex); throw; } }
protected void CheckField(object sender, RemoteValidationEventArgs e) { TextField field = (TextField)sender; using (var ctx = new FinancialEntities()) { string name = this.Name.Text; RequiredDocumentType customer = ctx.RequiredDocumentTypes.SingleOrDefault(entity => entity.Name == name); if (customer == null) { e.Success = true; btnSave.Disabled = false; } else { e.Success = false; e.ErrorMessage = "Required document type already exists."; btnSave.Disabled = true; } //System.Threading.Thread.Sleep(1000); } }
protected void AddFecha_Change(object sender, RemoteValidationEventArgs e) { try { DateTime Fecha = DateTime.Parse(this.AddPlazoTxt.Text); DateTime Ahora = DateTime.Now; UsuarioLogic usuarioLogic = new UsuarioLogic(); if (Ahora.CompareTo(Fecha) < 1) { e.Success = false; e.ErrorMessage = "La Fecha debe ser posterior a la actual."; } else { e.Success = true; } } catch (Exception ex) { log.Fatal("Error fatal al validar la fecha de plazo para la solicitud de prestamo.", ex); throw; } }
protected void verificarContrasena(object sender, RemoteValidationEventArgs e) { try { string claveTemporal = txtPassTemporal.Text; int idUsuario = FWPConfiguration.get_ID_User(Session.SessionID); if (new bf_ca_usuarios().ValidaContrasena(idUsuario, claveTemporal)) { e.Success = true; } else { e.Success = false; e.ErrorMessage = "La Clave ingresada es incorrecta."; } } catch (Exception ex) { e.Success = false; e.ErrorMessage = "Error"; Mensajes.Error(ex.Message); } }
protected void AddUsernameTxt_Change(object sender, RemoteValidationEventArgs e) { try { string username = this.AddUsernameTxt.Text; UsuarioLogic usuariologic = new UsuarioLogic(); if (usuariologic.UsuarioExiste(username)) { e.Success = false; e.ErrorMessage = "El nombre de usuario ingresado ya existe."; } else { e.Success = true; } } catch (Exception ex) { log.Fatal("Error fatal al validar existencia de nombre de usuario.", ex); throw; } }
protected void TxtEmail_OnValidation(object sender, RemoteValidationEventArgs e) { try { string email = txtCorreo.Text; IList<co_tg_personas> listPersonas = new bf_tg_personas().GetData(new co_tg_personas { pe_email = email }); if (listPersonas.Any()) { if (listPersonas.Count == 1) { co_tg_personas persona = listPersonas.FirstOrDefault(); //rescato al usuario y le envio por Email su Contraseña if (persona != null) { e.Success = true; txtIdPersona.Value = persona.id_persona; } } else { e.Success = false; e.ErrorMessage = "Error"; Mensajes.Error( "Se encuentra más de un Usuario asociado a este Email, Favor Contactese con su Administrador de Sistema"); } } else { e.Success = false; e.ErrorMessage = "Email no se encuentra registrado"; } } catch (Exception ex) { Mensajes.Error(ex.Message); } }
protected void AddTotalLibrasTxt_Blur(object sender, RemoteValidationEventArgs e) { try { string cantidadInventario = this.AddInventarioCafeTxt.Text; string cantidadLibras = this.AddTotalLibrasTxt.Text; int CantidadInventarioDisponible = string.IsNullOrEmpty(cantidadInventario) ? 0 : Convert.ToInt32(cantidadInventario); int CantidadLibrasLiquidar = string.IsNullOrEmpty(cantidadLibras) ? 0 : Convert.ToInt32(cantidadLibras); if (CantidadLibrasLiquidar <= CantidadInventarioDisponible) e.Success = true; else { e.Success = false; e.ErrorMessage = "La cantidad sobrepasa el inventario de café disponible por " + (CantidadLibrasLiquidar - CantidadInventarioDisponible) + " libras."; } } catch (Exception ex) { log.Fatal("Error fatal al validar cantidad de libras de inventario de cafe de socio.", ex); throw; } }
public void RaiseAjaxPostBackEvent(string eventArgument, ParameterCollection extraParams) { bool success = true; string message = null; object value = null; try { if (eventArgument.IsEmpty()) { throw new ArgumentNullException("eventArgument"); } string data = null; if (this.DirectConfig != null) { JToken serviceToken = this.DirectConfig.SelectToken("config.serviceParams"); if (serviceToken != null) { data = JSON.ToString(serviceToken); } } switch (eventArgument) { case "remotevalidation": RemoteValidationEventArgs e = new RemoteValidationEventArgs(data, extraParams); this.RemoteValidation.OnValidation(e); success = e.Success; message = e.ErrorMessage; if (e.ValueIsChanged) { value = e.Value; } break; } } catch (Exception ex) { success = false; message = this.IsDebugging ? ex.ToString() : ex.Message; if (this.ResourceManager.RethrowAjaxExceptions) { throw; } } ResourceManager.ServiceResponse = new { valid=success, message, value }; }
protected void AddFecha_Change(object sender, RemoteValidationEventArgs e) { try { DateTime Fecha = DateTime.Parse(this.AddPlazoTxt.Text); DateTime Ahora = DateTime.Now; UsuarioLogic usuarioLogic = new UsuarioLogic(); if (Ahora.CompareTo(Fecha)<1) { e.Success = false; e.ErrorMessage = "La Fecha debe ser posterior a la actual."; } else e.Success = true; } catch (Exception ex) { log.Fatal("Error fatal al validar la fecha de plazo para la solicitud de prestamo.", ex); throw; } }
protected void CheckField(object sender, RemoteValidationEventArgs e) { TextField field = (TextField)sender; if (VerificaVIN(field.Text) == true) { e.Success = true; field.IndicatorIcon = Icon.Accept; ResourceManager1.RegisterIcon(Icon.Accept); field.ShowIndicator(); } else { e.Success = false; e.ErrorMessage = "<h2>Numero serie (NIV) Incorrecto</h2><h3>El NIV es el numero de serie de un vehiculo, debe " + "tener 17 caracteres obligatoriamente, este aparece en la tarjeta de circulación vehicular verifiquelo para " + "poder continuar.</h3> <br/>Ejemplo: Como localizar numero de serie en tarjeta de circulación <br/> " + "<img src='/image/NIV.jpg' height='175' width='290'/><br/><h3>NOTA: Si se trata de un auto nuevo que " + "no se ha registrado en control vehicular, el NIV se puede consultar en la factura del vehiculo.</h3>"; } System.Threading.Thread.Sleep(1000); }
protected void EditCedulaTxt_Change(object sender, RemoteValidationEventArgs e) { try { string cedula = this.EditCedulaTxt.Text; string username = this.EditUsernameTxt.Text; UsuarioLogic usuarioLogic = new UsuarioLogic(); if (usuarioLogic.CedulaExiste(cedula, username)) { e.Success = false; e.ErrorMessage = "La cedula ingresada ya existe."; } else e.Success = true; } catch (Exception ex) { log.Fatal("Error fatal al validar existencia de cedula para usuario existente.", ex); throw; } }
/// <summary> /// Valida que la contraseña actual sea correcta /// </summary> protected void PassPrev(object sender, RemoteValidationEventArgs e) { TextField field = (TextField)sender; // Encripta la contraseña introducida para compararla con la guardada en la base de datos pass = Loguin.Encriptar(field.Text); var = Loguin.ValidateUser(Convert.ToString(Session["Usuario"]), pass); // Verifica que ambos campos de contraseña sean iguales if (var.Access == true) { e.Success = true; field.IndicatorIcon = Icon.Accept; ResourceManager1.RegisterIcon(Icon.Accept); field.ShowIndicator(); } else { e.Success = false; e.ErrorMessage = "Las contraseñas actual no es correcta, verifique que introdujo adecuadamente la contraseña"; } System.Threading.Thread.Sleep(1000); }
protected void CheckField(object sender, RemoteValidationEventArgs e) { TextField field = (TextField)sender; var id = this.LoginInfo.UserId; var userAccount = UserAccount.GetById(id); if (SimplifiedHash.VerifyHash(field.Text, userAccount.Password, SimplifiedHash.HashType.sha1) == false) { e.Success = false; e.ErrorMessage = "Incorrect Password"; } else { e.Success = true; } System.Threading.Thread.Sleep(1000); }
/// <summary> /// Valida que las contraseñas sean iguales entre los /// campos contraseña y confirmar contraseña /// </summary> protected void ChechPass(object sender, RemoteValidationEventArgs e) { TextField field = (TextField)sender; // Verifica que ambos campos de contraseña sean iguales if (field.Text == txtPasswordField.Text) { e.Success = true; field.IndicatorIcon = Icon.Accept; ResourceManager1.RegisterIcon(Icon.Accept); field.ShowIndicator(); } else { e.Success = false; e.ErrorMessage = "Las contraseñas no coinciden, verifique que introdujo la misma contraseña en ambos campos"; } System.Threading.Thread.Sleep(1000); }
protected void ValidateUsernameOnDatabase(object sender, RemoteValidationEventArgs e) { string username = txtUsername.Text; var usernameInstance = ObjectContext.UserAccounts.SingleOrDefault(entity => entity.Username == username && entity.EndDate == null); if (usernameInstance != null) { e.Success = false; e.ErrorMessage = "The username exists in the database. Please select another username."; } else { e.Success = true; } }