void Load_all()
        {
            FileProduct file = new FileProduct();

            if (file.Total_number_records() != 0)
            {
                file = new FileProduct("Book");
                IEnumerable <Product> rez = file.Load_all();
                LoadAllItem?.Invoke(rez);
                file = new FileProduct("AddProducts");
                Product[] mass = file.Load_all();
                if (mass != null)
                {
                    Product[] massMagazine    = new Product[mass.Length];
                    Product[] massСhancellery = new Product[mass.Length];
                    for (int i = 0; i < mass.Length; i++)
                    {
                        if (mass[i] is Magazine)
                        {
                            massMagazine[i] = mass[i];
                        }
                        if (mass[i] is Сhancellery)
                        {
                            massСhancellery[i] = mass[i];
                        }
                    }
                    massMagazine    = massMagazine.Where(x => x != null).ToArray();
                    massСhancellery = massСhancellery.Where(x => x != null).ToArray();
                    LoadAllItem?.Invoke(massMagazine);
                    LoadAllItem?.Invoke(massСhancellery);
                }
            }
        }
Exemple #2
0
        public Magazine(string[] mass)
        {
            FileProduct product = new FileProduct();

            Namber     = product.Total_number_records(); Name = mass[1]; Author = mass[2]; Topic = mass[3]; Storage = mass[4]; Genre = mass[5]; Manufacturer = mass[6]; Audience = mass[7]; Price = Convert.ToDouble(mass[8]);
            Maptemp    = new string[10];
            Maptemp[0] = mass[0]; Maptemp[1] = Convert.ToString(Namber); Maptemp[2] = Name; Maptemp[3] = Author; Maptemp[4] = Topic; Maptemp[5] = Storage; Maptemp[6] = Genre; Maptemp[7] = Manufacturer; Maptemp[8] = Audience; Maptemp[9] = Price.ToString();
            Type       = mass[0];
        }
Exemple #3
0
        public Сhancellery(string[] mass)
        {
            FileProduct product = new FileProduct();

            Namber     = product.Total_number_records(); Name = mass[1]; Storage = mass[2]; Manufacturer = mass[3]; Appointment = mass[4]; Price = Convert.ToDouble(mass[5]);
            Maptemp    = new string[7];
            Maptemp[0] = mass[0]; Maptemp[1] = Convert.ToString(Namber); Maptemp[2] = Name; Maptemp[3] = Storage; Maptemp[4] = Manufacturer; Maptemp[5] = Appointment; Maptemp[6] = Price.ToString();
            Type       = mass[0];
        }