private void insertBtn_Click(object sender, EventArgs e)
        {
            var sql = "INSERT INTO Patients (Fname, Mint, Lname, Sex, Address, Date_of_birth, Perscription, Diagnosis) " +
                      "VALUES (@firstName, @middleInt, @lastName, @sex, @address, @dateBirth, @perscription, @diagnosis);";

            string connectionString = Emergancy_Room_Database.Properties.Settings.Default.ERDatabaseConnectionString;

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                con.Open();
                using (var cmd = new SqlCommand(sql, con))
                {
                    cmd.Parameters.AddWithValue("@firstName", fNameTB.Text);
                    cmd.Parameters.AddWithValue("@middleInt", MITB.Text);
                    cmd.Parameters.AddWithValue("@lastName", lNameTB.Text);
                    cmd.Parameters.AddWithValue("@sex", SexTB.Text);
                    cmd.Parameters.AddWithValue("@address", addressTB.Text);
                    cmd.Parameters.AddWithValue("@dateBirth", dateOfBirthTB.Text);
                    cmd.Parameters.AddWithValue("@perscription", perscriptionTB.Text);
                    cmd.Parameters.AddWithValue("@diagnosis", diagnosisTB.Text);
                    cmd.ExecuteNonQuery();
                }
            }
            this.Hide();
            displayPatientTable displayPatientTable = new displayPatientTable();

            displayPatientTable.ShowDialog();
            this.Close();
        }
Exemple #2
0
        private void displayPatientsBtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            displayPatientTable displayPatientTable = new displayPatientTable();

            displayPatientTable.ShowDialog();
            this.Close();
        }
        private void enterBtn_Click(object sender, EventArgs e)
        {
            int id  = int.Parse(idChoiceTb.Text);
            var sql = "DELETE FROM Patients WHERE Patient_Id = @id";

            string connectionString = Emergancy_Room_Database.Properties.Settings.Default.ERDatabaseConnectionString;

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                con.Open();
                using (var cmd = new SqlCommand(sql, con))
                {
                    cmd.Parameters.AddWithValue("@id", id);
                    cmd.ExecuteNonQuery();
                }
            }
            this.Hide();
            displayPatientTable displayPatientTable = new displayPatientTable();

            displayPatientTable.ShowDialog();
            this.Close();
        }
Exemple #4
0
        private void updateBtn_Click(object sender, EventArgs e)
        {
            int id      = int.Parse(IDlbl.Text);
            int roomNum = int.Parse(RoomTB.Text);
            int bill    = int.Parse(billTB.Text);
            int call_id = int.Parse(callIDTB.Text);
            var sql     = "UPDATE Patients SET Fname = @firstName, Mint = @middleInt, Lname = @lastName, Sex = @sex, Address = @address, " +
                          "Date_of_birth = @dateBirth, Room# = @room, Bill = @bill, Perscription = @pers, Diagnosis = @diag, Call_id = @callId WHERE Patient_Id = @id";

            string connectionString = Emergancy_Room_Database.Properties.Settings.Default.ERDatabaseConnectionString;

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                con.Open();
                using (var cmd = new SqlCommand(sql, con))
                {
                    cmd.Parameters.AddWithValue("@firstName", fNameTB.Text);
                    cmd.Parameters.AddWithValue("@middleInt", MITB.Text);
                    cmd.Parameters.AddWithValue("@lastName", lNameTB.Text);
                    cmd.Parameters.AddWithValue("@sex", RoomTB.Text);
                    cmd.Parameters.AddWithValue("@address", addressTB.Text);
                    cmd.Parameters.AddWithValue("@dateBirth", dateOfBirthTB.Text);
                    cmd.Parameters.AddWithValue("@room", roomNum);
                    cmd.Parameters.AddWithValue("@id", id);
                    cmd.Parameters.AddWithValue("@bill", bill);
                    cmd.Parameters.AddWithValue("@pers", perscriptionTB.Text);
                    cmd.Parameters.AddWithValue("@diag", diagnosisTB.Text);
                    cmd.Parameters.AddWithValue("@callId", call_id);
                    cmd.ExecuteNonQuery();
                }
            }
            this.Hide();
            displayPatientTable displayPatientTable = new displayPatientTable();

            displayPatientTable.ShowDialog();
            this.Close();
        }