示例#1
0
        public static long getPointSaleId()
        {
            LotteryPointSaleRepository posRepository = new LotteryPointSaleRepository();
            long posId = Convert.ToInt64(getLocalParameterValue(POS_NAME_PARAM));

            return(posRepository.getById(posId).LPS_Id);
        }
        public bool requestPosInitialization()
        {
            bool instanceSetting = true;
            long userPosId       = SystemSession.sessionUser.LPS_LotteryPointSale;
            LotteryPointSaleRepository pointSaleRepo = new LotteryPointSaleRepository();

            SystemSession.sessionPointSale = pointSaleRepo.getById(userPosId);
            DialogResult msgResult =
                MessageService.displayConfirmMessage(
                    GeneralConstants.getPosConfirmMessage(SystemSession.sessionUser, SystemSession.sessionPointSale),
                    GeneralConstants.POS_CONFIRM_TITLE
                    );

            // Procesar el resultado de la confirmación
            switch (msgResult)
            {
            case DialogResult.Yes:
                // Configurar la instancia de sucursal
                this.initializePosParameter(userPosId);
                break;

            case DialogResult.No:
                instanceSetting = false;
                MessageService.displayErrorMessage(
                    GeneralConstants.POS_INITIALIZATION_ERROR,
                    GeneralConstants.POS_INITIALIZATION_TITLE
                    );
                break;

            default:
                break;
            }
            return(instanceSetting);
        }
示例#3
0
        public LPS_LotteryPointSale getPointSale()
        {
            LotteryPointSaleRepository posRepository = new LotteryPointSaleRepository();
            // TODO: Validar si es número
            long posId = Convert.ToInt64(UtilityService.getLocalParameterValue(ParameterConstants.POS_NAME_PARAM));

            return(posRepository.getById(posId));
        }
示例#4
0
        public static LPS_LotteryPointSale getSystemSalePoint()
        {
            LPS_LotteryPointSale pointSaleInstance = null;
            string localParam = getSalePointParamValue();

            if (localParam.Trim() != "")
            {
                LotteryPointSaleRepository posRepository = new LotteryPointSaleRepository();
                // TODO: Validar si es número
                long posId = Convert.ToInt64(localParam);
                pointSaleInstance = posRepository.getById(posId);
            }

            return(pointSaleInstance);
        }
        private bool requestPosId()
        {
            bool   instanceSetting = true;
            string salePointId     = this.getLocalPointSale();

            if (ValidationService.isValidId(salePointId))
            {
                LotteryPointSaleRepository pointSaleRepo = new LotteryPointSaleRepository();
                SystemSession.sessionPointSale = pointSaleRepo.getById(long.Parse(salePointId));
            }
            else
            {
                // Solicitar inicialización de Sucursal solamente si el usuario no es SA
                if (SystemSession.sessionUser != null && SystemSession.sessionUser.USR_UserRole != SystemConstants.ROLE_SA_ID)
                {
                    instanceSetting = this.requestPosInitialization();
                }
            }
            return(instanceSetting);
        }
        private bool validateSalePointInstance()
        {
            bool   instanceSetting = true;
            string salePointId     = this.getLocalPointSale();

            if (ValidationService.isValidId(salePointId))
            {
                LotteryPointSaleRepository pointSaleRepo = new LotteryPointSaleRepository();
                SystemSession.sessionPointSale = pointSaleRepo.getById(long.Parse(salePointId));
            }
            else
            {
                // Sucursal no inicializada, lanzar error
                instanceSetting = false;
                MessageService.displayErrorMessage(
                    GeneralConstants.UNINITIALIZED_SYSTEM_ERROR,
                    GeneralConstants.UNINITIALIZED_SYSTEM_TITLE
                    );
            }
            return(instanceSetting);
        }
示例#7
0
        public object generateSimpleListObject(LTL_LotteryList pListObject,
                                               long pListStatus = SystemConstants.LIST_STATUS_CREATED,
                                               long pSyncStatus = SystemConstants.SYNC_STATUS_COMPLETED
                                               )
        {
            LotteryDrawRepository      lotteryDrawRepository = new LotteryDrawRepository();
            LTD_LotteryDraw            draw      = lotteryDrawRepository.getById(pListObject.LTD_LotteryDraw);
            LotteryPointSaleRepository saleRepo  = new LotteryPointSaleRepository();
            LPS_LotteryPointSale       pointSale = saleRepo.getById(pListObject.LPS_LotteryPointSale);
            // Crear el objeto JSON
            var jsonObject = new
            {
                listNumber        = pListObject.LTL_Id,
                lotteryPointSale  = pointSale.LPS_Id,
                lotteryDraw       = pListObject.LTD_LotteryDraw,
                lotteryListStatus = pListStatus,
                synchronyStatus   = pSyncStatus,
                customerName      = pListObject.LTL_CustomerName,
                createDate        = pListObject.LTL_CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
            };

            return(jsonObject);
        }
示例#8
0
        public object generateListObject(LTL_LotteryList pListObject)
        {
            LotteryDrawRepository      lotteryDrawRepository = new LotteryDrawRepository();
            LTD_LotteryDraw            draw      = lotteryDrawRepository.getById(pListObject.LTD_LotteryDraw);
            LotteryPointSaleRepository saleRepo  = new LotteryPointSaleRepository();
            LPS_LotteryPointSale       pointSale = saleRepo.getById(pListObject.LPS_LotteryPointSale);
            // Crear el objeto JSON
            var jsonObject = new
            {
                listNumber       = pListObject.LTL_Id,
                lotteryPointSale = new
                {
                    id              = pointSale.LPS_Id,
                    code            = pointSale.LPS_Code,
                    synchronyStatus = new
                    {
                        code        = "SC",
                        displayName = "Sincronizado",
                        description = "Sincronización completa",
                        id          = 3
                    },
                    displayName = pointSale.LPS_DisplayName,
                    description = pointSale.LPS_Description,
                    company     = new
                    {
                        code        = "TR",
                        displayName = "TIEMPOS RIVERA",
                        description = "Tiempos Rivera",
                        id          = 1,
                        createDate  = pointSale.LPS_CreateDate.ToString("yyyy-MM-dd HH:mm:ss")
                    },
                    createDate = pointSale.LPS_CreateDate.ToString("yyyy-MM-dd HH:mm:ss")
                },
                lotteryDraw = new
                {
                    id = pListObject.LTD_LotteryDraw,
                    lotteryDrawType   = draw.LDT_LotteryDrawType,
                    lotteryDrawStatus = draw.LDS_LotteryDrawStatus,
                    createDate        = draw.LTD_CreateDate
                },
                lotteryListStatus = new
                {
                    id          = 2,
                    code        = "R",
                    displayName = "Borrada",
                    description = "Borrada"
                },
                synchronyStatus = new
                {
                    id          = 3,
                    code        = "SC",
                    displayName = "Sincronización completa",
                    description = "Sincronización completa"
                },
                customerName = pListObject.LTL_CustomerName,
                createDate   = pListObject.LTL_CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
            }
            ;

            return(jsonObject);
        }