Ejemplo n.º 1
0
 public void fillDrawInfoLabels(DateTime pDrawDate, long pGroupId)
 {
     
     this.clearDrawInfoLabels();
     if (pGroupId != 0)
     {
         DrawTypeService drawTypeService = new DrawTypeService();
         LDT_LotteryDrawType drawType = drawTypeService.getById(pGroupId);
         if (drawType != null)
         {
             this.setPosNameLabel(ParameterService.getSystemSalePoint().LPS_DisplayName);
             this.setDrawTitleLabel("Sorteo:");
             this.setGroupNameLabel(drawType.LDT_DisplayName);
             this.setDayDrawLabel(UtilityService.getDayName(pDrawDate));
             this.setDateDrawLabel(UtilityService.getSimpleDate(pDrawDate));
         }
         PrizeFactorService prizeFactorService = new PrizeFactorService();
         LPF_LotteryPrizeFactor prizeFactor = prizeFactorService.getByPointSaleAndGroup(ParameterService.getSalePointId(), pGroupId);
         if (prizeFactor != null)
         {
             string prizes = Convert.ToInt32(prizeFactor.LPF_FirtsPrizeFactor) + "% | "
                 + Convert.ToInt32(prizeFactor.LPF_SecondPrizeFactor) + "% | "
                 + Convert.ToInt32(prizeFactor.LPF_ThirdPrizeFactor) + "%"
                 ;
             this.setPayDrawTitleLabel("Paga:");
             this.setPrizeFactorDrawLabel(prizes);
         }
     }
     
 }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        private void closeDraw(long pDrawTypeToClose, DateTime pDateToClose)
        {
            DrawService     drawService  = new DrawService();
            LTD_LotteryDraw existingDraw = drawService.getDraw(pDrawTypeToClose, pDateToClose);

            // Validar si el sorteo está cerrado
            if (existingDraw == null || existingDraw.LDS_LotteryDrawStatus == SystemConstants.DRAW_STATUS_CLOSED)
            {
                MessageService.displayInfoMessage(
                    "El sorteo se encuentra cerrado\nNo es necesario realizar la operación.",
                    "SORTEO CERRADO PREVIAMENTE"
                    );
                this.clearDrawTypeBox();
            }
            else
            {
                List <LTD_LotteryDraw> otherUnclosedDrawList = drawService.getUnclosedDraw(pDrawTypeToClose, pDateToClose);
                if (otherUnclosedDrawList.Count > 0)
                {
                    DrawTypeService     drawType  = new DrawTypeService();
                    LDT_LotteryDrawType type      = drawType.getById(pDrawTypeToClose);
                    string unclosedDateListString = "\n\n";
                    foreach (LTD_LotteryDraw drawItem in otherUnclosedDrawList)
                    {
                        if (drawItem.LTD_CreateDate != pDateToClose)
                        {
                            unclosedDateListString += type.LDT_DisplayName + "\t" + FormatService.formatDrawDateToSimpleString(drawItem.LTD_CreateDate) + "\n";
                        }
                    }
                    //Console.WriteLine(unclosedDateListString);
                    MessageService.displayWarningMessage(
                        "Existen sorteos de fechas anteriores pendientes de cierre.\nPor favor, proceda primero a realizar los cierres pendientes:" + unclosedDateListString,
                        "SORTEOS ANTERIORES SIN CERRAR"
                        );
                    //this.clearDrawTypeBox();
                }
                else
                {
                    this.confirmDrawClosing(pDrawTypeToClose, pDateToClose);
                }
            }
        }