示例#1
0
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_de_Descripcion_de_Evidencia_CCApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_de_Descripcion_de_Evidencia_CCPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_de_Descripcion_de_Evidencia_CCApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_de_Descripcion_de_Evidencia_CCs == null)
            {
                result.Detalle_de_Descripcion_de_Evidencia_CCs = new List <Detalle_de_Descripcion_de_Evidencia_CC>();
            }

            var data = result.Detalle_de_Descripcion_de_Evidencia_CCs.Select(m => new Detalle_de_Descripcion_de_Evidencia_CCGridModel
            {
                Clave = m.Clave
                , Numero_de_Evidencia         = m.Numero_de_Evidencia
                , Descripcion_de_la_Evidencia = m.Descripcion_de_la_Evidencia
                , Origen            = m.Origen
                , Descripcion       = m.Descripcion
                , Examen_Solicitado = m.Examen_Solicitado
                , Codigo_de_Barras  = m.Codigo_de_Barras
                , Archivo_de_Foto   = m.Archivo_de_Foto
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_de_Descripcion_de_Evidencia_CCList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_de_Descripcion_de_Evidencia_CCList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_Ejercicios_RutinasApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_Ejercicios_RutinasPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_Ejercicios_RutinasApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_Ejercicios_Rutinass == null)
            {
                result.Detalle_Ejercicios_Rutinass = new List <Detalle_Ejercicios_Rutinas>();
            }

            var data = result.Detalle_Ejercicios_Rutinass.Select(m => new Detalle_Ejercicios_RutinasGridModel
            {
                Folio = m.Folio
                , Orden_de_realizacion             = m.Orden_de_realizacion
                , Secuencia                        = m.Secuencia
                , Enfoque_del_EjercicioDescripcion = (string)m.Enfoque_del_Ejercicio_Tipo_de_Enfoque_del_Ejercicio.Descripcion
                , EjercicioNombre_del_Ejercicio    = (string)m.Ejercicio_Ejercicios.Nombre_del_Ejercicio
                , Cantidad_de_series               = m.Cantidad_de_series
                , Cantidad_de_repeticiones         = m.Cantidad_de_repeticiones
                , Descanso_en_segundos             = m.Descanso_en_segundos
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_Ejercicios_RutinasList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_Ejercicios_RutinasList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
示例#3
0
        void ImportPeopleCSV_Click(object sender, RoutedEventArgs e)
        {
            //category to auto-apply
            long?autocCatId = CatSelectDialog.SelectCat("Choose category to apply to each imported person, or cancel to skip")?.RowId;

            string filename = AskForImportFileName(false);

            if (filename == null)
            {
                return;
            }
            var cvt = new CsvConverter();

            try
            {
                using var rdr = new StreamReader(filename);
                var persons = cvt.PersonFromCsv(rdr).ToArray();
                foreach (var person in persons)
                {
                    var eperson = new ExtPerson(person, null, null);
                    if (autocCatId != null)
                    {
                        eperson.SelectedCatIds = new long[] { autocCatId.Value }
                    }
                    ;
                    Globals.UI.SavePerson(eperson);
                }
                VisualUtils.ShowMessageDialog($"Imported {persons.Length} record(s)");
            }
            catch (Exception ex)
            {
                VisualUtils.ShowMessageDialog("Importing failed: " + ex.Message);
            }
        }
示例#4
0
        public void StartProcessing()
        {
            _isNeedStop       = false;
            SigmoidAlphaValue = viewModel.SigmoidsAlpha;
            LearningRate      = viewModel.LearningRate;
            Momentum          = viewModel.Momentum;

            var lines = File.ReadAllLines(viewModel.TrainingFilePath);

            // Initialize input and output values
            var dataset = CsvConverter.ToDouble(lines);

            // Layers (without input layer, contains output layer)
            int[] layers = { 20, dataset.Outputs[0].Length };

            // Create perceptron
            Network = new ActivationNetwork(new SigmoidFunction(SigmoidAlphaValue), dataset.Inputs[0].Length, layers);

            // Create teacher
            var teacher = new BackPropagationLearning(Network)
            {
                LearningRate = LearningRate,
                Momentum     = Momentum
            };

            int iteration = 1;

            try
            {
                List <double> errorsList = new List <double>();

                while (!_isNeedStop)
                {
                    // run epoch of learning procedure
                    double error = teacher.RunEpoch(dataset.Inputs, dataset.Outputs);
                    errorsList.Add(error);

                    // show current iteration & error
                    viewModel.Epoches      = iteration;
                    viewModel.AverageError = error;

                    iteration++;

                    // check if we need to stop
                    if (error <= viewModel.LearningErrorLimit)
                    {
                        break;
                    }

                    if (iteration > viewModel.EpochesLimit && viewModel.EpochesLimit > 0)
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
示例#5
0
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_Planes_de_Suscripcion_EspecialistasApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_Planes_de_Suscripcion_EspecialistasPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_Planes_de_Suscripcion_EspecialistasApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_Planes_de_Suscripcion_Especialistass == null)
            {
                result.Detalle_Planes_de_Suscripcion_Especialistass = new List <Detalle_Planes_de_Suscripcion_Especialistas>();
            }

            var data = result.Detalle_Planes_de_Suscripcion_Especialistass.Select(m => new Detalle_Planes_de_Suscripcion_EspecialistasGridModel
            {
                Folio = m.Folio
                , Plan_de_SuscripcionNombre = (string)m.Plan_de_Suscripcion_Planes_de_Suscripcion_Especialistas.Nombre
                , Fecha_de_inicio           = (m.Fecha_de_inicio == null ? string.Empty : Convert.ToDateTime(m.Fecha_de_inicio).ToString(ConfigurationProperty.DateFormat))
                , Fecha_fin = (m.Fecha_fin == null ? string.Empty : Convert.ToDateTime(m.Fecha_fin).ToString(ConfigurationProperty.DateFormat))
                , Frecuencia_de_PagoNombre = (string)m.Frecuencia_de_Pago_Frecuencia_de_pago_Especialistas.Nombre
                , Costo              = m.Costo
                , Firmo_Contrato     = m.Firmo_Contrato
                , EstatusDescripcion = (string)m.Estatus_Estatus_de_Suscripcion.Descripcion
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_Planes_de_Suscripcion_EspecialistasList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_Planes_de_Suscripcion_EspecialistasList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
        private static void ConvertMidiFileToFromCsv(MidiFile midiFile, string outputFilePath, MidiFileCsvConversionSettings settings)
        {
            var csvConverter = new CsvConverter();

            csvConverter.ConvertMidiFileToCsv(midiFile, outputFilePath, true, settings);
            csvConverter.ConvertCsvToMidiFile(outputFilePath, settings);
        }
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IMR_TarjetasApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new MR_TarjetasPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IMR_TarjetasApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.MR_Tarjetass == null)
            {
                result.MR_Tarjetass = new List <MR_Tarjetas>();
            }

            var data = result.MR_Tarjetass.Select(m => new MR_TarjetasGridModel
            {
                Folio = m.Folio
                , Tipo_de_TarjetaDescripcion = (string)m.Tipo_de_Tarjeta_Tipo_de_Tarjeta.Descripcion
                , Numero_de_Tarjeta          = m.Numero_de_Tarjeta
                , Nombre_del_Titular         = m.Nombre_del_Titular
                , Ano_de_vigencia            = m.Ano_de_vigencia
                , Mes_de_vigencia            = m.Mes_de_vigencia
                , Alias_de_la_Tarjeta        = m.Alias_de_la_Tarjeta
                , EstatusDescripcion         = (string)m.Estatus_Estatus.Descripcion
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "MR_TarjetasList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "MR_TarjetasList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_Resultados_ConsultasApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_Resultados_ConsultasPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_Resultados_ConsultasApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_Resultados_Consultass == null)
            {
                result.Detalle_Resultados_Consultass = new List <Detalle_Resultados_Consultas>();
            }

            var data = result.Detalle_Resultados_Consultass.Select(m => new Detalle_Resultados_ConsultasGridModel
            {
                Folio = m.Folio
                , Folio_PacientesNombre_Completo = (string)m.Folio_Pacientes_Pacientes.Nombre_Completo
                , Fecha_de_Consulta = (m.Fecha_de_Consulta == null ? string.Empty : Convert.ToDateTime(m.Fecha_de_Consulta).ToString(ConfigurationProperty.DateFormat))
                , IndicadorNombre   = (string)m.Indicador_Indicadores_Consultas.Nombre
                , Resultado         = m.Resultado
                , Interpretacion    = m.Interpretacion
                , IMC           = m.IMC
                , IMC_Pediatria = m.IMC_Pediatria
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_Resultados_ConsultasList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_Resultados_ConsultasList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
示例#9
0
        void ImportBoxesCSV_Click(object sender, RoutedEventArgs e)
        {
            string filename = AskForImportFileName(false);

            if (filename == null)
            {
                return;
            }
            var cvt = new CsvConverter();

            try
            {
                using var rdr = new StreamReader(filename);
                var boxes = cvt.BoxFromCsv(rdr).ToArray();
                foreach (var box in boxes)
                {
                    Globals.UI.SaveBox(new ExtBox(box, null), false);
                }
                VisualUtils.ShowMessageDialog($"Imported {boxes.Length} record(s)");
            }
            catch (Exception ex)
            {
                VisualUtils.ShowMessageDialog("Importing failed: " + ex.Message);
            }
            UIGlobals.Do.RebuildViews(BoxEditingPool.CreateUniversalChangeItem(), false);
        }
        private static void ConvertNotesToFromCsv(IEnumerable <Note> notes, TempoMap tempoMap, string outputFilePath, NoteCsvConversionSettings settings)
        {
            var csvConverter = new CsvConverter();

            csvConverter.ConvertNotesToCsv(notes, outputFilePath, tempoMap, true, settings);
            csvConverter.ConvertCsvToNotes(outputFilePath, tempoMap, settings);
        }
示例#11
0
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_de_IndiciosApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_de_IndiciosPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_de_IndiciosApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_de_Indicioss == null)
            {
                result.Detalle_de_Indicioss = new List <Detalle_de_Indicios>();
            }

            var data = result.Detalle_de_Indicioss.Select(m => new Detalle_de_IndiciosGridModel
            {
                Clave = m.Clave
                , Numero_de_Indicio      = m.Numero_de_Indicio
                , Nombre_de_Indicio      = m.Nombre_de_Indicio
                , Descripcion_de_Indicio = m.Descripcion_de_Indicio
                , Motivo_de_Indicio      = m.Motivo_de_Indicio
                , DiligenciaServicio     = (string)m.Diligencia_Servicios_Periciales.Servicio
                , Ubicacion          = m.Ubicacion
                , EstatusDescripcion = (string)m.Estatus_Estatus_de_Indicio.Descripcion
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_de_IndiciosList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_de_IndiciosList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
示例#12
0
        public bool TryLoadFromClipboard(GraphViewModel item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            var text = Clipboard.GetText().Trim();

            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }

            var csv    = text.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            var points = CsvConverter.ToPointList(csv);

            if (points.Count == 0)
            {
                return(false);
            }

            item.Points.Clear();

            foreach (var point in points)
            {
                item.Points.Add(point);
            }

            return(true);
        }
示例#13
0
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_de_Historial_de_Emergencia_CCApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_de_Historial_de_Emergencia_CCPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_de_Historial_de_Emergencia_CCApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_de_Historial_de_Emergencia_CCs == null)
            {
                result.Detalle_de_Historial_de_Emergencia_CCs = new List <Detalle_de_Historial_de_Emergencia_CC>();
            }

            var data = result.Detalle_de_Historial_de_Emergencia_CCs.Select(m => new Detalle_de_Historial_de_Emergencia_CCGridModel
            {
                Clave                  = m.Clave
                , Fecha                = (m.Fecha == null ? string.Empty : Convert.ToDateTime(m.Fecha).ToString(ConfigurationProperty.DateFormat))
                , Hora                 = m.Hora
                , Latitud              = m.Latitud
                , Longitud             = m.Longitud
                , Estatus              = m.Estatus
                , Comentarios          = m.Comentarios
                , Usuario_que_registra = m.Usuario_que_registra
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_de_Historial_de_Emergencia_CCList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_de_Historial_de_Emergencia_CCList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
        private static void ConvertMidiFileToFromCsv(MidiFileCsvConversionSettings settings)
        {
            var tempPath        = Path.GetTempPath();
            var outputDirectory = Path.Combine(tempPath, Guid.NewGuid().ToString());

            Directory.CreateDirectory(outputDirectory);

            try
            {
                foreach (var filePath in TestFilesProvider.GetValidFilesPaths())
                {
                    var midiFile       = MidiFile.Read(filePath);
                    var outputFilePath = Path.Combine(outputDirectory, Path.GetFileName(Path.ChangeExtension(filePath, "csv")));

                    var csvConverter = new CsvConverter();
                    csvConverter.ConvertMidiFileToCsv(midiFile, outputFilePath, true, settings);
                    var convertedFile = csvConverter.ConvertCsvToMidiFile(outputFilePath, settings);

                    MidiAsserts.AreFilesEqual(midiFile, convertedFile, true, $"Conversion of '{filePath}' is invalid.");
                }
            }
            finally
            {
                Directory.Delete(outputDirectory, true);
            }
        }
        public async Task <IActionResult> Import(TaxRateImportForm model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var inputStream = model.CsvFile.OpenReadStream();
            var records     = CsvConverter.ReadCsvStream <TaxRateImport>(model.CsvFile.OpenReadStream(), model.IncludeHeader, model.CsvDelimiter);

            foreach (var record in records)
            {
                var stateOrProvince = _stateOrProvinceRepository.Query().FirstOrDefault(x => x.Name == record.StateOrProvinceName);
                var taxRate         = new TaxRate
                {
                    TaxClassId      = record.TaxClassId,
                    CountryId       = record.CountryId,
                    StateOrProvince = stateOrProvince,
                    ZipCode         = record.ZipCode,
                    Rate            = record.Rate
                };
                _taxRateRepository.Add(taxRate);
            }

            await _taxRateRepository.SaveChangesAsync();

            return(NoContent());
        }
        private static MidiFile ConvertCsvToMidiFile(
            MidiFileCsvLayout layout,
            TimeSpanType timeType,
            string[] csvLines,
            NoteFormat noteFormat             = NoteFormat.Events,
            NoteNumberFormat noteNumberFormat = NoteNumberFormat.NoteNumber,
            TimeSpanType noteLengthType       = TimeSpanType.Midi)
        {
            var filePath = Path.GetTempFileName();

            File.WriteAllLines(filePath, csvLines);

            var settings = new MidiFileCsvConversionSettings
            {
                CsvLayout        = layout,
                TimeType         = timeType,
                NoteFormat       = noteFormat,
                NoteNumberFormat = noteNumberFormat,
                NoteLengthType   = noteLengthType
            };

            try
            {
                var midiFile = new CsvConverter().ConvertCsvToMidiFile(filePath, settings);
                ConvertMidiFileToFromCsv(midiFile, filePath, settings);
                return(midiFile);
            }
            finally
            {
                File.Delete(filePath);
            }
        }
        private static void ConvertCsvToNotes(
            IEnumerable <NoteWithCustomTimeAndLength> expectedNotes,
            TempoMap tempoMap,
            TimeSpanType timeType,
            string[] csvLines,
            NoteNumberFormat noteNumberFormat = NoteNumberFormat.NoteNumber,
            TimeSpanType noteLengthType       = TimeSpanType.Midi,
            char delimiter = ',')
        {
            var filePath = Path.GetTempFileName();

            File.WriteAllLines(filePath, csvLines);

            var settings = new NoteCsvConversionSettings
            {
                TimeType         = timeType,
                NoteNumberFormat = noteNumberFormat,
                NoteLengthType   = noteLengthType
            };

            settings.CsvSettings.CsvDelimiter = delimiter;

            try
            {
                var actualNotes = new CsvConverter().ConvertCsvToNotes(filePath, tempoMap, settings).ToList();
                _noteMethods.AssertCollectionsAreEqual(expectedNotes.Select(n => n.GetNote(tempoMap)), actualNotes);

                ConvertNotesToFromCsv(actualNotes, tempoMap, filePath, settings);
            }
            finally
            {
                File.Delete(filePath);
            }
        }
示例#18
0
        /// <summary>
        /// Save Vn Characters to db
        /// </summary>
        /// <param name="characters"></param>
        /// <param name="vnid"></param>
        public static void SaveVnCharacters(ICollection <Character> characters, uint vnid)
        {
            try
            {
                if (characters == null || characters.Count < 1)
                {
                    return;
                }
                var cred = CredentialManager.GetCredentials(App.CredDb);
                if (cred == null || cred.UserName.Length < 1)
                {
                    return;
                }
                using (var db = new LiteDatabase($"{App.GetDbStringWithoutPass}'{cred.Password}'"))
                {
                    var dbCharInfo = db.GetCollection <VnCharacterInfo>(DbVnCharacter.VnCharacter.ToString());
                    ILiteCollection <VnCharacterTraits> dbCharTraits = db.GetCollection <VnCharacterTraits>(DbVnCharacter.VnCharacter_Traits.ToString());

                    if (characters.Count > 0)
                    {
                        List <VnCharacterInfo>   vnCharactersList      = new List <VnCharacterInfo>();
                        List <VnCharacterTraits> vnCharacterTraitsList = new List <VnCharacterTraits>();
                        foreach (Character vnCharacter in characters)
                        {
                            var prevVnCharacter = dbCharInfo.Query().Where(x => x.CharacterId == vnCharacter.Id);
                            var character       = prevVnCharacter.FirstOrDefault() ?? new VnCharacterInfo();

                            character.VnId        = vnid;
                            character.CharacterId = vnCharacter.Id;
                            character.Name        = vnCharacter.Name;
                            character.Original    = vnCharacter.OriginalName;
                            character.Gender      = vnCharacter.Gender.ToString();
                            character.BloodType   = vnCharacter.BloodType.ToString();
                            character.Age         = vnCharacter.Age.ToString();
                            character.Birthday    = SimpleDateConverter.ConvertSimpleDate(vnCharacter.Birthday);
                            character.Aliases     = CsvConverter.ConvertToCsv(vnCharacter.Aliases);
                            character.Description = vnCharacter.Description;
                            character.ImageLink   = !string.IsNullOrEmpty(vnCharacter.Image) ? vnCharacter.Image : string.Empty;
                            character.ImageRating = vnCharacter.ImageRating;
                            character.Bust        = Convert.ToInt32(vnCharacter.Bust, CultureInfo.InvariantCulture);
                            character.Waist       = Convert.ToInt32(vnCharacter.Waist, CultureInfo.InvariantCulture);
                            character.Hip         = Convert.ToInt32(vnCharacter.Hip, CultureInfo.InvariantCulture);
                            character.Height      = Convert.ToInt32(vnCharacter.Height, CultureInfo.InvariantCulture);
                            character.Weight      = Convert.ToInt32(vnCharacter.Weight, CultureInfo.InvariantCulture);
                            vnCharactersList.Add(character);

                            vnCharacterTraitsList.AddRange(FormatVnCharacterTraits(vnCharacter, dbCharTraits));
                        }

                        dbCharInfo.Upsert(vnCharactersList);
                        dbCharTraits.Upsert(vnCharacterTraitsList);
                    }
                }
            }
            catch (Exception e)
            {
                App.Logger.Error(e, "Failed to save VnCharacters");
                SentryHelper.SendException(e, null, SentryLevel.Error);
            }
        }
示例#19
0
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_de_ResultadosApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_de_ResultadosPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_de_ResultadosApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_de_Resultadoss == null)
            {
                result.Detalle_de_Resultadoss = new List <Detalle_de_Resultados>();
            }

            var data = result.Detalle_de_Resultadoss.Select(m => new Detalle_de_ResultadosGridModel
            {
                Clave                       = m.Clave
                , Nombre                    = m.Nombre
                , Apellido_Paterno          = m.Apellido_Paterno
                , Apellido_Materno          = m.Apellido_Materno
                , Fecha_Nacimiento          = (m.Fecha_Nacimiento == null ? string.Empty : Convert.ToDateTime(m.Fecha_Nacimiento).ToString(ConfigurationProperty.DateFormat))
                , SexoDescripcion           = (string)m.Sexo_Genero.Descripcion
                , NacionalidadNacionalidadC = (string)m.Nacionalidad_Nacionalidad.NacionalidadC
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_de_ResultadosList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_de_ResultadosList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
示例#20
0
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_de_Sentencias_Imputado_MPIApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_de_Sentencias_Imputado_MPIPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_de_Sentencias_Imputado_MPIApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_de_Sentencias_Imputado_MPIs == null)
            {
                result.Detalle_de_Sentencias_Imputado_MPIs = new List <Detalle_de_Sentencias_Imputado_MPI>();
            }

            var data = result.Detalle_de_Sentencias_Imputado_MPIs.Select(m => new Detalle_de_Sentencias_Imputado_MPIGridModel
            {
                Clave = m.Clave
                , DelitoDescripcion    = (string)m.Delito_Delito.Descripcion
                , SentenciaDescripcion = (string)m.Sentencia_Sentencia.Descripcion
                , Fecha_de_Devolucion  = (m.Fecha_de_Devolucion == null ? string.Empty : Convert.ToDateTime(m.Fecha_de_Devolucion).ToString(ConfigurationProperty.DateFormat))
                , Hora_de_Devolucion   = m.Hora_de_Devolucion
                , Repacion_del_Dano    = m.Repacion_del_Dano
                , Resolucion           = m.Resolucion
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_de_Sentencias_Imputado_MPIList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_de_Sentencias_Imputado_MPIList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
示例#21
0
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_Aseguramiento_PirateriaApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_Aseguramiento_PirateriaPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_Aseguramiento_PirateriaApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_Aseguramiento_Piraterias == null)
            {
                result.Detalle_Aseguramiento_Piraterias = new List <Detalle_Aseguramiento_Pirateria>();
            }

            var data = result.Detalle_Aseguramiento_Piraterias.Select(m => new Detalle_Aseguramiento_PirateriaGridModel
            {
                Clave = m.Clave
                , Motivo_de_RegistroDescripcion = (string)m.Motivo_de_Registro_Motivo_de_Registro.Descripcion
                , TipoDescripcion = (string)m.Tipo_Tipo_de_Pirateria.Descripcion
                , Descripcion     = m.Descripcion
                , Cantidad        = m.Cantidad
                , Unidad_de_MedicionDescripcion = (string)m.Unidad_de_Medicion_Unidad_de_Medida_de_pirateria.Descripcion
                , Observaciones = m.Observaciones
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_Aseguramiento_PirateriaList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_Aseguramiento_PirateriaList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
示例#22
0
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_de_Coincidencias_MPIApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_de_Coincidencias_MPIPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_de_Coincidencias_MPIApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_de_Coincidencias_MPIs == null)
            {
                result.Detalle_de_Coincidencias_MPIs = new List <Detalle_de_Coincidencias_MPI>();
            }

            var data = result.Detalle_de_Coincidencias_MPIs.Select(m => new Detalle_de_Coincidencias_MPIGridModel
            {
                Clave                  = m.Clave
                , Nombre_Completo      = m.Nombre_Completo
                , Alias                = m.Alias
                , Numero_de_Expediente = m.Numero_de_Expediente
                , NUAT                 = m.NUAT
                , NUC                  = m.NUC
                , Rol                  = m.Rol
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_de_Coincidencias_MPIList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_de_Coincidencias_MPIList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
示例#23
0
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _ISpartan_Format_FieldApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Spartan_Format_FieldPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _ISpartan_Format_FieldApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Spartan_Format_Fields == null)
            {
                result.Spartan_Format_Fields = new List <Spartan_Format_Field>();
            }

            var data = result.Spartan_Format_Fields.Select(m => new Spartan_Format_FieldGridModel
            {
                FormatFieldId         = m.FormatFieldId
                , Field_Path          = m.Field_Path
                , Physical_Field_Name = m.Physical_Field_Name
                , Logical_Field_Name  = m.Logical_Field_Name
                , Creation_Hour       = m.Creation_Hour
                , Creation_User       = m.Creation_User
                , Properties          = m.Properties
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Spartan_Format_FieldList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Spartan_Format_FieldList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_Examenes_LaboratorioApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_Examenes_LaboratorioPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_Examenes_LaboratorioApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_Examenes_Laboratorios == null)
            {
                result.Detalle_Examenes_Laboratorios = new List <Detalle_Examenes_Laboratorio>();
            }

            var data = result.Detalle_Examenes_Laboratorios.Select(m => new Detalle_Examenes_LaboratorioGridModel
            {
                Folio = m.Folio
                , IndicadorIndicador      = (string)m.Indicador_Indicadores_Laboratorio.Indicador
                , Resultado               = m.Resultado
                , Unidad                  = m.Unidad
                , Intervalo_de_Referencia = m.Intervalo_de_Referencia
                , Fecha_de_Resultado      = (m.Fecha_de_Resultado == null ? string.Empty : Convert.ToDateTime(m.Fecha_de_Resultado).ToString(ConfigurationProperty.DateFormat))
                , Estatus_Indicador       = m.Estatus_Indicador
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_Examenes_LaboratorioList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_Examenes_LaboratorioList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IDetalle_Registro_Beneficiarios_EmpresaApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Detalle_Registro_Beneficiarios_EmpresaPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IDetalle_Registro_Beneficiarios_EmpresaApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Detalle_Registro_Beneficiarios_Empresas == null)
            {
                result.Detalle_Registro_Beneficiarios_Empresas = new List <Detalle_Registro_Beneficiarios_Empresa>();
            }

            var data = result.Detalle_Registro_Beneficiarios_Empresas.Select(m => new Detalle_Registro_Beneficiarios_EmpresaGridModel
            {
                Folio = m.Folio
                , Numero_de_Empleado_Titular = m.Numero_de_Empleado_Titular
                , Numero_de_Empleado         = m.Numero_de_Empleado
                , UsuarioName = (string)m.Usuario_Spartan_User.Name
                , Activo      = m.Activo
                , SuscripcionNombre_del_Plan = (string)m.Suscripcion_Planes_de_Suscripcion.Nombre_del_Plan
                , EstatusDescripcion         = (string)m.Estatus_Estatus.Descripcion
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Detalle_Registro_Beneficiarios_EmpresaList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Detalle_Registro_Beneficiarios_EmpresaList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _ISpartan_WorkFlow_Matrix_of_StatesApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new Spartan_WorkFlow_Matrix_of_StatesPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _ISpartan_WorkFlow_Matrix_of_StatesApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.Spartan_WorkFlow_Matrix_of_Statess == null)
            {
                result.Spartan_WorkFlow_Matrix_of_Statess = new List <Spartan_WorkFlow_Matrix_of_States>();
            }

            var data = result.Spartan_WorkFlow_Matrix_of_Statess.Select(m => new Spartan_WorkFlow_Matrix_of_StatesGridModel
            {
                Matrix_of_StatesId = m.Matrix_of_StatesId
                , Visible          = m.Visible
                , Required         = m.Required
                , Read_Only        = m.Read_Only
                , Label            = m.Label
                , Default_Value    = m.Default_Value
                , Help_Text        = m.Help_Text
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "Spartan_WorkFlow_Matrix_of_StatesList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "Spartan_WorkFlow_Matrix_of_StatesList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
        public void Export(string format, int pageIndex, int pageSize)
        {
            var exportFormatType = (ExportFormatType)Enum.Parse(
                typeof(ExportFormatType), format, true);

            if (!_tokenManager.GenerateToken())
            {
                return;
            }

            _IMR_Detalle_PlatilloApiConsumer.SetAuthHeader(_tokenManager.Token);

            NameValueCollection filter = Request.QueryString;

            var configuration = new GridConfiguration()
            {
                OrderByClause = "", WhereClause = ""
            };

            if (filter != null)
            {
                configuration = GridQueryHelper.GetConfiguration(filter, new MR_Detalle_PlatilloPropertyMapper());
            }

            pageSize = pageSize == 0 ? int.MaxValue : pageSize;

            var result = _IMR_Detalle_PlatilloApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize, configuration.WhereClause, configuration.OrderByClause ?? "").Resource;

            if (result.MR_Detalle_Platillos == null)
            {
                result.MR_Detalle_Platillos = new List <MR_Detalle_Platillo>();
            }

            var data = result.MR_Detalle_Platillos.Select(m => new MR_Detalle_PlatilloGridModel
            {
                Folio = m.Folio
                , IngredienteNombre_Ingrediente = (string)m.Ingrediente_Ingredientes.Nombre_Ingrediente
                , Cantidad              = m.Cantidad
                , Cantidad_en_Fraccion  = m.Cantidad_en_Fraccion
                , UnidadUnidad          = (string)m.Unidad_Unidades_de_Medida.Unidad
                , Cantidad_a_mostrar    = m.Cantidad_a_mostrar
                , Ingrediente_a_mostrar = m.Ingrediente_a_mostrar
            }).ToList();

            switch (exportFormatType)
            {
            case ExportFormatType.PDF:
                PdfConverter.ExportToPdf(data.ToDataTable(), "MR_Detalle_PlatilloList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.EXCEL:
                ExcelConverter.ExportToExcel(data.ToDataTable(), "MR_Detalle_PlatilloList_" + DateTime.Now.ToString());
                break;

            case ExportFormatType.CSV:
                CsvConverter.ExportToCSV(data.ToDataTable(), "EmployeeList_" + DateTime.Now.ToString());
                break;
            }
        }
示例#28
0
        // TODO Change to AddOrUpdate, not just Add
        private void SetupTimestampedDataSerialization(CsvSerializerContext serializer, string timestampFieldName)
        {
            CsvConverter converter = String.IsNullOrWhiteSpace(timestampFieldName)
                                    ? new TimestampedDataCsvConverter()
                                    : new TimestampedDataCsvConverter(timestampFieldName);

            serializer.Converters.Add(converter);
        }
 private static void ProcessListOfItemsToCSV <T>(List <T> listItems, string fullFileName)
 {
     using (var file = new StreamWriter(fullFileName))
     {
         var csvString = CsvConverter.Serialize <T>(listItems);
         file.WriteLine(csvString);
     }
 }
        private void DrawChart(List <string[]> csvContent)
        {
            Dictionary <DateTime, double> csvDictionary = CsvConverter.ConvertToDictionary(csvContent);

            Predictions.Clear();

            DiagrammPainter.UpdateSeries(csvDictionary);
        }