Exemple #1
0
        private void BtnSaveNewPerson_Click(object sender, EventArgs e)
        {
            string   gender    = comboGender.Text;
            string   title     = comboTitle.Text;
            string   lastname  = txtLastname.Text;
            string   firstname = txtFirstname.Text;
            string   address   = txtAddress.Text;
            string   city      = txtCity.Text;
            string   plz       = txtPlz.Text;
            string   tel       = txtTel.Text;
            string   email     = txtEmail.Text;
            DateTime birthdate = dateTimePickerBirthdate.Value;


            Patient        patient        = new Patient(title, gender, lastname, firstname, address, city, plz, tel, email, birthdate);
            PatientenKarte patientenKarte = new PatientenKarte(patient);

            Kartei.GetKartei().AddCard(patientenKarte);

            ListViewItem item = new ListViewItem();

            item.Text = patient.id.ToString();
            item.SubItems.Add(title);
            item.SubItems.Add(gender);
            item.SubItems.Add(lastname);
            item.SubItems.Add(firstname);
            item.SubItems.Add(birthdate.ToString());


            this.Close();
        }
Exemple #2
0
        public override bool UpdateInsertObject <T>(T obj)
        {
            PatientenKarte pk      = obj as PatientenKarte;
            int            success = 0;

            using (SqlConnection connection = base.GetSqlConnection())
            {
                connection.Open();

                var cmd = new SqlCommand
                {
                    Connection  = connection,
                    CommandText = "IF NOT EXISTS (SELECT 1 FROM patient_card WITH(NOLOCK) WHERE id = @val"
                                  + "BEGIN INSERT INTO patient_card (patient_id) VALUES (@patID) END"
                                  + "ELSE BEGIN UPDATE patient_card SET patient_id = @patID WHERE id = @val END"
                };

                cmd.Parameters.Add(new SqlParameter("@val", pk.GetId()));
                cmd.Parameters.Add(new SqlParameter("@patID", pk.GetPatient().id));
                cmd.Prepare();
                success = cmd.ExecuteNonQuery();
            }

            return(success == 1);
        }
Exemple #3
0
        public List <PatientenKarte> GetAllPatientenKarten()
        {
            List <PatientenKarte> pkList = new List <PatientenKarte>();

            using (SqlConnection connection = base.GetSqlConnection())
            {
                connection.Open();
                var cmd = new SqlCommand
                {
                    Connection  = connection,
                    CommandText = "SELECT * FROM patient_card"
                };
                cmd.Prepare();
                SqlDataReader reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PatientenKarte pk = new PatientenKarte(reader.GetInt32(0), this.GetPatient(reader.GetInt32(1)));
                        this.InsertBehandlungenToCard(pk);
                        pkList.Add(pk);
                    }
                }
            }

            return(pkList);
        }
Exemple #4
0
        private void InsertBehandlungenToCard(PatientenKarte card)
        {
            BehandlungDO      bDO   = new BehandlungDO(base.connectionString);
            List <Behandlung> bList = new List <Behandlung>();

            foreach (Behandlung b in bDO.GetBehandlungenFromCard(card.GetId()))
            {
                card.AddBehandlung(b);
            }
        }
Exemple #5
0
 public void RemoveCard(PatientenKarte patientenKarte)
 {
 }
Exemple #6
0
 public void AddCard(PatientenKarte patientenKarte)
 {
 }