public Store() { Message Event; int RandSize = Randomaiser.RandomIntSize(); for (int id = 0; id < RandSize; id++) { int RandType = Randomaiser.RandomTo3(); if (RandType == 0) { var temp = new AudioTehnick(); products.Add(temp); Event = AudioMess; } if (RandType == 1) { var temp = new VideoTehnick(); products.Add(temp); Event = VideoMess; } else { var temp = new Detail(); products.Add(temp); Event = DetailMess; } Event(); } }
public void PrintAllByType() { int Numtype = Helper.ReturnNumType(); if (Numtype == 1) { string Type = new AudioTehnick().GetType().Name; Helper.PrintLine(); foreach (var item in products) { if (item.GetType().Name == Type) { Console.WriteLine(item.ToString()); } } Helper.PrintLine(); } if (Numtype == 2) { string Type = new VideoTehnick().GetType().Name; Helper.PrintLine(); foreach (var item in products) { if (item.GetType().Name == Type) { Console.WriteLine(item.ToString()); } } Helper.PrintLine(); } if (Numtype == 3) { string Type = new Detail().GetType().Name; Helper.PrintLine(); foreach (var item in products) { if (item.GetType().Name == Type) { Console.WriteLine(item.ToString()); } } Helper.PrintLine(); } }
public void AddNew() { Message mes; int Numtype = Helper.ReturnNumType(); Console.WriteLine("Enter Name Of Product"); string TmpName = Console.ReadLine(); Console.WriteLine("Enter Name Of Brand"); string TmpBrand = Console.ReadLine(); Console.WriteLine("Enter Name Of Material"); string TmpMaterial = Console.ReadLine(); Console.WriteLine("Enter Name Of Color"); string TmpColor = Console.ReadLine(); int TruePrice = Helper.ReturnTruePrice(); if (Numtype == 1) { mes = AddType1Delegate; } if (Numtype == 2) { var product = new VideoTehnick(TmpName, TmpBrand, TmpMaterial, TmpColor, TruePrice); products.Add(product); mes = AddType2Delegate; Console.WriteLine("Added"); } if (Numtype == 3) { var product = new Detail(TmpName, TmpBrand, TmpMaterial, TmpColor, TruePrice); products.Add(product); mes = AddType3Delegate; Console.WriteLine("Added"); } }