/// <summary>
 /// Updates the operation.
 /// </summary>
 /// <param name="operationData">The operation data.</param>
 /// <returns></returns>
 public bool UpdateOperation(OperationData operationData)
 {
     using (ChannelFactory<ISPDBL> cf = new ChannelFactory<ISPDBL>(binding,endpointAddress)) {
         ISPDBL spdBL = cf.CreateChannel();
         return spdBL.UpdateOperation(operationData);
     }
 }
 /// <summary>
 /// Adds the operation.
 /// </summary>
 /// <param name="op">The op.</param>
 public void addOperation(OperationData op)
 {
     if (operations == null) {
         operations = new List<OperationData>();
     }
     operations.Add(op);
 }
        public bool Update(OperationData operation)
        {
            try {

                long tstart = DateTime.Now.Ticks;

                DbUtil.OpenConnection();

                if (updateByIdCmd == null) {
                    updateByIdCmd = DbUtil.CreateCommand(SQL_UPDATE_BY_ID, DbUtil.CurrentConnection);

                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@operationdate", DbType.String));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@team", DbType.String));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@process", DbType.String));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@diagnoses", DbType.String));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@performed", DbType.String));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@additionalinformation", DbType.String));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@medication", DbType.String));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@intdiagnoses", DbType.Int64));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@ppps", DbType.Int64));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@result", DbType.Int64));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@kathDays", DbType.Int64));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@organ", DbType.Int64));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@opResult", DbType.String));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@operationID", DbType.Int64));
                }

                ((IDataParameter)updateByIdCmd.Parameters["@operationdate"]).Value = operation.Date;
                ((IDataParameter)updateByIdCmd.Parameters["@team"]).Value = operation.Team;
                ((IDataParameter)updateByIdCmd.Parameters["@process"]).Value = operation.Process;
                ((IDataParameter)updateByIdCmd.Parameters["@diagnoses"]).Value = operation.Diagnoses;
                ((IDataParameter)updateByIdCmd.Parameters["@performed"]).Value = operation.Performed;
                ((IDataParameter)updateByIdCmd.Parameters["@additionalinformation"]).Value = operation.Additionalinformation;
                ((IDataParameter)updateByIdCmd.Parameters["@medication"]).Value = operation.Medication;
                ((IDataParameter)updateByIdCmd.Parameters["@intdiagnoses"]).Value = operation.IntDiagnoses;
                ((IDataParameter)updateByIdCmd.Parameters["@ppps"]).Value = (long)operation.Ppps;
                ((IDataParameter)updateByIdCmd.Parameters["@result"]).Value = (long)operation.Result;
                ((IDataParameter)updateByIdCmd.Parameters["@kathDays"]).Value = operation.KathDays;
                ((IDataParameter)updateByIdCmd.Parameters["@organ"]).Value = (long)operation.Organ;
                ((IDataParameter)updateByIdCmd.Parameters["@opResult"]).Value = operation.OpResult;
                ((IDataParameter)updateByIdCmd.Parameters["@operationID"]).Value = operation.OperationId;

                bool ok = updateByIdCmd.ExecuteNonQuery() == 1;

                long tend = DateTime.Now.Ticks;
                log.Info("Update Operation: " + operation.OperationId + " " + ok + " " + ((tend - tstart) / 10000) + "ms");

                return ok;
            } catch (Exception e) {
                log.Error(e.Message);
                throw e;
            } finally {
                DbUtil.CloseConnection();
            }
        }
 private OperationData fillOperation(IDataReader rdr)
 {
     OperationData operation = new OperationData();
     operation.OperationId = Convert.ToInt64(rdr["operationID"]);
     operation.Date = DateTime.Parse(Convert.ToString(rdr["operationdate"]), DateTimeFormatInfo.InvariantInfo);
     operation.Team = Convert.ToString(rdr["team"]);
     operation.Process = Convert.ToString(rdr["process"]);
     operation.Diagnoses = Convert.ToString(rdr["diagnoses"]);
     operation.Performed = Convert.ToString(rdr["performed"]);
     operation.PatientId = Convert.ToInt64(rdr["patientid"]);
     operation.Additionalinformation = Convert.ToString(rdr["additionalinformation"]);
     operation.Medication = Convert.ToString(rdr["medication"]);
     operation.IntDiagnoses = Convert.ToInt64(rdr["intdiagnoses"]);
     operation.Ppps = (PPPS)Convert.ToInt64(rdr["ppps"]);
     operation.Result = (Result)Convert.ToInt64(rdr["result"]);
     operation.KathDays = Convert.ToInt64(rdr["kathDays"]);
     operation.Organ = (Organ)Convert.ToInt64(rdr["organ"]);
     operation.OpResult = Convert.ToString(rdr["opResult"]);
     return operation;
 }
        private void handleOrganImage(float topMargin, OperationData op, PrintablePage a4Page, PrintablePage a3Page)
        {
            Bitmap imgOrgan;

            switch (op.Organ) {
                case Organ.penis:
                    imgOrgan = SPD.GUI.Properties.Resources.Penis;
                    imgOrgan.SetResolution(250, 250);
                    addPrintableImageObject(1, a4Page, a3Page, imgOrgan, 980, (int)topMargin + 15);
                    break;
                case Organ.renal:
                    imgOrgan = SPD.GUI.Properties.Resources.Reneal;
                    imgOrgan.SetResolution(500, 500);
                    addPrintableImageObject(1, a4Page, a3Page, imgOrgan, 980, (int)topMargin + 15);
                    break;
                case Organ.testicle:
                    imgOrgan = SPD.GUI.Properties.Resources.Testicle;
                    imgOrgan.SetResolution(400, 400);
                    addPrintableImageObject(1, a4Page, a3Page, imgOrgan, 970, (int)topMargin + 15);
                    break;
                default:
                    imgOrgan = null;
                    break;
            }
        }
        /// <summary>
        /// Parses the operations.
        /// </summary>
        /// <param name="jsonOperations">The json operations.</param>
        /// <returns></returns>
        private static IList<OperationData> parseOperations(ArrayList jsonOperations)
        {
            IList<OperationData> opList = new List<OperationData>();

            foreach (Hashtable htop in jsonOperations) {
                OperationData op = new OperationData();

                if (htop.ContainsKey(operation_operationId)) {
                    op.OperationId = Convert.ToInt64(htop[operation_operationId]);
                }

                if (htop.ContainsKey(operation_Date)) {
                    op.Date = DateTime.Parse(Convert.ToString(htop[operation_Date]), DateTimeFormatInfo.InvariantInfo);
                }

                if (htop.ContainsKey(operation_Team)) {
                    op.Team = Convert.ToString(htop[operation_Team]);
                }

                if (htop.ContainsKey(operation_process)) {
                    op.Process = Convert.ToString(htop[operation_process]);
                }

                if (htop.ContainsKey(operation_diagnoses)) {
                    op.Diagnoses = Convert.ToString(htop[operation_diagnoses]);
                }

                if (htop.ContainsKey(operation_performed)) {
                    op.Performed = Convert.ToString(htop[operation_performed]);
                }

                if (htop.ContainsKey(operation_patientId)) {
                    op.PatientId = Convert.ToInt64(htop[operation_patientId]);
                }

                if (htop.ContainsKey(operation_addInfo)) {
                    op.Additionalinformation = Convert.ToString(htop[operation_addInfo]);
                }

                if (htop.ContainsKey(operation_medication)) {
                    op.Medication = Convert.ToString(htop[operation_medication]);
                }

                if (htop.ContainsKey(operation_intDiagnoses)) {
                    op.IntDiagnoses = Convert.ToInt64(htop[operation_intDiagnoses]);
                }

                if (htop.ContainsKey(operation_ppps)) {
                    op.Ppps = (PPPS)Convert.ToInt64(htop[operation_ppps]);
                } else {
                    op.Ppps = PPPS.notDefined;
                }

                if (htop.ContainsKey(operation_result)) {
                    op.Result = (Result)Convert.ToInt64(htop[operation_result]);
                } else {
                    op.Result = Result.notDefined;
                }

                if (htop.ContainsKey(operation_kathDays)) {
                    op.KathDays = Convert.ToInt64(htop[operation_kathDays]);
                }

                if (htop.ContainsKey(operation_organ)) {
                    op.Organ = (Organ)Convert.ToInt64(htop[operation_organ]);
                } else {
                    op.Organ = Organ.undefined;
                }

                if (htop.ContainsKey(operation_opResult)) {
                    op.OpResult = Convert.ToString(htop[operation_opResult]);
                }

                opList.Add(op);
            }

            return opList;
        }
 /// <summary>
 /// Updates the operation.
 /// </summary>
 /// <param name="operationData">The operation data.</param>
 /// <returns></returns>
 public virtual bool UpdateOperation(OperationData operationData)
 {
     IOperation operationDB = Database.CreateOperation();
     return operationDB.Update(operationData);
 }
 private static String opPerformed(OperationData operation)
 {
     if (operation == null || String.IsNullOrEmpty(operation.Performed)) {
         return String.Empty;
     }
     return "<tr><td class='what' valign='top'><nobr>OP-Performed: </nobr></td><td colspan='7'>" + operation.Performed + "</td></tr>" + Environment.NewLine;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NewOperationStoreEventArgs"/> class.
 /// </summary>
 /// <param name="operation">The operation.</param>
 public NewOperationStoreEventArgs(OperationData operation)
 {
     this.operation = operation;
 }
 /// <summary>
 /// Inserts the operation.
 /// </summary>
 /// <param name="operationData">The operation data.</param>
 /// <returns></returns>
 public virtual OperationData InsertOperation(OperationData operationData)
 {
     IOperation operationDB = Database.CreateOperation();
     long id = operationDB.Insert(operationData);
     if (id != 0) {
         operationData.OperationId = id;
         return operationData;
     } else {
         return null;
     }
 }
 /// <summary>
 /// Inits the specified opdata.
 /// </summary>
 /// <param name="opdata">The opdata.</param>
 /// <param name="currentPatient">The current patient</param>
 public void Init(OperationData opdata, PatientData currentPatient)
 {
     this.operation = opdata;
     this.currentPatient = currentPatient;
     Clear();
     textBoxOPDate.Text = DateTime.Now.ToShortDateString();
     if (currentPatient != null){
         this.labelPatientData.Text = currentPatient.Id.ToString() + " " + currentPatient.FirstName + " " + currentPatient.SurName;
     }
     if (opdata != null) {
         textBoxOPDate.Text = operation.Date.ToShortDateString();
         textBoxOPDiagnoses.Text = operation.Diagnoses;
         textBoxOPProcess.Text = operation.Process;
         textBoxOPTeam.Text = operation.Team;
         textBoxPerformedOP.Text = operation.Performed;
         textBoxAdditionalInformation.Text = operation.Additionalinformation;
         textBoxMedication.Text = operation.Medication;
         textBoxIntdiagnoses.Text = operation.IntDiagnoses.ToString();
         comboBoxPPPS.Text = operation.Ppps.ToString();
         comboBoxResult.Text = operation.Result.ToString();
         comboBoxKathDays.Text = operation.KathDays.ToString();
         comboBoxOrgan.Text = operation.Organ.ToString();
         textBoxOpResult.Text = operation.OpResult;
     }
 }
        private OperationData createRandomOperation(long pId)
        {
            OperationData operation = new OperationData();
            operation.PatientId = pId;
            operation.Additionalinformation = getRandomString(10, 50, true);
            operation.Date = new DateTime(DateTime.Now.Year - 8 + rand.Next(0, 9), rand.Next(1, 13), rand.Next(1, 28));
            operation.Diagnoses = getRandomString(10, 30, true);
            operation.IntDiagnoses = rand.Next(0, 11);
            operation.KathDays = rand.Next(0, 10);
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < rand.Next(0, 3); i++ )
            {
                sb.Append(getRandomString(5, 10, true)).Append(rand.Next(0, 10)).Append(Environment.NewLine);
            }

            operation.Medication = sb.ToString();

            switch (rand.Next(0, 4))
            {
                case 0:
                    operation.Organ = Organ.penis;
                    break;
                case 1:
                    operation.Organ = Organ.renal;
                    break;
                case 2:
                    operation.Organ = Organ.testicle;
                    break;
                case 3:
                    operation.Organ = Organ.undefined;
                    break;
            }
            operation.Performed = getRandomString(1, 30, true);

            switch (rand.Next(0,3))
            {
                case 0:
                    operation.Ppps = PPPS.notDefined;
                    break;
                case 1:
                    operation.Ppps = PPPS.pp;
                    break;
                case 2:
                    operation.Ppps = PPPS.ps;
                    break;

            }

            operation.Process = getRandomString(10, 30, true);
            switch (rand.Next(0, 3))
            {
                case 0:
                    operation.Result = Result.nok;
                    break;
                case 1:
                    operation.Result = Result.notDefined;
                    break;
                case 3:
                    operation.Result = Result.ok;
                    break;
            }
            operation.Team = getRandomString(10, 60, true);

            return operation;
        }
 /// <summary>
 /// Compares the operations by date.
 /// </summary>
 /// <param name="x">The OperatioData 1</param>
 /// <param name="y">The OperatioData 2</param>
 /// <returns></returns>
 private static int CompareOperationsByDate(OperationData x, OperationData y)
 {
     if (x == null) {
         if (y == null) {
             return 0;
         } else {
             return -1;
         }
     } else {
         if (y == null) {
             return 1;
         } else {
             int comp = x.Date.CompareTo(y.Date);
             if (comp == 0) {
                 return x.OperationId.CompareTo(y.OperationId);
             } else {
                 return comp;
             }
         }
     }
 }
        public void OperationUpdateTest()
        {
            IOperation operationDB = Database.CreateOperation();
            OperationData operation = new OperationData(0, DateTime.Now, "Tolles Team", "Toller Proccess", "diagnosissss", "alles performed", pID, "add Info", "Med1, Med2", 35, PPPS.pp, Result.nok, 5, Organ.renal);
            long oID = operationDB.Insert(operation);
            OperationData operationWithID = new OperationData(oID, operation.Date, operation.Team, operation.Process, operation.Diagnoses, operation.Performed, pID, operation.Additionalinformation, operation.Medication, operation.IntDiagnoses, operation.Ppps, operation.Result, operation.KathDays, operation.Organ);

            operation = operationDB.FindByOperationId(oID);

            Assert.AreEqual(operation.Date.ToShortDateString(), operationWithID.Date.ToShortDateString());
            Assert.AreEqual(operation.Date.ToShortTimeString(), operationWithID.Date.ToShortTimeString());
            Assert.AreEqual(operation.Diagnoses, operationWithID.Diagnoses);
            Assert.AreEqual(operation.OperationId, operationWithID.OperationId);
            Assert.AreEqual(operation.PatientId, operationWithID.PatientId);
            Assert.AreEqual(operation.Performed, operationWithID.Performed);
            Assert.AreEqual(operation.Process, operationWithID.Process);
            Assert.AreEqual(operation.Team, operationWithID.Team);
            Assert.AreEqual(operation.Additionalinformation, operationWithID.Additionalinformation);
            Assert.AreEqual(operation.Medication, operationWithID.Medication);
            Assert.AreEqual(operation.IntDiagnoses, operationWithID.IntDiagnoses);
            Assert.AreEqual(operation.Ppps, operationWithID.Ppps);
            Assert.AreEqual(operation.Result, operationWithID.Result);
            Assert.AreEqual(operation.KathDays, operationWithID.KathDays);

            operation.Date = DateTime.MaxValue;
            operation.Team = "New Team";
            operation.Process = "new process";
            operation.Diagnoses = "New Diagnoses";
            operation.Performed = "new performed";
            operation.Additionalinformation = "new addinfo";
            operation.Medication = "new medicatino";
            operation.IntDiagnoses = 17;
            operation.Ppps = PPPS.notDefined;
            operation.Result = Result.notDefined;
            operation.KathDays = 17;

            operationDB.Update(operation);
            OperationData operationchanged = operationDB.FindByOperationId(oID);

            Assert.AreEqual(operation.Date.ToShortDateString(), operationchanged.Date.ToShortDateString());
            Assert.AreEqual(operation.Date.ToShortTimeString(), operationchanged.Date.ToShortTimeString());
            Assert.AreEqual(operation.Diagnoses, operationchanged.Diagnoses);
            Assert.AreEqual(operation.OperationId, operationchanged.OperationId);
            Assert.AreEqual(operation.PatientId, operationchanged.PatientId);
            Assert.AreEqual(operation.Performed, operationchanged.Performed);
            Assert.AreEqual(operation.Process, operationchanged.Process);
            Assert.AreEqual(operation.Team, operationchanged.Team);
            Assert.AreEqual(operation.Additionalinformation, operationchanged.Additionalinformation);
            Assert.AreEqual(operation.Medication, operationchanged.Medication);
            Assert.AreEqual(operation.IntDiagnoses, operationchanged.IntDiagnoses);
            Assert.AreEqual(operation.Ppps, operationchanged.Ppps);
            Assert.AreEqual(operation.Result, operationchanged.Result);
            Assert.AreEqual(operation.KathDays, operationchanged.KathDays);

            Assert.IsTrue(operationDB.Delete(oID));

            Assert.IsNull(operationDB.FindByOperationId(oID));
        }
Example #15
0
        /// <summary>
        /// Inserts the operation.
        /// </summary>
        /// <param name="operationData">The operation data.</param>
        /// <returns></returns>
        public override OperationData InsertOperation(OperationData operationData)
        {
            OperationData operation = base.InsertOperation(operationData);

            if (operation != null) {
                if (operationBuffer != null) {
                    operationBuffer.Add(operation); // Add new operation also to buffer
                }
                return operation;
            } else {
                return null;
            }
        }
        public void OperationInsertTest()
        {
            IOperation operationDB = Database.CreateOperation();
            OperationData operation = new OperationData(0, DateTime.Now, "Tolles Team", "Toller Proccess", "diagnosissss", "alles performed", pID, "add Info", "Med1, Med2", 35, PPPS.pp, Result.nok, 5, Organ.penis);
            long oID = operationDB.Insert(operation);
            OperationData operationWithID = new OperationData(oID, operation.Date, operation.Team, operation.Process, operation.Diagnoses, operation.Performed, pID, operation.Additionalinformation, operation.Medication, operation.IntDiagnoses, operation.Ppps, operation.Result, operation.KathDays, operation.Organ);

            operation = operationDB.FindByOperationId(oID);

            Assert.AreEqual(operation.Date.ToShortDateString(), operationWithID.Date.ToShortDateString());
            Assert.AreEqual(operation.Date.ToShortTimeString(), operationWithID.Date.ToShortTimeString());
            Assert.AreEqual(operation.Diagnoses, operationWithID.Diagnoses);
            Assert.AreEqual(operation.OperationId, operationWithID.OperationId);
            Assert.AreEqual(operation.PatientId, operationWithID.PatientId);
            Assert.AreEqual(operation.Performed, operationWithID.Performed);
            Assert.AreEqual(operation.Process, operationWithID.Process);
            Assert.AreEqual(operation.Team, operationWithID.Team);
            Assert.AreEqual(operation.Additionalinformation, operationWithID.Additionalinformation);
            Assert.AreEqual(operation.Medication, operationWithID.Medication);
            Assert.AreEqual(operation.IntDiagnoses, operationWithID.IntDiagnoses);
            Assert.AreEqual(operation.Ppps, operationWithID.Ppps);
            Assert.AreEqual(operation.Result, operationWithID.Result);
            Assert.AreEqual(operation.KathDays, operationWithID.KathDays);

            Assert.IsTrue(operationDB.Delete(oID));

            Assert.IsNull(operationDB.FindByOperationId(oID));
        }
Example #17
0
 /// <summary>
 /// Updates the operation.
 /// </summary>
 /// <param name="operationData">The operation data.</param>
 /// <returns></returns>
 public override bool UpdateOperation(OperationData operationData)
 {
     bool ok = base.UpdateOperation(operationData);
     if (ok && operationBuffer != null) { // update in buffer as well
         operationBuffer.Remove(operationData);
         operationBuffer.Add(operationData);
     }
     return ok;
 }
 private static void fillMedications(OperationData op, IList<string> medications, IList<int> medDays)
 {
     foreach (string med in op.Medication.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) {
         if (!String.IsNullOrEmpty(med)) {
             string tmpMed = med.Trim();
             string[] parts = tmpMed.Split(new String[] { }, StringSplitOptions.None);
             int days = 0;
             try {
                 days = Int32.Parse(parts[parts.Length - 1]);
             } catch (Exception) { }
             medDays.Add(days + 1); // + 1 => CR ignoring OP Day.
             if (days > 0) {
                 StringBuilder sb = new StringBuilder();
                 for (int j = 0; j < (parts.Length - 1); j++) {
                     sb.Append(parts[j]);
                     if (j < (parts.Length - 2)) {
                         sb.Append(" ");
                     }
                 }
                 tmpMed = sb.ToString();
             } else {
                 tmpMed = med;
             }
             medications.Add(tmpMed);
         }
     }
 }
        public long Insert(OperationData odata)
        {
            try {

                long tstart = DateTime.Now.Ticks;

                DbUtil.OpenConnection();

                if (insertByIdCmd == null) {
                    insertByIdCmd = DbUtil.CreateCommand(SQL_INSERT_BY_ID + DbUtil.GetAppendix("operationID"), DbUtil.CurrentConnection);
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@operationdate", DbType.String));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@team", DbType.String));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@process", DbType.String));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@diagnoses", DbType.String));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@performed", DbType.String));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@patientid", DbType.Int64));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@additionalinformation", DbType.String));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@medication", DbType.String));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@intdiagnoses", DbType.Int64));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@ppps", DbType.Int64));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@result", DbType.Int64));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@kathDays", DbType.Int64));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@organ", DbType.Int64));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@opResult", DbType.String));
                }

                string opDate = odata.Date.ToString("G", DateTimeFormatInfo.InvariantInfo);

                ((IDataParameter)insertByIdCmd.Parameters["@operationdate"]).Value = opDate;
                ((IDataParameter)insertByIdCmd.Parameters["@team"]).Value = odata.Team;
                ((IDataParameter)insertByIdCmd.Parameters["@process"]).Value = odata.Process;
                ((IDataParameter)insertByIdCmd.Parameters["@diagnoses"]).Value = odata.Diagnoses;
                ((IDataParameter)insertByIdCmd.Parameters["@performed"]).Value = odata.Performed;
                ((IDataParameter)insertByIdCmd.Parameters["@patientid"]).Value = odata.PatientId;
                ((IDataParameter)insertByIdCmd.Parameters["@additionalinformation"]).Value = odata.Additionalinformation;
                ((IDataParameter)insertByIdCmd.Parameters["@medication"]).Value = odata.Medication;
                ((IDataParameter)insertByIdCmd.Parameters["@intdiagnoses"]).Value = odata.IntDiagnoses;
                ((IDataParameter)insertByIdCmd.Parameters["@ppps"]).Value = (long)odata.Ppps;
                ((IDataParameter)insertByIdCmd.Parameters["@result"]).Value = (long)odata.Result;
                ((IDataParameter)insertByIdCmd.Parameters["@kathDays"]).Value = (long)odata.KathDays;
                ((IDataParameter)insertByIdCmd.Parameters["@organ"]).Value = (long)odata.Organ;
                ((IDataParameter)insertByIdCmd.Parameters["@opResult"]).Value = odata.OpResult;

                Object insertRet = insertByIdCmd.ExecuteScalar();

                long tend = DateTime.Now.Ticks;
                log.Info("Insert Operation: " + " " + ((tend - tstart) / 10000) + "ms");

                return DbUtil.getGeneratedId((IDbCommand)insertByIdCmd, lastInsertedRowCmd, insertRet);
            } catch (Exception e) {
                log.Error(e.Message);
                throw e;
            } finally {
                DbUtil.CloseConnection();
            }
        }
        /// <summary>
        /// Prints the a3 temperatur curve.
        /// </summary>
        /// <param name="patients">The patients.</param>
        /// <param name="weeks">The weeks.</param>
        /// <param name="copies">The copies.</param>
        /// <param name="printFormat">The print format.</param>
        /// <param name="opParam">The op.</param>
        public void PrintA3TemperaturCurve(IList<PatientData> patients, int weeks, int copies, PrintFormat printFormat, OperationData opParam)
        {
            if (patients == null || patients.Count == 0) {
                return;
            }

            if (copies < 1 || copies > 20) {
                return;
            }

            if (opParam != null && patients.Count != 1) {
                return;
            }

            IList<PrintablePage> printablePageA4 = new List<PrintablePage>();
            IList<PrintablePage> printablePageA3 = new List<PrintablePage>();

            PrintableDocument pd = new PrintableDocument();

            Font headlineFont = new Font("Arial", 18.0f, FontStyle.Underline | FontStyle.Bold);
            Font dateFont = new Font("Arial", 10.5f, FontStyle.Bold);
            Font printFont = new Font("Arial", 11, FontStyle.Bold);
            Font medicationFont = new Font("Arial", 10, FontStyle.Bold);
            Font symbolFont = new Font("Arial", 22, FontStyle.Bold);

            float leftMargin = 65;
            float topMargin = 30;

            foreach (PatientData patient in patients) {
                int daysSinceOp = 0;
                OperationData op;
                if (opParam == null) {
                    op = patComp.GetLastOperationByPatientID(patient.Id);
                } else {
                    op = opParam;
                }

                IList<string> medications = new List<string>();
                IList<int> medDays = new List<int>();
                bool hasCatheter = op.KathDays > 0;
                long kathDays = op.KathDays + 1; //CR ignoring OP Day.

                fillMedications(op, medications, medDays);

                //count = 0;

                DateTime opDate = op.Date;
                for (int week = 0; week < weeks; week++) {
                    //PrintablePage pp = new PrintablePage();
                    PrintablePage a4Page = new PrintablePage();
                    PrintablePage a3Page = new PrintablePage();

                    //Organ Images...
                    handleOrganImage(topMargin, op, a4Page, a3Page);

                    addPrintableTextObject(1, a4Page, a3Page, "Paediatric Urology Team Austria", headlineFont, new SolidBrush(Color.FromArgb(0, 61, 120)), leftMargin, topMargin + (float)(0 * 17.56));

                    addPrintableTextObject(1, a4Page, a3Page, "Paediatric Urology Team Austria", headlineFont, new SolidBrush(Color.FromArgb(0, 61, 120)), leftMargin, topMargin + (float)(0 * 17.56));
                    addPrintableTextObject(1, a4Page, a3Page, op.Date.Month.ToString() + " " + op.Date.Year.ToString() + "   Page: " + (week + 1), dateFont, Brushes.Red, leftMargin, topMargin + (float)28.74);

                    addPrintableTextObject(1, a4Page, a3Page, "Additional Information:", printFont, Brushes.Black, leftMargin + (float)610, topMargin + 10F);
                    //pp.AddPrintableObject(new PrintableTextObject("Notes - Final Report:", printFont, Brushes.Black, leftMargin + (float)635, topMargin + 120F));

                    addPrintableLineObject(1, a4Page, a3Page, Pens.Black, (int)leftMargin + 610, (int)topMargin + 27, (int)leftMargin + 635 + 175, (int)topMargin + 27);
                    //pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin + 635, (int)topMargin + 137, (int)leftMargin + 635 + 200, (int)topMargin + 137));

                    Bitmap imgKinderurologieLogo = SPD.GUI.Properties.Resources.KinderurologieLogo;
                    imgKinderurologieLogo.SetResolution(408, 408);
                    addPrintableImageObject(1, a4Page, a3Page, imgKinderurologieLogo, 500, (int)topMargin);

                    addPrintableRectangleObject(1, a4Page, a3Page, Brushes.Yellow, (int)leftMargin - 5 + 3, (int)topMargin + 198 - (2 * 17), 600, (int)printFont.GetHeight());

                    //Additional Info Rectangle
                    addPrintableRectangleObject(1, a4Page, a3Page, Pens.Black, (int)(leftMargin + 605), (int)topMargin, 300, 220);
                    addPrintableLineObject(1, a4Page, a3Page, Pens.Black, (int)(leftMargin + 605), (int)topMargin + 110, (int)(leftMargin + 605 + 300), (int)topMargin + 110);

                    List<string> addInfo = new List<string>();
                    addInfo.Add(op.Additionalinformation.Replace(Environment.NewLine, " "));
                    addInfo = this.SplitStringsForPrinting(40, addInfo);
                    int count = 0;
                    foreach (string line in addInfo) {
                        addPrintableTextObject(1, a4Page, a3Page, line, printFont, Brushes.Black, leftMargin + (float)610, topMargin + 27F + count * 17);
                        count++;
                    }

                    float y = (float)topMargin + (float)(3 * 17.56) + 9;

                    addPrintableTextObject(1, a4Page, a3Page, "Patient ID: " + patient.Id.ToString(), printFont, Brushes.Black, leftMargin, y);
                    y += 17;
                    addPrintableTextObject(1, a4Page, a3Page, "First name: " + patient.FirstName.Replace(Environment.NewLine, " "), printFont, Brushes.Black, leftMargin, y);
                    y += 17;
                    addPrintableTextObject(1, a4Page, a3Page, "Surname: " + patient.SurName.Replace(Environment.NewLine, " "), printFont, Brushes.Black, leftMargin, y);
                    y += 17;
                    if (patient.DateOfBirth != null && patient.DateOfBirth.Year > 1800) {
                        addPrintableTextObject(1, a4Page, a3Page, "Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - Age: " + StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth), printFont, Brushes.Black, leftMargin, y);
                        y += 17;
                    }
                    addPrintableTextObject(1, a4Page, a3Page, "Resident of Asmara: " + patient.ResidentOfAsmara.ToString(), printFont, Brushes.Black, leftMargin, y);
                    y += 17;
                    addPrintableTextObject(1, a4Page, a3Page, "OP Date: " + op.Date.ToShortDateString(), printFont, Brushes.Black, leftMargin, y);
                    y += 17;
                    addPrintableTextObject(1, a4Page, a3Page, "OP Diagnosis:", printFont, Brushes.Black, leftMargin, y);
                    if (op.Diagnoses.Replace(Environment.NewLine, " ").Length > 60) {
                        List<string> diagnosesList = new List<string>();
                        diagnosesList.Add(op.Diagnoses.Replace(Environment.NewLine, " "));
                        diagnosesList = SplitStringsForPrinting(60, diagnosesList);
                        if (diagnosesList.Count >= 1) {
                            addPrintableTextObject(1, a4Page, a3Page, diagnosesList[0], printFont, Brushes.Black, leftMargin + 110, y);
                        }
                        if (diagnosesList.Count >= 2) {
                            y += 17;
                            addPrintableTextObject(1, a4Page, a3Page, diagnosesList[1], printFont, Brushes.Black, leftMargin + 110, y);
                        }
                    } else {
                        addPrintableTextObject(1, a4Page, a3Page, op.Diagnoses.Replace(Environment.NewLine, " "), printFont, Brushes.Black, leftMargin + 110, y);
                    }
                    y += 17;
                    addPrintableTextObject(1, a4Page, a3Page, "Performed OP: " + op.Performed.Replace(Environment.NewLine, " "), printFont, Brushes.Black, leftMargin, y);
                    y += 17;
                    addPrintableTextObject(1, a4Page, a3Page, "OP Team: " + op.Team.Replace(Environment.NewLine, " "), printFont, Brushes.Black, leftMargin, y);

                    //Gray Box
                    addPrintableRectangleObject(1, a4Page, a3Page, Brushes.LightGray, 40, 270, 6 * 182, 30);
                    //vertical lines
                    for (int j = 0; j < 7; j++) {
                        addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40 + j * 182, 270, 40 + j * 182, 270 + 7 * 30);
                    }
                    //horizintal lines
                    for (int j = 0; j < 8; j++) {
                        addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40, 270 + j * 30, 40 + 6 * 182, 270 + j * 30);
                    }

                    ////Beschriftung begin

                    if (kathDays > (week * 12)) {
                        addPrintableTextObject(1, a4Page, a3Page, "catheter", printFont, Brushes.Black, 41, 305 + 5 * 30);
                    }

                    count = 0;
                    foreach (string medication in medications) {
                        if (week == 0) {
                            addPrintableTextObject(1, a4Page, a3Page, medication, medicationFont, Brushes.Black, 41, 305 + count * 30);
                        } else if (medDays[medications.IndexOf(medication)] >= ((week * 12) + 1)) {
                            addPrintableTextObject(1, a4Page, a3Page, medication, medicationFont, Brushes.Black, 41, 305 + count * 30);
                        }
                        for (int j = 0; j < 6; j++) {
                            int currentMedDay = (week * 12 + j) + 1;
                            if ((currentMedDay > 1) && (((currentMedDay - 1) % 6) != 0) && (medDays[count] >= (currentMedDay + 1))) {
                                addPrintableTextObject(1, a4Page, a3Page, "      -", symbolFont, Brushes.Black, 41 + j * 182, (305 + count * 30) - 10);
                            }
                            if ((medDays[count] == currentMedDay)) {
                                addPrintableTextObject(1, a4Page, a3Page, "      -          >", symbolFont, Brushes.Black, 41 + j * 182, (305 + count * 30) - 10);
                            }
                        }
                        count++;
                    }

                    for (int j = 0; j < 6; j++) {
                        int currentMedDay = (week * 12 + j) + 1;
                        if (hasCatheter && (currentMedDay == kathDays)) {
                            if (((kathDays - 1) % 12) == 0) {
                                addPrintableTextObject(1, a4Page, a3Page, "                 DK ex ", printFont, Brushes.Black, 41 + j * 182, 305 + 5 * 30);
                            } else {
                                addPrintableTextObject(1, a4Page, a3Page, "DK ex ", printFont, Brushes.Black, 41 + j * 182, 305 + 5 * 30);
                            }
                        } else if (hasCatheter && (currentMedDay < kathDays) && ((currentMedDay - 1) % 12) != 0) {
                            addPrintableTextObject(1, a4Page, a3Page, "      -", symbolFont, Brushes.Black, 41 + j * 182, 305 + 5 * 30 - 9);
                        }
                    }

                    //Kalendar Überschrift
                    for (int j = 0; j < 6; j++) {
                        addPrintableTextObject(1, a4Page, a3Page, "     " + opDate.DayOfWeek.ToString() + " " + opDate.ToShortDateString(), dateFont, Brushes.Blue, 41 + j * 182, 275);
                        if (daysSinceOp == 0) {
                            addPrintableTextObject(1, a4Page, a3Page, "op", dateFont, Brushes.Red, 41 + j * 182, 275);
                        } else {
                            addPrintableTextObject(1, a4Page, a3Page, daysSinceOp.ToString(), dateFont, Brushes.Red, 41 + j * 182, 275);
                        }
                        opDate = opDate.AddDays(1.0);
                        daysSinceOp++;
                    }

                    //// Beschriftung ende

                    int yNursing = 500;
                    addPrintableTextObject(1, a4Page, a3Page, "Nursing and medical orders:", printFont, Brushes.Black, 41, yNursing);
                    //vertical lines
                    for (int j = 0; j < 7; j++) {
                        addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40 + j * 182, yNursing + 20, 40 + j * 182, yNursing + 150);
                    }
                    //horizintal lines
                    addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40, yNursing + 20, 40 + 6 * 182, yNursing + 20);
                    addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40, yNursing + 150, 40 + 6 * 182, yNursing + 150);

                    int yTemperature = 670;
                    addPrintableTextObject(1, a4Page, a3Page, "Temperature:", printFont, Brushes.Black, 41, yTemperature);
                    //vertical lines
                    for (int j = 0; j < 7; j++) {
                        addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40 + j * 182, yTemperature + 20, 40 + j * 182, yTemperature + 20 + 1/*=number of lines*/ * 30);
                    }
                    //horizintal lines
                    for (int j = 0; j < 2; j++) {
                        addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40, yTemperature + 20 + j * 30, 40 + 6 * 182, yTemperature + 20 + j * 30);
                    }

                    //Local status
                    int yLocalStatus = 735;
                    addPrintableTextObject(1, a4Page, a3Page, "Localstatus:", printFont, Brushes.Black, 41, yLocalStatus);
                    //vertical lines
                    for (int j = 0; j < 7; j++) {
                        addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40 + j * 182, yLocalStatus + 20, 40 + j * 182, yLocalStatus + 20 + 1/*=number of lines*/ * 30);
                    }
                    //horizintal lines
                    for (int j = 0; j < 2; j++) {
                        addPrintableLineObject(1, a4Page, a3Page, Pens.Black, 40, yLocalStatus + 20 + j * 30, 40 + 6 * 182, yLocalStatus + 20 + j * 30);
                    }

                    printablePageA4.Add(a4Page);
                    a4Page = new PrintablePage();

                    a3Page.AddPrintableObject(new PrintableLineObject(Pens.LightGray, 0, A4smallSite + 45, A4LargeSite, A4smallSite + 45));

                    //2. seite

                    addPrintableTextObject(2, a4Page, a3Page, "Patient ID: " + patient.Id.ToString(), printFont, Brushes.Black, leftMargin, 13 + 45);

                    //Gray Box
                    int calendary = (int)topMargin + 45;
                    addPrintableRectangleObject(2, a4Page, a3Page, Brushes.LightGray, 40, calendary, 6 * 182, 30);
                    //vertical lines
                    for (int j = 0; j < 7; j++) {
                        addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40 + j * 182, calendary, 40 + j * 182, calendary + 7 * 30);
                    }
                    //horizintal lines
                    for (int j = 0; j < 8; j++) {
                        addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40, calendary + j * 30, 40 + 6 * 182, calendary + j * 30);
                    }

                    ////Beschriftung begin

                    if (kathDays > ((week * 12) + 6)) {
                        addPrintableTextObject(2, a4Page, a3Page, "catheter", printFont, Brushes.Black, 41, calendary + 5 + 6 * 30);
                    }

                    count = 0;
                    foreach (string medication in medications) {
                        if (medDays[medications.IndexOf(medication)] >= ((week * 12) + 7)) {
                            addPrintableTextObject(2, a4Page, a3Page, medication, medicationFont, Brushes.Black, 41, calendary + 5 + 30 + count * 30);
                        }
                        for (int j = 0; j < 6; j++) {
                            int currentMedDay = (week * 12 + j) + 1 + 6;
                            if (((currentMedDay - 1) % 6) != 0 && (medDays[count] >= (currentMedDay + 1))) {
                                addPrintableTextObject(2, a4Page, a3Page, "      -", symbolFont, Brushes.Black, 41 + j * 182, (calendary + 5 + 30 + count * 30) - 10);
                            }
                            if ((medDays[count] == currentMedDay)) {
                                addPrintableTextObject(2, a4Page, a3Page, "      -          >", symbolFont, Brushes.Black, 41 + j * 182, (calendary + 5 + 30 + count * 30) - 10);
                            }
                        }
                        count++;
                    }

                    for (int j = 0; j < 6; j++) {
                        int currentMedDay = (week * 12 + j) + 1 + 6;
                        if (hasCatheter && (currentMedDay == kathDays)) {
                            if (((kathDays - 7) % 12) == 0) {
                                addPrintableTextObject(2, a4Page, a3Page, "                 DK ex ", printFont, Brushes.Black, 41 + j * 182, calendary + 5 + 6 * 30);
                            } else {
                                addPrintableTextObject(2, a4Page, a3Page, "DK ex ", printFont, Brushes.Black, 41 + j * 182, calendary + 5 + 6 * 30);
                            }
                        } else if (hasCatheter && (currentMedDay < kathDays) && ((currentMedDay - 7) % 12) != 0) {
                            addPrintableTextObject(2, a4Page, a3Page, "      -", symbolFont, Brushes.Black, 41 + j * 182, calendary + 5 + 6 * 30 - 9);
                        }
                    }

                    //Kalendar Überschrift
                    for (int j = 0; j < 6; j++) {
                        addPrintableTextObject(2, a4Page, a3Page, "     " + opDate.DayOfWeek.ToString() + " " + opDate.ToShortDateString(), dateFont, Brushes.Blue, 41 + j * 182, calendary + 5);
                        if (daysSinceOp == 0) {
                            addPrintableTextObject(2, a4Page, a3Page, "op", dateFont, Brushes.Red, 41 + j * 182, calendary + 5);
                        } else {
                            addPrintableTextObject(2, a4Page, a3Page, daysSinceOp.ToString(), dateFont, Brushes.Red, 41 + j * 182, calendary + 5);
                        }
                        opDate = opDate.AddDays(1.0);
                        daysSinceOp++;
                    }

                    //// Beschriftung ende

                    yNursing = 295;
                    addPrintableTextObject(2, a4Page, a3Page, "Nursing and medical orders:", printFont, Brushes.Black, 41, yNursing);
                    //vertical lines
                    for (int j = 0; j < 7; j++) {
                        addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40 + j * 182, yNursing + 20, 40 + j * 182, yNursing + 150);
                    }
                    //horizintal lines
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40, yNursing + 20, 40 + 6 * 182, yNursing + 20);
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40, yNursing + 150, 40 + 6 * 182, yNursing + 150);

                    yTemperature = 455;
                    addPrintableTextObject(2, a4Page, a3Page, "Temperature:", printFont, Brushes.Black, 41, yTemperature);
                    //vertical lines
                    for (int j = 0; j < 7; j++) {
                        addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40 + j * 182, yTemperature + 20, 40 + j * 182, yTemperature + 20 + 1/*=number of lines*/ * 30);
                    }
                    //horizintal lines
                    for (int j = 0; j < 2; j++) {
                        addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40, yTemperature + 20 + j * 30, 40 + 6 * 182, yTemperature + 20 + j * 30);
                    }

                    //Local Status
                    yLocalStatus = 520;
                    addPrintableTextObject(2, a4Page, a3Page, "Localstatus:", printFont, Brushes.Black, 41, yLocalStatus);
                    //vertical lines
                    for (int j = 0; j < 7; j++) {
                        addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40 + j * 182, yLocalStatus + 20, 40 + j * 182, yLocalStatus + 20 + 1/*=number of lines*/ * 30);
                    }
                    //horizintal lines
                    for (int j = 0; j < 2; j++) {
                        addPrintableLineObject(2, a4Page, a3Page, Pens.Black, 40, yLocalStatus + 20 + j * 30, 40 + 6 * 182, yLocalStatus + 20 + j * 30);
                    }

                    int y3rdBlock = 580;
                    int widthlastbox = 335;
                    int xft = 41;
                    int xcont = xft + widthlastbox + xft;
                    int xfo = xft + widthlastbox + xft + widthlastbox + xft;

                    addPrintableTextObject(2, a4Page, a3Page, "Further Treatment for discharge:", printFont, Brushes.Black, xft, y3rdBlock);
                    addPrintableTextObject(2, a4Page, a3Page, "Control(s) planned for:", printFont, Brushes.Black, xcont, y3rdBlock);
                    addPrintableTextObject(2, a4Page, a3Page, "Further operation planned for:", printFont, Brushes.Black, xfo, y3rdBlock);

                    //3 oberen Linien der Boxen
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft, y3rdBlock + 20, xft + widthlastbox, y3rdBlock + 20);
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft, y3rdBlock + 20, xft + widthlastbox + xft + widthlastbox, y3rdBlock + 20);
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft + widthlastbox + xft, y3rdBlock + 20, xft + widthlastbox + xft + widthlastbox + xft + widthlastbox, y3rdBlock + 20);
                    //3 unteren Linien der Boxen
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft, y3rdBlock + 177, xft + widthlastbox, y3rdBlock + 177);
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft, y3rdBlock + 200, xft + widthlastbox + xft + widthlastbox, y3rdBlock + 200);
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft + widthlastbox + xft, y3rdBlock + 200, xft + widthlastbox + xft + widthlastbox + xft + widthlastbox, y3rdBlock + 200);

                    //vertikale Linien der Boxen
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft, y3rdBlock + 20, xft, y3rdBlock + 177);
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox, y3rdBlock + 20, xft + widthlastbox, y3rdBlock + 177);
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft, y3rdBlock + 20, xft + widthlastbox + xft, y3rdBlock + 200);
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft + widthlastbox, y3rdBlock + 20, xft + widthlastbox + xft + widthlastbox, y3rdBlock + 200);
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft + widthlastbox + xft, y3rdBlock + 20, xft + widthlastbox + xft + widthlastbox + xft, y3rdBlock + 200);
                    addPrintableLineObject(2, a4Page, a3Page, Pens.Black, xft + widthlastbox + xft + widthlastbox + xft + widthlastbox, y3rdBlock + 20, xft + widthlastbox + xft + widthlastbox + xft + widthlastbox, y3rdBlock + 200);

                    addPrintableTextObject(2, a4Page, a3Page, "Treatment completed: yes        no", printFont, Brushes.Black, xft, y3rdBlock + 180);
                    addPrintableRectangleObject(2, a4Page, a3Page, Pens.Black, xft + 195, y3rdBlock + 180, 20, 20);
                    addPrintableRectangleObject(2, a4Page, a3Page, Pens.Black, xft + 246, y3rdBlock + 180, 20, 20);

                    printablePageA4.Add(a4Page);
                    printablePageA3.Add(a3Page);
                }
            }

            pd.PrintPageList = printablePageA3;
            pd.duplicate(copies);
            pd.Landscape = false;
            pd.DocumentName = "SPD Temperature Curve A3";

            PrintDialog printDialog = null;

            if (printFormat == PrintFormat.A3) {
                pd.PaperKindOrNothing = PaperKind.A3;

                printDialog = pd.DoPrint();

                if (printDialog != null) {
                    pd.PaperKindOrNothing = PaperKind.A4;
                    pd.Landscape = true;
                    pd.PrintPageList = printablePageA4;
                    pd.duplicate(copies);
                    printDialog = pd.DoPrint(printDialog);
                }

            } else if (printFormat == PrintFormat.A4) {
                pd.PaperKindOrNothing = PaperKind.A4;

                printDialog = pd.DoPrint();
            }

            if (printDialog != null) {
                MessageBox.Show("Sorry - printing not possible!");
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChangeOPEventArgs"/> class.
 /// </summary>
 /// <param name="operation">The operation.</param>
 /// <param name="patient">The patient.</param>
 public ChangeOPEventArgs(OperationData operation, PatientData patient)
 {
     this.operation = operation;
     this.patient = patient;
 }