protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = GV_Pilots.Rows[e.RowIndex]; int idPilot = Convert.ToInt32(GV_Pilots.DataKeys[e.RowIndex].Values[0]); string mail = (row.FindControl("txtEmail") as TextBox).Text; string name = (row.FindControl("txtFstName") as TextBox).Text; string lstName = (row.FindControl("txtLstName") as TextBox).Text; string cert = (row.FindControl("txtCert") as TextBox).Text; string flightTime = (row.FindControl("txtTVuelo") as TextBox).Text; string certDate = (row.FindControl("txtCertDate") as TextBox).Text; using (DroidikaContextDataContext ctx = new DroidikaContextDataContext()) { dPilot pil = (from p in ctx.dPilots where p.id == idPilot select p).FirstOrDefault(); pil.email = mail; pil.fstName = name; pil.lstName = lstName; pil.certificate = char.Parse(cert); pil.flightTime = Int32.Parse(flightTime); pil.certificateDate = DateTime.Parse(certDate); ctx.SubmitChanges(); } GV_Pilots.EditIndex = -1; this.BindGrid(); }
protected bool ValidaUser2() { try { using (DroidikaContextDataContext dbContext = new DroidikaContextDataContext()) { dPilot pilot = dbContext.dPilots.Where(x => x.email == txtUsr.Text && x.password == txtPwd.Text).SingleOrDefault(); if (pilot == null) { LabelMsg.Text = "Usuario incorrecto"; Session["Name"] = ""; } else { Session["Name"] = pilot.fstName + " " + pilot.lstName; Session["ID"] = pilot.id; Session["Login"] = true; txtUsr.Text = ""; txtPwd.Text = ""; LabelMsg.Visible = true; LabelMsg.Text = ""; Response.Redirect("Drones.aspx"); } } } catch (Exception ex) { LabelMsg.Visible = true; LabelMsg.Text = ex.Message; } return(true); }
protected void btnAccion_Click(object sender, EventArgs e) { try { if (idPilot > 0) { using (DroidikaContextDataContext context = new DroidikaContextDataContext()) { dPilot piloto = (from p in context.dPilots where p.id == idPilot select p).FirstOrDefault(); name = piloto.fstName + " " + piloto.lstName; } } //rvCertificado.Reset(); rvCertificado.LocalReport.ReportPath = "Certificado.rdlc"; rvCertificado.LocalReport.Refresh(); } catch (Exception ex) { } }