示例#1
0
        async Task CycleParcele(string fileName, MemoryStream stream)
        {
            var x = await Importer.GetDTOs <OutputParcela>(stream, fileName, new ImportConfig(), excelConfiguration);

            object locker  = new object();
            var    tarlale = new ConcurrentBag <Tarla>(context.Tarlale);


            Parallel.ForEach(x, y =>
            {
                var z = new Parcela();
                var i = new Imobil();
                var a = new Adresa()
                {
                    SIRSUP     = 180019,
                    SIRUTA     = 180019,
                    Intravilan = false
                };

                i.Parcele.Add(z);
                i.Adresa = a;

                lock (locker)
                {
                    context.Imobile.Add(i);
                    //context.Imobile.Add(i);
                }

                z.FromDTO(y, tarlale);
                //z.Imobil = new Imobil();
                //i.Parcele.Add(z);
            });
        }
示例#2
0
        static IEnumerable <string> ExportImobil(Imobil imobil, string nrCadGeneral, string sector, string nrCad)
        {
            var result = new List <string>();

            var parcela = imobil.Parcele.FirstOrDefault();

            var observatii = imobil.Observatii;

            if (parcela.Tarla != null && parcela.Tarla.Diminuata && parcela.Suprafata.HasValue)
            {
                observatii = $"Suprafata din act: {parcela.Suprafata.Value} mp. {observatii}";
            }

            if (!string.IsNullOrEmpty(observatii))
            {
                result.Add($"#0033#{observatii}");
            }

            StringBuilder builder = new StringBuilder("#01#");

            builder.Append(nrCadGeneral).Append('|');
            builder.Append(sector).Append('|');
            builder.Append('0').Append('|'); //cooperativizata
            builder.Append('1').Append('|'); //dunno
            builder.Append(imobil.IdentificatorElectronic).Append('|');
            builder.Append(nrCad).Append('|');
            builder.Append(imobil.NumarCarteFunciara).Append('|');
            builder.Append('1').Append('|');                                                      //neimprejmuit
            builder.Append(parcela.Tarla != null && parcela.Tarla.Diminuata ? 1 : 0).Append('|'); //suprafatadiminuata
            builder.Append(imobil.NumarTopografic).Append('|');
            //adresa
            result.Add(builder.ToString());

            return(result);
        }
示例#3
0
        static void Main(string[] args)
        {
            Imobil e2 = new Imobil(ImobilType.Apartment);
            Imobil e3 = new Imobil(ImobilType.SingleRoom);
            Imobil e1 = new Imobil(ImobilType.House);

            e2.set_price_apartment();
            e1.set_price_house();
            e3.set_price_singleroom();

            Console.WriteLine("-------------------------------------------------");
            Console.WriteLine("||Please select the type of place you want :   ||");
            Console.WriteLine("||1)House                                      ||");
            Console.WriteLine("||2)Apartment                                  ||");
            Console.WriteLine("||3)Single Room                                ||");
            Console.WriteLine("||(select 1, 2 or 3)                           ||");
            int select = int.Parse(Console.ReadLine());

            if (select == 1)
            {
                Console.WriteLine("||You selected: " + e1.ImobilType + "                          ||");
                Console.WriteLine("||How many floors do want ?                    ||");
                Console.WriteLine("||1)Single floor                               ||");
                Console.WriteLine("||2)Two floors                                 ||");
                Console.WriteLine("||3)Two floors and attic                       ||");
                Console.WriteLine("||(select 1, 2 or 3)                           ||");
                int nr_rooms = int.Parse(Console.ReadLine());
                Console.WriteLine("||The price is: " + e1.CalculatePrice(nr_rooms) + "$                         ||");
                Console.WriteLine("||Our commission is: " + e1.CalculateCoomission(e1.CalculatePrice(nr_rooms)) + "$  :)                  ");
            }

            if (select == 3)
            {
                Console.WriteLine("||You selected: " + e3.ImobilType + "                     ||");
                Console.WriteLine("||How many square feet do you want ?           ||");
                Console.WriteLine("||1)20                                         ||");
                Console.WriteLine("||2)25                                         ||");
                Console.WriteLine("||3)25 and balcony                             || ");
                Console.WriteLine("||(select 1, 2 or 3)                           ||");
                int nr_rooms = int.Parse(Console.ReadLine());
                Console.WriteLine("||The price is: " + e3.CalculatePrice(nr_rooms) + "$                         ||");
                Console.WriteLine("||Our commission is: " + e3.CalculateCoomission(e3.CalculatePrice(nr_rooms)) + "$  :)                  ");
            }

            if (select == 2)
            {
                Console.WriteLine("||You selected: " + e2.ImobilType + "                      ||");
                Console.WriteLine("||How many rooms do you want ?                 ||");
                Console.WriteLine("||1)Two rooms                                  ||");
                Console.WriteLine("||2)Three rooms                                ||");
                Console.WriteLine("||3)Four rooms                                 || ");
                Console.WriteLine("||(select 1, 2 or 3)                           ||");
                int nr_rooms = int.Parse(Console.ReadLine());
                Console.WriteLine("||The price is: " + e2.CalculatePrice(nr_rooms) + "$                         ||");
                Console.WriteLine("||Our commission is: " + e2.CalculateCoomission(e2.CalculatePrice(nr_rooms)) + "$  :)                  ");
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            // Problema 1

            Animal cutu  = new Animal("caine", "negru", 2);
            Animal gaina = new Animal("gaine", "alba", 22);
            Animal tigru = new Animal("tigru", "galben", 7);

            Imobil apartament = new Imobil("bloc");

            apartament.nrEtaje = 10;
            apartament.pret    = 2222.2;
        }
示例#5
0
        static List <string> ExportPozitia(Imobil imobil)
        {
            var result = new List <string>();

            var iPt3 = imobil.InscrieriDetaliu.Where(x => x.ParteaCF == 3).Select(y => y.Pozitia.Value);

            if (iPt3.Any())
            {
                result.Add("#7773#" + string.Join("", iPt3.Select(x => $"{x}|")));
            }

            var iPt2 = imobil.InscrieriDetaliu.Where(x => x.ParteaCF == 2).Select(y => y.Pozitia.Value);

            if (iPt2.Any())
            {
                result.Add("#7772#" + string.Join("", iPt2.Select(x => $"{x}|")));
            }
            return(result);
        }