Example #1
0
        // GET: /<controller>/
        public void GetFile(ExportFile file)
        {
            if (file.ClassName.Contains("Proprietar", StringComparison.InvariantCultureIgnoreCase))
            {
                var    wbk          = Excel.Exporter.CycleProprietari(context, excelConfiguration.Get(1, "Proprietar"), "NoContext,InSet,Context");
                byte[] fileContents = null;
                using (var stream = new MemoryStream())
                {
                    wbk.Write(stream);
                    fileContents = stream.ToArray();

                    //return File(fileContents, System.Net.Mime.MediaTypeNames.Application.Octet, "ProprietariValidati.xls");
                }
            }

            if (file.ClassName.Contains("ActProprietate", StringComparison.InvariantCultureIgnoreCase))
            {
                var    wbk          = Excel.Exporter.CycleActeProprietate(context, excelConfiguration.Get(1, "ActProprietate"), "NoContext,InSet,Context");
                byte[] fileContents = null;
                using (var stream = new MemoryStream())
                {
                    wbk.Write(stream);
                    fileContents = stream.ToArray();
                    //return File(fileContents, System.Net.Mime.MediaTypeNames.Application.Octet, "ActeProprietateValidate.xls");
                }
            }

            if (file.ClassName.Contains("Parcel", StringComparison.InvariantCultureIgnoreCase))
            {
                var    wbk          = Excel.Exporter.CycleParcele(context, excelConfiguration.Get(1, "Parcela"), "NoContext,InSet,Context");
                byte[] fileContents = null;
                using (var stream = new MemoryStream())
                {
                    wbk.Write(stream);
                    fileContents = stream.ToArray();
                    //return File(fileContents, System.Net.Mime.MediaTypeNames.Application.Octet, "ParceleValidate.xls");
                }
            }

            if (file.ClassName.Contains("Inscrie", StringComparison.InvariantCultureIgnoreCase))
            {
                var    wbk          = Excel.Exporter.CycleInscrieri(context, excelConfiguration.Get(1, "Inscriere"), "NoContext,InSet,Context");
                byte[] fileContents = null;
                using (var propStream = new MemoryStream())
                {
                    wbk.Write(propStream);
                    fileContents = propStream.ToArray();
                    //return File(fileContents, System.Net.Mime.MediaTypeNames.Application.Octet, "CentralizatorValidat.xls");
                }
            }

            if (file.ClassName.Contains("dxf", StringComparison.InvariantCultureIgnoreCase))
            {
                var dxfFullPath = dXFRepo.GetFullPath(file.Display);

                var stream = DXF.Exporter.Get(dxfFullPath, cadGenExporter, (x) => hubContext.Clients.All.SendAsync("receivemessage", x));
                stream.Seek(0, SeekOrigin.Begin);
                var success = dropBoxBase.Upload(@"/CadGen/DXFResults", file.Display, stream);
            }
            //return new NotFoundResult();
        }