protected void Button1_Click(object sender, EventArgs e) { try { ValidRepository vr = new ValidRepository(); lblError.Visible = false; if (vr.ValidaVacio(TxtEstado.Text)) { usuario_muro um = new usuario_muro(); um.id_usuario = this.usuario.Usuario.id_usuario; um.estado = TxtEstado.Text; um.f_publicacion = DateTime.Now; mr.InsertarEstado(um); TxtEstado.Text = string.Empty; CargaMuro(); } else { lblError.Visible = true; } } catch (Exception) { Response.Redirect("~/Error.aspx"); } }
private bool ValidaDatosFisicos() { bool errores = false; Label lblError; ValidRepository vr = new ValidRepository(); pnlErroresDatosFisicos.Controls.Clear(); //Valida vacios if (!vr.ValidaVacio(TxtPeso.Text)) { lblError = new Label(); lblError.Text = "* Su peso no puede estar vacío"; lblError.CssClass = "text-error"; pnlErroresDatosFisicos.Controls.Add(lblError); errores = true; } if (!vr.ValidaVacio(TxtAltura.Text)) { lblError = new Label(); lblError.Text = "* La altura no puede estar vacía"; lblError.CssClass = "text-error"; pnlErroresDatosFisicos.Controls.Add(lblError); errores = true; } if (rblActividad.SelectedValue == string.Empty) { lblError = new Label(); lblError.Text = "* Debe seleccionar su nivel de actividad"; lblError.CssClass = "text-error"; pnlErroresDatosFisicos.Controls.Add(lblError); errores = true; } if (rblObjetivo.SelectedValue == string.Empty) { lblError = new Label(); lblError.Text = "* Debe establecer su objetivo"; lblError.CssClass = "text-error"; pnlErroresDatosFisicos.Controls.Add(lblError); errores = true; } return(!errores); }
private static void Main(string[] args) { ValidRepository repo = new ValidRepository(); var yestoday = DateTime.UtcNow.AddHours(8).AddDays(-1); //var yestoday = DateTime.UtcNow.AddHours(8); var filterBeginDate = new DateTime( yestoday.Year, yestoday.Month, yestoday.Day); //var filterBeginDate = new DateTime(2017, 11, 01, 00, 00, 00); var filterEndDate = new DateTime( yestoday.Year, yestoday.Month, yestoday.Day, 23, 59, 59); repo.ComparerEinvoiceNumber(filterBeginDate, filterEndDate); string comparerDate = string.Format("核對期間:{0}~{1}", filterBeginDate, filterEndDate); repo.EmailSend(comparerDate, yestoday.ToString("yyyy\\/MM\\/dd")); repo.Dispose(); }
protected void ingresar_Click(object sender, EventArgs e) { ValidRepository vr = new ValidRepository(); lblError.Visible = false; if (vr.ValidaNumerico(porcion.Text)) { string id = Hidden1.Value; alimento a = ar.BuscarAlimentoId(id); usuario_alimento diario = new usuario_alimento(); UsuarioCompleto UsuarioCompleto = (UsuarioCompleto)Session["UsuarioCompleto"]; DateTime fecha; if (Session["agregar"] == null) { Session["fecha_diario"] = null; fecha = DateTime.Now; } else { fecha = (DateTime)Session["fecha_diario"]; Session["agregar"] = null; } diario.id_alimento = a.id_alimento; diario.id_comida_tipo = Convert.ToInt32(ddlComidaTipo.SelectedValue); diario.id_usuario = Convert.ToInt32(UsuarioCompleto.Usuario.id_usuario); diario.cantidad = Convert.ToInt32(porcion.Text); diario.f_ingreso = fecha; if (diario != null) { dr.IngresarAlimentoDiario(diario); Response.Redirect("Home.aspx"); } } else { lblError.Visible = true; } }
private bool ValidaInfoGral() { bool errores = false; Label lblError; ValidRepository vr = new ValidRepository(); pnlErroresInfoGral.Controls.Clear(); //Valida vacios if (!vr.ValidaVacio(TxtNombre.Text)) { lblError = new Label(); lblError.Text = "* El nombre no puede estar vacío"; lblError.CssClass = "text-error"; pnlErroresInfoGral.Controls.Add(lblError); errores = true; } if (rblGenero.SelectedValue == string.Empty) { lblError = new Label(); lblError.Text = "* Debe seleccionar su género"; lblError.CssClass = "text-error"; pnlErroresInfoGral.Controls.Add(lblError); errores = true; } if (!vr.ValidaVacio(TxtFechaNacimiento.Text)) { lblError = new Label(); lblError.Text = "* La fecha de nacimiento no puede estar vacía"; lblError.CssClass = "text-error"; pnlErroresInfoGral.Controls.Add(lblError); errores = true; } return(!errores); }
private bool ValidaForm() { bool errores = false; Label lblError; ValidRepository vr = new ValidRepository(); try { pnlErrores.Controls.Clear(); //Valida vacios if (!vr.ValidaVacio(TxtEmail.Text)) { lblError = new Label(); lblError.Text = "* El email no puede estar vacío"; lblError.CssClass = "text-error"; pnlErrores.Controls.Add(lblError); errores = true; } if (!vr.ValidaVacio(TxtPass.Text)) { lblError = new Label(); lblError.Text = "* La contraseña no puede estar vacía"; lblError.CssClass = "text-error"; pnlErrores.Controls.Add(lblError); errores = true; } return(!errores); } catch (Exception) { throw; } }
private bool ValidaForm() { bool errores = false; Label lblError; ValidRepository vr = new ValidRepository(); try { pnlErrores.Controls.Clear(); //Valida vacios if (!vr.ValidaVacio(txtEmail.Text)) { lblError = new Label(); lblError.Text = "* El email no puede estar vacío"; lblError.CssClass = "text-error"; pnlErrores.Controls.Add(lblError); errores = true; } else { if (!vr.ValidaMail(txtEmail.Text)) { lblError = new Label(); lblError.Text = "* Email Inválido"; lblError.CssClass = "text-error"; pnlErrores.Controls.Add(lblError); errores = true; } } if (!vr.ValidaVacio(txtPassword.Text)) { lblError = new Label(); lblError.Text = "* La contraseña no puede estar vacía"; lblError.CssClass = "text-error"; pnlErrores.Controls.Add(lblError); errores = true; } else { //Valida longitud de password, que tenga entre 4 y 12 caracteres, por ejemplo if (!vr.ValidaRangoLen(txtPassword.Text, 4, 12)) { lblError = new Label(); lblError.Text = "* La contraseña debe tener entre 4 y 12 caracteres"; lblError.CssClass = "text-error"; pnlErrores.Controls.Add(lblError); errores = true; } } //Valida iguales if (!vr.ValidaIguales(txtPassword.Text, txtPassword2.Text)) { lblError = new Label(); lblError.Text = "* Las contraseñas tienen que coincidir"; lblError.CssClass = "text-error"; pnlErrores.Controls.Add(lblError); errores = true; } if (rblTipoUsuario.SelectedValue == string.Empty) { lblError = new Label(); lblError.Text = "* Debe seleccionar un tipo de usuario"; lblError.CssClass = "text-error"; pnlErrores.Controls.Add(lblError); errores = true; } return(!errores); } catch (Exception) { throw; } }