private void btnPatientList_Click(object sender, EventArgs e) { try { ActiveMdiChild.Close(); PatientList pl = new PatientList(); pl.MdiParent = this; pl.StartPosition = FormStartPosition.Manual; pl.Location = new Point(230, 0); pl.Show(); } catch { PatientList pl = new PatientList(); pl.MdiParent = this; pl.StartPosition = FormStartPosition.Manual; pl.Location = new Point(230, 0); pl.Show(); } }
private void EditPatient_FormClosed(object sender, FormClosedEventArgs e) { try { ActiveMdiChild.Close(); PatientList patientList = new PatientList(); patientList.MdiParent = this.ParentForm; patientList.StartPosition = FormStartPosition.Manual; patientList.Location = new Point(230, 0); patientList.Show(); } catch { PatientList patientList = new PatientList(); patientList.MdiParent = this.ParentForm; patientList.StartPosition = FormStartPosition.Manual; patientList.Location = new Point(230, 0); patientList.Show(); } }
private void btnCancel_Click(object sender, EventArgs e) { try { PatientList patientList = new PatientList(); patientList.MdiParent = this.ParentForm; patientList.StartPosition = FormStartPosition.Manual; patientList.Location = new Point(230, 0); patientList.Show(); this.Close(); } catch { PatientList patientList = new PatientList(); patientList.MdiParent = this.ParentForm; patientList.StartPosition = FormStartPosition.Manual; patientList.Location = new Point(230, 0); patientList.Show(); this.Close(); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (txtLname.Text == "" || txtFname.Text == "" || txtMI.Text == "" || txtAddress.Text == "" || txtContact.Text == "" || birth.Text == "" || cmbGender.Text == "" || cmbStatus.Text == "") { MessageBox.Show("Please fill up all fields."); return; } else { OleDbDataAdapter updateAdapter = new OleDbDataAdapter(); string update = "UPDATE patients set fname = '" + txtFname.Text.ToUpper() + "', lname ='" + txtLname.Text.ToUpper() + "', mid_initial ='" + txtMI.Text.ToUpper() + "', address ='" + txtAddress.Text.ToUpper() + "',contact = '" + txtContact.Text.ToUpper() + "', birthday = '" + birth.Value + "',gender ='" + cmbGender.Text.ToUpper() + "',civil_status ='" + cmbStatus.Text.ToUpper() + "' ,updated_at = NOW() WHERE ID = " + Convert.ToInt32(pId) + " "; conn.Open(); updateAdapter.InsertCommand = new OleDbCommand(update, conn); updateAdapter.InsertCommand.ExecuteNonQuery(); MessageBox.Show("Updated..."); conn.Close(); PatientList patienList = new PatientList(); patienList.MdiParent = this.ParentForm; patienList.StartPosition = FormStartPosition.Manual; patienList.Location = new Point(230, 0); patienList.Show(); this.Close(); } } catch { } }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtLname.Text == "" || txtFname.Text == "" || txtMI.Text == "" || txtAddress.Text == "" || txtContact.Text == "" || bday.Text == "" || cmbGender.Text == "" || cmbStatus.Text == "") { MessageBox.Show("Please fill up all fields."); return; } else { OleDbDataAdapter addAdapter = new OleDbDataAdapter(); string addSql = "INSERT into patients(fname, lname, mid_initial, address, contact, birthday, gender, civil_status, created_at) values('" + txtFname.Text.ToUpper() + "','" + txtLname.Text.ToUpper() + "','" + txtMI.Text.ToUpper() + "','" + txtAddress.Text.ToUpper() + "','" + txtContact.Text.ToUpper() + "','" + bday.Value + "','" + cmbGender.Text.ToUpper() + "','" + cmbStatus.Text.ToUpper() + "', NOW())"; conn.Open(); addAdapter.InsertCommand = new OleDbCommand(addSql, conn); addAdapter.InsertCommand.ExecuteNonQuery(); MessageBox.Show("Added..."); conn.Close(); PatientList patienList = new PatientList(); patienList.MdiParent = this.ParentForm; patienList.StartPosition = FormStartPosition.Manual; patienList.Location = new Point(230, 0); patienList.Show(); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }