Beispiel #1
0
        public ActionResult GetReporte(int id)
        {
            int pageToLoad = id;

            if (pageToLoad == 0)
            {
                pageToLoad = 1;
            }

            LlamadasDBService llamadasService = new LlamadasDBService();

            var data = llamadasService.Llamadas_Recupera(pageToLoad);

            var callDetailsCount = data.Item1;
            var callDetails      = data.Item2;

            var pager = new Pager(callDetailsCount, pageToLoad);

            var viewModel = new IndexViewModel
            {
                Llamadas = callDetails, // callDetails.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize),
                Pager    = pager
            };

            return(View(viewModel));
        }
Beispiel #2
0
        public static void CreaterPDF()
        {
            LlamadasDBService llamadasService = new LlamadasDBService();

            var data        = llamadasService.Llamadas_Recupera(1);
            var callDetails = data.Item2;

            //file name to be created
            var exportFolder   = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            var strPDFFileName = System.IO.Path.Combine(exportFolder, "SamplePDF.pdf");

            using (var writer = new PdfWriter(strPDFFileName))
            {
                using (var pdf = new PdfDocument(writer))
                {
                    var document = new Document(pdf, iText.Kernel.Geom.PageSize.LETTER);
                    document.SetMargins(20, 20, 20, 20);
                    var font = PdfFontFactory.CreateFont(StandardFonts.HELVETICA);
                    var bold = PdfFontFactory.CreateFont(StandardFonts.HELVETICA_BOLD);

                    Table table = new Table(new float[] { 10, 1, 3, 4 });
                    table.SetWidth(iText.Layout.Properties.UnitValue.CreatePercentValue(100));

                    //process(table, line, bold, true);

                    foreach (var llamada in callDetails)
                    {
                        process(table, llamada, font, false);
                    }

                    document.Add(table);
                    document.Close();
                }
            }
        }
Beispiel #3
0
        public ActionResult GetReporte(string reporte)
        {
            LlamadasDBService llamadasService = new LlamadasDBService();

            var data = llamadasService.Llamadas_Recupera(1);

            var callDetailsCount = data.Item1;
            var callDetails      = data.Item2;

            return(View(callDetails));
        }
Beispiel #4
0
        public ActionResult CargaLlamadas()
        {
            LlamadasDBService dbServiceLlamadas = new LlamadasDBService();

            string messageError  = dbServiceLlamadas.Llamadas_Carga();
            bool   statusProcess = false;

            Session["messageError"] = messageError;
            Session["sessionInit"]  = true;

            if (!string.IsNullOrEmpty(messageError))
            {
                //Response.StatusCode = (int)HttpStatusCode.BadRequest;
                statusProcess = false;
            }
            else
            {
                //Response.StatusCode = (int)HttpStatusCode.OK;
                statusProcess = true;
            }

            return(Json(new { success = statusProcess, message = messageError }, JsonRequestBehavior.AllowGet));
        }