public SingleVisit(int iId, int iMinutes, Patient iPatient)
 {
     Id = iId;
     Minutes = iMinutes;
     Pat = iPatient;
     Time = GetTime();
 }
 public PatientsHistory(int iId, User iDoctor, Patient iPat, string iDiseaseName, DateTime iDate)
 {
     Id = iId;
     Doctor = iDoctor;
     Pat = iPat;
     DiseaseName = iDiseaseName;
     Date = iDate;
 }
        //zwolnienie
        public Document(int iId, Patient iPatient, DocumentsType iDocType, DateTime iExemptionFrom, DateTime iExemptionTo, string iExemptionNumber, string iCompanyName, string iOddzialNFZ)
        {
            Id = iId;
            Pat = iPatient;
            DocType = iDocType;
            ExemptionFrom = iExemptionFrom;
            ExemptionTo = iExemptionTo;
            ExemptionsNumber = iExemptionNumber;
            CompanyName = iCompanyName;
            OddzialNFZ = iOddzialNFZ;

            /////
            MedicamentsList = new List<Medicament>();
        }
        /* ------ */
        /* UPDATE */
        /* ------ */

        public static int UpdatePatient(Patient iPatOld, Patient iPatNew)
        {
            RemovePatient(iPatOld.Id);
            AddPatient(iPatNew);
            return 0;
        }
 public static int AddPatient(Patient iPatient)
 {
     //iPatient.Id = GlobalVars.PatientsIdCounter++;
     GlobalVars.PatientsList.Add(new Patient(++GlobalVars.PatientsIdCounter, iPatient.Name, iPatient.Surname, iPatient.Pesel));
     DBManager.Serialize(GlobalVars.PatientsList, GlobalVars.PatientsDbName);
     CreatingDatabaseSelects.PatientInsert(iPatient);
     return 0;
 }
 //recepta
 public Document(int iId, Patient iPatient, DocumentsType iDocType, List<Medicament> iMedicamentsList)
 {
     Id = iId;
     Pat = iPatient;
     DocType = iDocType;
     //MedicamentsList = new List<Medicaments>();
     MedicamentsList = iMedicamentsList;
     ExemptionFrom = DateTime.Now;
     ExemptionTo = new DateTime(1990, 01, 01);
     ExemptionsNumber = "None";
     CompanyName = "None";
     OddzialNFZ = "Brak";
 }
        public static void PatientInsert(Patient iPat)
        {
            if (GlobalVars.ConnectedToDatabase)
            {
                MySqlConnection con = new MySqlConnection(MyConnectionString);
                con.Open();

                try
                {
                    MySqlCommand cmd = con.CreateCommand();
                    cmd.CommandText = "insert into patient(id, name, surname) values("+iPat.Id+",'"+iPat.Name+"','"+iPat.Surname+"');";
                    cmd.ExecuteNonQuery();
                }
                catch (Exception)
                {
                }
                finally
                {
                    if (con.State == ConnectionState.Open)
                    {
                        con.Close();
                    }
                }
            }
        }
 /// <summary>
 /// Updates a Patient at DB
 /// </summary>
 /// <returns></returns>
 public static void PatientUpdate(Patient iPat)
 {
     if (GlobalVars.ConnectedToDatabase)
     {
         PatientDelete(iPat.Id);
         PatientInsert(iPat);
     }
 }