Ejemplo n.º 1
0
        public bool createNewDepSubTea(DepSubTea depSubTea)
        {
            if (!(correction.checkDepClaTea(depSubTea, getAllDepSubTeas())))
            {
                Console.WriteLine("Dependence exists in database."); return(false);
            }

            string sqlCreateNewDepSubTea = "INSERT INTO DepSubTea (_SubId, _TeaId) " +
                                           $"VALUES ({depSubTea._SubId}, {depSubTea._TeaId})";
            SqlCommand comCreateNewDepSubTea = new SqlCommand(sqlCreateNewDepSubTea, connection);

            try
            {
                connection.Open();
                comCreateNewDepSubTea.ExecuteNonQuery();
            }
            catch (SqlException)
            {
                Console.WriteLine("DATABASE createNewDepSubTea ERROR");
            }
            finally
            {
                connection.Close();
            }
            return(true);
        }
Ejemplo n.º 2
0
 public bool checkDepClaTea(DepSubTea depSubTea,
                            List <DepSubTea> depSubTeas)
 {
     if (depSubTea.Consists(depSubTeas) |
         depSubTea._SubId == null | depSubTea._TeaId == null)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }