Beispiel #1
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);
                }
            }
        }