コード例 #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         ActiveMdiChild.Close();
         PatientList patienList = new PatientList();
         patienList.MdiParent     = this;
         patienList.StartPosition = FormStartPosition.Manual;
         patienList.Location      = new Point(150, 0);
         patienList.Show();
     }
     catch
     {
         PatientList patienList = new PatientList();
         patienList.MdiParent     = this;
         patienList.StartPosition = FormStartPosition.Manual;
         patienList.Location      = new Point(150, 0);
         patienList.Show();
     }
 }
コード例 #2
0
ファイル: NewPatient.cs プロジェクト: jareeed/Dental_Clinic
        private void btnSave_Click(object sender, EventArgs e)
        {
            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
            {
                try
                {
                    OleDbDataAdapter addAdapter = new OleDbDataAdapter();
                    string           addSql     = "INSERT into patient(fname,lname, minitial, address,contact,birthday,gender,civilstatus,created_at,updated_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(), 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(150, 0);
                    patienList.Show();

                    this.Close();
                }
                catch
                {
                }
            }
        }