protected void BtnSave_Click(object sender, EventArgs e) { try { var dbr = new PetCheckDBEntities(); var date = DateTime.Parse(TxtRDate.Text); var time = TimeSpan.Parse(TxtRTime.Text); DateTime CDateTime = date + time; dbr.Cita.Add(new Cita() { Doctor = int.Parse(cmbRDoc.SelectedValue), Mascota = int.Parse(cmbRPet.SelectedValue), Servicio = int.Parse(cmbRServ.SelectedValue), Fecha = CDateTime }); dbr.SaveChanges(); Response.Redirect("~/Views/Agenda.aspx?Er=1"); } catch (DbEntityValidationException) { Response.Redirect("~/Views/Agenda.aspx?Er=2"); } }
protected void Page_Load(object sender, EventArgs e) { db = new PetCheckDBEntities(); CList = db.Cita.ToList(); if (Request.QueryString["k"] != null && Request.QueryString["k"] != "") { var date = DateTime.Parse(Request.QueryString["k"]); CList = CList.Where(st => st.Fecha.Day == date.Day).ToList(); } if (Request.QueryString["New"] != null) { foreach (var doc in db.Usuario.Where(st => st.Tipo == true).ToList()) { cmbRDoc.Items.Add(new ListItem() { Value = doc.idUsuario.ToString(), Text = doc.Nombre }); } foreach (var pet in db.Mascota.ToList()) { cmbRPet.Items.Add(new ListItem() { Value = pet.idMascota.ToString(), Text = pet.Nombre }); } foreach (var srv in db.Servicio.ToList()) { cmbRServ.Items.Add(new ListItem() { Enabled = true, Text = srv.Nombre, Value = srv.idServicio.ToString() }); } } }
protected void Page_Load(object sender, EventArgs e) { db = new PetCheckDBEntities(); ServList = db.Servicio.ToList(); if (Request.QueryString["K"] != null) { ServList = ServList.Where(st => st.Nombre.ToLower().Contains(Request.QueryString["K"].ToLower())).ToList(); } }
protected void Page_Load(object sender, EventArgs e) { db = new PetCheckDBEntities(); main = (Usuario)Session["UserLoged"]; UserList = db.Usuario.Where(st => st.Contraseña != null).ToList(); if (Request.QueryString["K"] != null) { UserList = UserList.Where(st => st.Alias.ToLower().Contains(Request.QueryString["K"].ToLower())).ToList(); } }
protected void Page_Load(object sender, EventArgs e) { UserData = (Usuario)Session["UserLoged"]; GetChartData(); C = new List <Cita>(); CToday = new List <Cita>(); CWeek = new List <Cita>(); var db = new PetCheckDBEntities(); var time = DateTime.Now.TimeOfDay; C = db.Cita.ToList(); C = C.Where(st => st.Fecha.Month == DateTime.Now.Month).ToList(); CToday = C.Where(st => st.Fecha.Day == DateTime.Today.Day).ToList(); CWeek = C.Where(st => st.Fecha >= DateTime.Today && st.Fecha <= DateTime.Today.AddDays(7)).ToList(); }
protected void Page_Load(object sender, EventArgs e) { db = new PetCheckDBEntities(); UserList = db.Usuario.Where(st => st.Contraseña == null).ToList(); if (Request.QueryString["K"] != null) { UserList = UserList.Where(st => st.Nombre.ToLower().Contains(Request.QueryString["K"].ToLower())).ToList(); } if (Request.QueryString["Own"] != null) { var i = int.Parse(Request.QueryString["Own"]); Edit = db.Usuario.First(st => st.idUsuario == i); } }
protected void GetChartData() { var C = new PetCheckDBEntities().Cita.Where(st => st.Fecha.Year == DateTime.Now.Year).ToList(); for (int Month = 1; Month <= 12; Month++) { var aux = C.Where(st => st.Fecha.Month == Month).ToList(); if (Month != 12) { ChartData += String.Format("{0},", aux.Count); } else { ChartData += String.Format("{0}", aux.Count); } } }
protected void BtnSave_Click(object sender, EventArgs e) { try { var dbr = new PetCheckDBEntities(); dbr.Usuario.Add(new Usuario() { Nombre = TxtRName.Text, Telefono = int.Parse(TxtRPhone.Text), Direccion = TxtRAddress.Text }); dbr.SaveChanges(); Response.Redirect("~/Views/Clientes.aspx?Er=1"); } catch (DbEntityValidationException) { Response.Redirect("~/Views/Clientes.aspx?Er=2"); } }
protected void BtnLogin_Click(object sender, EventArgs e) { PetCheckDBEntities db = new PetCheckDBEntities(); var Psw = Encrypter.ToHash(TxtPsw.Text); var query = db.Usuario.Where(st => st.Alias == TxtUser.Text && st.Contraseña == Psw).ToList(); if (query.Count == 1) { var user = query.First(); Session["UserLoged"] = user; Session.Timeout = 10; Response.Redirect("~/Views/Inicio.aspx"); } else { string s = "<div class=\"alert alert-danger alert-dismissible fade show\" role=\"alert\"><strong> Algo salio mal! </ strong > La contraseña o el usuario son incorrectos. <button type = \"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"> <span aria-hidden=\"true\">×</span> </button></div>"; msgbox.InnerHtml = s; } }
protected void BtnSave_Click(object sender, EventArgs e) { try { var dbr = new PetCheckDBEntities(); dbr.Servicio.Add(new Servicio() { Nombre = TxtRName.Text, Precio = int.Parse(TxtRPrice.Text), Descripcion = TxtRDescription.Text, Clinica = 1 }); dbr.SaveChanges(); Response.Redirect("~/Views/Servicios.aspx?Er=1"); } catch (DbEntityValidationException) { Response.Redirect("~/Views/Servicios.aspx?Er=2"); } }
protected void BtnCreate_Click(object sender, EventArgs e) { try { var dbr = new PetCheckDBEntities(); dbr.Usuario.Add(new Usuario() { Nombre = TxtRName.Text, Contraseña = Encrypter.ToHash(TxtRPws.Text), Alias = TxtRUser.Text, Tipo = false }); dbr.SaveChanges(); Response.Redirect("~/Views/Usuarios.aspx?Er=1"); } catch (DbEntityValidationException) { Response.Redirect("~/Views/Usuarios.aspx?Er=2"); } }
protected void BtnSave_Click(object sender, EventArgs e) { try { var dbr = new PetCheckDBEntities(); dbr.Mascota.Add(new Mascota() { Nombre = TxtRName.Text, Genero = CmbRGender.Text, Raza = TxtRRace.Text, Especie = TxtRSpecies.Text, Estatura = double.Parse(TxtRTall.Text), Peso = double.Parse(TxtRWeight.Text), Fecha_Nacimiento = DateTime.Parse(TxtRDate.Text) }); dbr.SaveChanges(); Response.Redirect("~/Views/Mascotas.aspx?Er=1"); } catch (DbEntityValidationException) { Response.Redirect("~/Views/Mascotas.aspx?Er=2"); } }
protected void Page_Load(object sender, EventArgs e) { try { db = new PetCheckDBEntities(); PetList = db.Mascota.ToList(); if (Request.QueryString["K"] != null) { PetList = PetList.Where(st => st.Nombre.ToLower().Contains(Request.QueryString["K"].ToLower())).ToList(); } if (Request.QueryString["Own"] != null) { var i = int.Parse(Request.QueryString["Own"]); Edit = db.Mascota.First(st => st.idMascota == i); } }catch (Exception) { db = new PetCheckDBEntities(); PetList = new List <Mascota>(); } }
protected void BtnRegisterCita_Click(object sender, EventArgs e) { try { var dbr = new PetCheckDBEntities(); var id = int.Parse(Request.QueryString["Cita"]); var C = db.Cita.Where(st => st.idCita == id).First(); dbr.Consulta.Add(new Consulta() { Doctor = C.Doctor, Mascota = C.Mascota, Servicio = C.Servicio, Fecha = C.Fecha, Diagnostico = TxtCRDiag.Text }); dbr.SaveChanges(); Response.Redirect("~/Views/Consultas.aspx?Er=1"); } catch (DbEntityValidationException) { Response.Redirect("~/Views/Consultas.aspx?Er=2"); } }