Exemple #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);
         }
     }
     
 }
Exemple #2
0
        // Método para imprimir la lista de los números premiados y ganadores
        public void printPrizeTicket(LTD_LotteryDraw pDraw, string[] pWinningNumberArray, bool pSendToPrint, bool pShowInPanel)
        {
            // Configurar impresión para Ticket de Venta
            TicketPrinter ticketPrinter = new TicketPrinter();
            PrizeTicket   prizeTicket   = new PrizeTicket();

            prizeTicket.companyName = UtilityService.getCompanyName();
            prizeTicket.title       = "NÚMEROS PREMIADOS";
            // Obtener datos del punto de venta
            LPS_LotteryPointSale pointSale = UtilityService.getPointSale();

            prizeTicket.pointSaleName = pointSale.LPS_DisplayName;
            prizeTicket.drawDate      = pDraw.LTD_CreateDate;
            // Obtener datos de tipo de sorteo
            LotteryDrawTypeRepository drawTypeRepo = new LotteryDrawTypeRepository();
            LDT_LotteryDrawType       drawType     = drawTypeRepo.getById(pDraw.LDT_LotteryDrawType);

            prizeTicket.drawTypeCode = drawType.LDT_Code;
            // Llenar datos del número de lista
            prizeTicket.createDate = DateTime.Now;
            // Obtener datos de los premios
            PrizeFactorService     prizeFactorService = new PrizeFactorService();
            LPF_LotteryPrizeFactor prizeFactor        = prizeFactorService.getByGroup(drawType.LDT_Id);

            if (prizeFactor != null)
            {
                prizeTicket.prizeFactorArray[0] = prizeFactor.LPF_FirtsPrizeFactor;
                prizeTicket.prizeFactorArray[1] = prizeFactor.LPF_SecondPrizeFactor;
                prizeTicket.prizeFactorArray[2] = prizeFactor.LPF_ThirdPrizeFactor;
            }
            // Obtener listado de información de ganadores
            LotteryListRepository listRepository = new LotteryListRepository();

            prizeTicket.listWinningInfo = listRepository.getWinningNumbersList(pDraw, pWinningNumberArray);
            prizeTicket.winnerNumbers   = pWinningNumberArray;
            ticketPrinter.prizeTicket   = prizeTicket;
            // Obtener nombre de impresora y enviar impresión
            string printerName = UtilityService.getTicketPrinterName();

            ticketPrinter.printPrizeTicket(printerName, pSendToPrint);
            // Almacenar importe de premio para el sorteo
            DrawBalanceService drawBalanceService = new DrawBalanceService();

            drawBalanceService.saveBalance(pDraw.LDT_LotteryDrawType, pDraw.LTD_CreateDate, 0, ticketPrinter.prizeImport);
            if (pShowInPanel)
            {
                //Console.Write(ticketPrinter.ticketStringText);
                MessageBox.Show(ticketPrinter.ticketStringText);
            }
        }
Exemple #3
0
        // Método para imprimir un ticket de venta de una lista
        public void printList(LTL_LotteryList pNumberList, int pTicketType = 0)
        {
            // Configurar impresión para Ticket de Venta
            SaleTicket saleTicket = new SaleTicket(pTicketType);

            saleTicket.companyName = UtilityService.getCompanyName();
            // Obtener datos del punto de venta
            LPS_LotteryPointSale pointSale = UtilityService.getPointSale();

            saleTicket.pointSaleName = pointSale.LPS_DisplayName;
            // Obtener usuario vendedor
            saleTicket.userName = SystemSession.username;
            // Obtener datos del sorteo
            LotteryDrawRepository drawRepo   = new LotteryDrawRepository();
            LTD_LotteryDraw       drawObject = drawRepo.getById(pNumberList.LTD_LotteryDraw);

            saleTicket.drawDate = drawObject.LTD_CreateDate;
            // Obtener datos de tipo de sorteo
            this.drawTypeRepo = new LotteryDrawTypeRepository();
            LDT_LotteryDrawType drawType = drawTypeRepo.getById(drawObject.LDT_LotteryDrawType);

            saleTicket.drawTypeCode = drawType.LDT_Code;
            // Obtener datos de los premios
            PrizeFactorService     prizeFactorService = new PrizeFactorService();
            LPF_LotteryPrizeFactor prizeFactor        = prizeFactorService.getByGroup(drawType.LDT_Id);

            if (prizeFactor != null)
            {
                saleTicket.prizeFactorArray[0] = prizeFactor.LPF_FirtsPrizeFactor;
                saleTicket.prizeFactorArray[1] = prizeFactor.LPF_SecondPrizeFactor;
                saleTicket.prizeFactorArray[2] = prizeFactor.LPF_ThirdPrizeFactor;
            }
            // Llenar datos del número de lista
            saleTicket.createDate   = DateTime.Now;
            saleTicket.ticketId     = pNumberList.LTL_Id;
            saleTicket.globalId     = pointSale.LPS_Id + "" + saleTicket.ticketId;
            saleTicket.customerName = pNumberList.LTL_CustomerName;
            // Obtener detalle de la lista procesada
            this.listRepo = new LotteryListRepository();
            saleTicket.listNumberDetail = listRepo.getTupleListDetail(pNumberList.LTL_Id);
            // Crear instancia de impresora y asignar el ticket
            TicketPrinter ticketPrinter = new TicketPrinter();

            ticketPrinter.saleTicket = saleTicket;
            // Obtener nombre de impresora y enviar impresión
            string printerName = UtilityService.getTicketPrinterName();

            ticketPrinter.printLotterySaleTicket(printerName);
        }
Exemple #4
0
        private bool copyAndDisplayListInstance(long pDrawTypeId)
        {
            bool                successResult = true;
            ListService         listService   = new ListService();
            LDT_LotteryDrawType selectedGroup = this.groupService.getById(pDrawTypeId);
            ListInstanceForm    listInstance  = new ListInstanceForm(
                this.appMediator,
                this.selectorForm,
                UtilityService.getPointSale(),
                selectedGroup,
                DateTime.Today,
                listService.getListDetail(this.listId)
                );

            listInstance.StartPosition = FormStartPosition.CenterParent;
            listInstance.ShowDialog();
            //MessageBox.Show("Display: " + selectedGroup.LDT_DisplayName);
            return(successResult);
        }
Exemple #5
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);
                }
            }
        }