Beispiel #1
0
        private void enterBtn_Click(object sender, EventArgs e)
        {
            int   id     = int.Parse(IDlbl.Text);
            int   patID  = int.Parse(patientIDTB.Text);
            float amount = float.Parse(billAmountTB.Text);
            var   sql    = "UPDATE Bills SET Patient = @patID, Bill_amount = @amount, Bill_payed = @payed, Payment_method = @method WHERE Bill_Id = @billID";

            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("@patID", patID);
                    cmd.Parameters.AddWithValue("@amount", amount);
                    cmd.Parameters.AddWithValue("@payed", billPayedTB.Text);
                    cmd.Parameters.AddWithValue("@method", paymentMethodTB.Text);
                    cmd.Parameters.AddWithValue("@billID", id);
                    cmd.ExecuteNonQuery();
                }
            }
            this.Hide();
            displayBillsTable displayBillsTable = new displayBillsTable();

            displayBillsTable.ShowDialog();
            this.Close();
        }
Beispiel #2
0
        private void insertBtn_Click(object sender, EventArgs e)
        {
            var sql = "INSERT INTO Bills (Patient, Bill_amount, Bill_payed, Payment_Method) " +
                      "VALUES (@patient, @bill_amount, @bill_payed, @payment_method);";

            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("@patient", patientIDTB.Text);
                    cmd.Parameters.AddWithValue("@bill_amount", billAmountTB.Text);
                    cmd.Parameters.AddWithValue("@bill_payed", billPayedTB.Text);
                    cmd.Parameters.AddWithValue("@payment_method", paymentMethodTB.Text);
                    cmd.ExecuteNonQuery();
                }
            }
            this.Hide();
            displayBillsTable displayBillsTable = new displayBillsTable();

            displayBillsTable.ShowDialog();
            this.Close();
        }
Beispiel #3
0
        private void displayBillsBtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            displayBillsTable displayBillsTable = new displayBillsTable();

            displayBillsTable.ShowDialog();
            this.Close();
        }
Beispiel #4
0
        private void enterBtn_Click(object sender, EventArgs e)
        {
            int id  = int.Parse(idChoiceTb.Text);
            var sql = "DELETE FROM Bills WHERE Bill_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();
            displayBillsTable displayBillsTable = new displayBillsTable();

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