Ejemplo n.º 1
0
 public static List <T> Kolekcje <T>() where T : Encja_Encja
 {
     if (typeof(T) == typeof(Sklep_Produkt))
     {
         return(Sklep_Produkt.Kolekcje().Cast <T>().ToList());
     }
     else if (typeof(T) == typeof(Klient_Produkt))
     {
         return(Klient_Produkt.Kolekcje().Cast <T>().ToList());
     }
     throw new Exception("Nie sprecyzowano typu");
 }
Ejemplo n.º 2
0
 public static T Wstaw <T>(T obiekt, Encja obiekt2 = null) where T : Encja
 {
     if (typeof(T) == typeof(Sklep))
     {
         if (obiekt2 is null)
         {
             return(Sklep.Wstaw(obiekt as Sklep) as T);
         }
         else if (obiekt2 is Produkt)
         {
             Sklep_Produkt.Wstaw(obiekt as Sklep, obiekt2 as Produkt);
         }
     }
     else if (typeof(T) == typeof(Kasjer))
     {
         return(Kasjer.Wstaw(obiekt as Kasjer) as T);
     }
     else if (typeof(T) == typeof(Klient))
     {
         if (obiekt2 is null)
         {
             return(Klient.Wstaw(obiekt as Klient) as T);
         }
         else if (obiekt2 is Produkt)
         {
             Klient_Produkt.Wstaw(obiekt as Klient, obiekt2 as Produkt);
         }
     }
     else if (typeof(T) == typeof(Logowanie))
     {
         return(Logowanie.Wstaw(obiekt as Logowanie) as T);
     }
     else if (typeof(T) == typeof(Produkt))
     {
         return(Produkt.Wstaw(obiekt as Produkt) as T);
     }
     return(null);
 }
Ejemplo n.º 3
0
 public static void Usun <T>(T obiekt, Encja obiekt2 = null) where T : Encja
 {
     if (typeof(T) == typeof(Sklep))
     {
         if (obiekt2 is null)
         {
             Sklep.Usun(obiekt as Sklep);
         }
         else if (obiekt2 is Produkt)
         {
             Sklep_Produkt.Usun(obiekt as Sklep, obiekt2 as Produkt);
         }
     }
     else if (typeof(T) == typeof(Kasjer))
     {
         Kasjer.Usun(obiekt as Kasjer);
     }
     else if (typeof(T) == typeof(Klient))
     {
         if (obiekt2 is null)
         {
             Klient.Usun(obiekt as Klient);
         }
         else if (obiekt2 is Produkt)
         {
             Klient_Produkt.Wstaw(obiekt as Klient, obiekt2 as Produkt);
         }
     }
     else if (typeof(T) == typeof(Logowanie))
     {
         Logowanie.Usun(obiekt as Logowanie);
     }
     else if (typeof(T) == typeof(Produkt))
     {
         Produkt.Usun(obiekt as Produkt);
     }
 }