Пример #1
0
        private bool startQRGenrationAndClosing(long pDrawType, DateTime pDrawDate, string pQRText)
        {
            bool successGeneration = true;
            // Cambiar estado de lista a QR Generado
            ListService listService = new ListService();

            listService.changeSyncStatusToQRUpdated(pDrawType, pDrawDate);
            // Obtener parámetros del QR generado
            DrawTypeService  drawTypeService = new DrawTypeService();
            PointSaleService posService      = new PointSaleService();

            this.dateLabel.Text = "" + UtilityService.getLargeDate(pDrawDate);
            this.drawLabel.Text = "Grupo: " + drawTypeService.getById(pDrawType).LDT_DisplayName;
            this.posLabel.Text  = "Suc: " + posService.getPointSale().LPS_DisplayName;
            // Obtener QRString codificada
            string qrOriginalText = UtilityService.getEncodeQRString(pQRText, pDrawDate, pDrawType);

            Console.WriteLine("Original QR: " + qrOriginalText);
            //text = UtilityService.compressText(text);
            string qrEncriptedText = qrOriginalText;

            Console.WriteLine("Compress QR: " + qrEncriptedText);

            // Setear el QRText y obtener las propiedades del mismo
            this.qrText = qrEncriptedText;
            int qrTextLength = qrEncriptedText.Length;
            int zerosCount   = (from c in qrEncriptedText where c == '0' select c).Count();

            // Desplegar propiedades del QR
            this.countLabel.Text = qrTextLength + " | " + zerosCount;
            this.displayQRPanel.BackgroundImage = UtilityService.buildQRCode(qrEncriptedText, this.displayQRPanel.Width, this.displayQRPanel.Height);

            // Validar tamaño de QR y advertir en caso de ser muy grande
            int maxQRSizeSuported = 350;

            if (qrTextLength > maxQRSizeSuported)
            {
                MessageService.displayErrorMessage(
                    "El QR parece tener un tamaño no apropiado para ser leído.\nEs preferible que copie el QR y lo envíe por whatsapp.\nEn caso de duda contacte al administrador.",
                    "PREFERIBLE EL ENVÍO DEL QR POR WHATSAPP"
                    );
            }
            // Cerrar el sorteo
            if (pDrawDate != null && pDrawType != 0)
            {
                DrawService drawService = new DrawService();
                drawService.changeDrawStatus(pDrawType, pDrawDate, SystemConstants.DRAW_STATUS_CLOSED);
            }
            return(successGeneration);
        }
Пример #2
0
 public async void closeTransactions(int pSyncType, DateTime? pDrawDate = null, long pDrawType = 0)
 {
     bool syncResult = await this.processParallelSynchronization(pDrawDate, pDrawType, pSyncType);
     if (syncResult)
     {
         if (pDrawDate != null && pDrawType != 0)
         {
             DrawService drawService = new DrawService();
             drawService.changeDrawStatus(pDrawType, pDrawDate, SystemConstants.DRAW_STATUS_CLOSED);
             MessageService.displayInfoMessage(
             "El sorteo fue cerrado de manera exitosa",
             "CIERRE COMPLETADO"
             );
         }
     }
 }