//运行exe自动加载所有数据 private void Form1_Load(object sender, EventArgs e) { tAdapter.Fill(tTable); pAdapter.Fill(this.pTable); staticPTable = this.pTable; this.dgvPatients.DataSource = pTable; }
private void Refresh() { DataSet1TableAdapters.PatientTableAdapter ta = new DataSet1TableAdapters.PatientTableAdapter(); DataSet1.PatientDataTable dt = ta.GetDataPatient(); dataGridView1.DataSource = dt; dataGridView1.Columns[0].HeaderText = "Id"; dataGridView1.Columns[1].HeaderText = "Nombre"; dataGridView1.Columns[2].HeaderText = "Apellido"; dataGridView1.Columns[3].HeaderText = "Email"; }
private bool IsPatient() { DataSet1TableAdapters.PatientTableAdapter patient = new DataSet1TableAdapters.PatientTableAdapter(); DataSet1.PatientDataTable dt = patient.GetDataByUP(txtUserName.Text, txtPassword.Text); if (dt.Rows.Count == 0) { return(false); } Tools.userType = UserType.Patient; DataRow dr = dt.Rows[0]; Tools.UserName = Convert.ToString(dr["UserName"]); return(true); }
private void txtBuscarPac_KeyPress(object sender, KeyPressEventArgs e) { try { DataSet1TableAdapters.PatientTableAdapter ta = new DataSet1TableAdapters.PatientTableAdapter(); DataSet1.PatientDataTable dt = ta.GetDataByFilteringP(txtBuscarPac.Text, txtBuscarPac.Text, txtBuscarPac.Text); ta.FillBy1FilteringP(dt, txtBuscarPac.Text, txtBuscarPac.Text, txtBuscarPac.Text); dataGridView1.DataSource = dt; } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
private void btnEditar_Click(object sender, EventArgs e) { int?id = GetId(); //MessageBox.Show(id.ToString()); if (id != null) { DataSet1TableAdapters.PatientTableAdapter ta = new DataSet1TableAdapters.PatientTableAdapter(); DataSet1.PatientDataTable pt = ta.GetDataByIdPatient((int)id); DataSet1.PatientRow row = (DataSet1.PatientRow)pt.Rows[0]; txtNombre.Text = row.patientName; txtApellido.Text = row.patientLastName; txtEmail.Text = row.patientEmail; } else { MessageBox.Show("No hay registros"); } }
private void btnOK_Click(object sender, EventArgs e) { if (userNameTextBox.Text.Trim() == "" || passwordTextBox.Text.Trim() == "") { MessageBox.Show("Username & password Error"); return; } DataSet1TableAdapters.PatientTableAdapter patient = new DataSet1TableAdapters.PatientTableAdapter(); DataSet1.PatientDataTable dt = patient.GetDataByUserName(userNameTextBox.Text); if (dt.Rows.Count > 0 && UserName.Trim() == "") { MessageBox.Show("Username Error"); return; } else { this.Validate(); this.patientBindingSource.EndEdit(); this.patientTableAdapter.Update(this.dataSet1.Patient); DialogResult = DialogResult.OK; } }