public static void MedicamentsInsert(Medicament iM)
        {
            if (GlobalVars.ConnectedToDatabase)
            {
                MySqlConnection con = new MySqlConnection(MyConnectionString);
                con.Open();

                try
                {
                    MySqlCommand cmd = con.CreateCommand();
                    cmd.CommandText = "insert into medicaments(id, document_id, name, amount) values(" + GlobalVars.MedicamentsIdCounter + "," + GlobalVars.DocumentsIdCounter + ",'" + iM.Name + "','" + iM.Amount + "');";
                    cmd.ExecuteNonQuery();
                }
                catch (Exception)
                { 
                }
                finally
                {
                    if (con.State == ConnectionState.Open)
                    {
                        con.Close();
                    }
                }
            }
        }
 public static int AddMedicament(Medicament iMed)
 {
     GlobalVars.MedicamentsList.Add(new Medicament(++GlobalVars.MedicamentsIdCounter, iMed.Name, iMed.Amount));
     Serialize(GlobalVars.MedicamentsList, GlobalVars.MedicamentsDbName);
     CreatingDatabaseSelects.MedicamentsInsert(iMed);
     return 0;
 }
 /* -- MEdicaments -- */
 public static void MedicamentsUpdate(Medicament iM)
 {
     if (GlobalVars.ConnectedToDatabase)
     {
         MedicamentsDelete(iM.Id);
         MedicamentsInsert(iM);
     }
 }