示例#1
0
 public static int UpdatePatHist(PatientsHistory iPHOld, PatientsHistory iPHNew)
 {
     RemovePatHist(iPHOld.Id);
     AddToHistory(iPHNew);
     return 0;
 }
        public static void PatHistInsert(PatientsHistory iPH)
        {
            if (GlobalVars.ConnectedToDatabase)
            {
                MySqlConnection con = new MySqlConnection(MyConnectionString);
                con.Open();

                try
                {
                    MySqlCommand cmd = con.CreateCommand();
                    cmd.CommandText = "insert into pat_hist(id, doctor_id, patient_id, diesease, date) values(" + iPH.Id + "," + iPH.Doctor.Id + "," + iPH.Pat.Id + ",'" + iPH.DiseaseName + "','" + iPH.Date +"');";
                    cmd.ExecuteNonQuery();
                }
                catch (Exception)
                {
                }
                finally
                {
                    if (con.State == ConnectionState.Open)
                    {
                        con.Close();
                    }
                }
            }
        }
示例#3
0
 public static int AddToHistory(PatientsHistory iPatHist)
 {
     if((GlobalVars.LoggedInUser.AccessLvl == AccessLevel.Doctor) || (GlobalVars.LoggedInUser.AccessLvl == AccessLevel.Admin))
     {
         GlobalVars.PatientsHistoryList.Add(new PatientsHistory(++GlobalVars.PatientsHistoryIdCounter, iPatHist.Doctor, iPatHist.Pat, iPatHist.DiseaseName, iPatHist.Date));
         Serialize(GlobalVars.PatientsHistoryList, GlobalVars.PatientsHistoryDbName);
         CreatingDatabaseSelects.PatHistInsert(iPatHist);
         return 0;
     }
     return 1; //access error
 }
 /* -- PatientsHistory -- */
 public static void PatHistUpdate(PatientsHistory iPH)
 {
     if (GlobalVars.ConnectedToDatabase)
     {
         PatHistDelete(iPH.Id);
         PatHistInsert(iPH);
     }
 }