Ejemplo n.º 1
0
        public int verifyRegisteredDevices()
        {
            int isRegisteredSerial = -1;
            ManagementObjectCollection usbDevicesList = getUsbDevicesList();

            if (usbDevicesList.Count == 0)
            {
                isRegisteredSerial = 0;
                //MessageBox.Show("No hay dispositivos conectados.");
            }
            else
            {
                string registeredDeviceSerial = ParameterService.getDeviceValue();
                if (this.findUsbDeviceBySerialId(registeredDeviceSerial, getUsbDevicesList()))
                {
                    isRegisteredSerial = 1;
                    //MessageBox.Show("Bien.");
                }
                else
                {
                    isRegisteredSerial = -1;
                    //MessageBox.Show("Debe registrar el dispositivo.");
                }
            }
            return(isRegisteredSerial);
        }
Ejemplo n.º 2
0
        public bool syncDraw_ServerToLocal()
        {
            bool successProcess = true;
            long posId          = ParameterService.getSalePointId();

            // Realizar sincronización solamente si la sucursal está asignada
            if (posId != 0)
            {
                // Realizar la petición http
                ServerConnectionService connection     = new ServerConnectionService();
                ServiceResponseResult   responseResult = connection.getReopenDrawList(posId);
                successProcess = this.isValidResponse(responseResult);
                if (successProcess)
                {
                    string jsonStringResult = responseResult.result.ToString();
                    // Obtener array de los id de sorteos reabiertos para la sucursal
                    JArray jsonArray = JArray.Parse(jsonStringResult);
                    // Realizar la persistencia de los sorteos reabiertos
                    LotteryDrawRepository drawRepo = new LotteryDrawRepository();
                    foreach (var drawId in jsonArray)
                    {
                        LTD_LotteryDraw draw = drawRepo.getById((long)drawId);
                        if (draw != null)
                        {
                            draw.LDS_LotteryDrawStatus = SystemConstants.DRAW_STATUS_REOPENED;
                            drawRepo.save(ref draw);
                            // Cambiar todos los registros de QR a pendiente
                            ListService listService = new ListService();
                            listService.changeListStatusFromQRUpdated(draw, SystemConstants.SYNC_STATUS_PENDING_TO_SERVER);
                        }
                    }
                }
            }
            return(successProcess);
        }
Ejemplo n.º 3
0
        private void setIncrementTableValues()
        {
            LPR_LocalParameter listIncrementParam = ParameterService.getInitialListIncrementParam();

            if (listIncrementParam == null)
            {
                ParameterService.setInitialListIncrementParam("0", 5);
            }
        }
Ejemplo n.º 4
0
        public void saveDrawSaleImport(long pDrawType, DateTime pDrawDate)
        {
            // Obtener total de venta del sorteo
            ListService listService = new ListService();
            long        saleImport  = listService.getDrawSaleImport(ParameterService.getSalePointId(), pDrawDate, pDrawType);
            // Almacenar importe de premio para el sorteo
            DrawBalanceService drawBalanceService = new DrawBalanceService();

            drawBalanceService.saveBalance(pDrawType, pDrawDate, saleImport);
        }
Ejemplo n.º 5
0
        public object generateDrawClosingJson(DateTime pDrawDate, long pGroupId, long pStatus)
        {
            DrawService     drawService = new DrawService();
            LTD_LotteryDraw draw        = drawService.getDraw(pGroupId, pDrawDate);
            // Crear el objeto JSON
            var jsonObject = new
            {
                lotteryPointSale = ParameterService.getSalePointId(),
                lotteryDraw      = new
                {
                    id = draw.LTD_Id,
                    lotteryDrawType   = draw.LDT_LotteryDrawType,
                    lotteryDrawStatus = pStatus,
                    createDate        = draw.LTD_CreateDate
                },
                createDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
            }
            ;

            return(jsonObject);
        }
Ejemplo n.º 6
0
        public void saveLoginEvent(string pUser, int authResult)
        {
            string user       = "******";
            string externalIp = "ERROR";

            try
            {
                user       = pUser.ToLower();
                externalIp = new WebClient().DownloadString("http://icanhazip.com");
            }
            catch (Exception e)
            {
                // Capturar errores en el log
                LogService.log(e.Message, e.StackTrace);
            }
            LGV_LoginEvents loginEvent = new LGV_LoginEvents();

            loginEvent.LGV_EventDate = DateTime.Now;
            loginEvent.LGV_IpAdress  = externalIp;
            loginEvent.LGV_User      = user;
            //loginEvent.LGV_User = authResult + " | " + user;
            loginEvent.LGV_DeviceId = ParameterService.getDeviceValue();
            loginEventRepo.saveWithStatus(loginEvent, loginEvent.LGV_Id, (e1, e2) => e1.copy(e2));
        }