예제 #1
0
        public static Pizdificator GatherFromContext(CadSysContext context, string nrCadGeneral)
        {
            if (string.IsNullOrEmpty(nrCadGeneral))
            {
                return(null);
            }

            var imobil = context.Imobile.FirstOrDefault(x => x.NumarCadGeneral == nrCadGeneral);

            if (imobil == null)
            {
                return new Pizdificator()
                       {
                           NrCadGeneral = nrCadGeneral
                       }
            }
            ;

            var result = new Pizdificator();

            context.Entry(imobil).Collection(x => x.InscrieriDetaliu).Load();
            //context.Entry(imobil.Parcele.FirstOrDefault()).Reference(x => x.Tarla).LoadAsync();

            foreach (var iD in imobil.InscrieriDetaliu)
            {
                context.Entry(iD).Collection(x => x.InscrieriActe).Load();

                //context.Entry(iD).Collection(x => x.InscrieriImobile).LoadAsync();
                context.Entry(iD).Collection(x => x.InscrieriProprietari).Load();

                foreach (var ia in iD.InscrieriActe)
                {
                    context.Entry(ia).Reference(x => x.ActProprietate).Load();
                }

                foreach (var ip in iD.InscrieriProprietari)
                {
                    context.Entry(ip).Reference(x => x.Proprietar).Load();
                }
            }

            result.IndecsiProprietari = imobil.InscrieriDetaliu.SelectMany(x => x.InscrieriProprietari).Select(y => y.Proprietar).Select(x => x.Index).Distinct().ToList();
            result.IndecsiActe        = imobil.InscrieriDetaliu.Where(id => id.InscrieriProprietari.Count > 0).SelectMany(x => x.InscrieriActe).Select(y => y.ActProprietate).Select(x => x.Index).Distinct().ToList();
            result.Sector             = imobil.SectorCadastral;
            result.NrCadGeneral       = nrCadGeneral;

            return(result);
        }
예제 #2
0
        public static string[] GatherFromFiles(Pizdificator pizdificator, DropBoxBase dropBoxClient, string ai, string ap, string f)
        {
            var result = new List <string>();

            result.Add($"{f}/{pizdificator.NrCadGeneral}.pdf");



            pizdificator.IndecsiProprietari?.ForEach(x =>
            {
                if (dropBoxClient.FolderExists($"{ai}/{x}"))
                {
                    var files = dropBoxClient.ListFolder($"{ai}/{x}/", false, true).OrderBy(y => y);

                    files.ToList().ForEach(y => result.Add($"{ai}/{x}/{y}"));
                }
            });


            pizdificator.IndecsiActe?.ForEach(x =>
            {
                if (dropBoxClient.FolderExists($"{ap}/{x}"))
                {
                    var files = dropBoxClient.ListFolder($"{ap}/{x}/", false, true).OrderBy(y => y);

                    files.ToList().ForEach(y => result.Add($"{ap}/{x}/{y}"));
                }

                if (dropBoxClient.FileExists($"{ap}/{x}.pdf"))
                {
                    result.Add($"{ap}/{x}.pdf");
                }
            });

            return(result.ToArray());
        }