コード例 #1
0
ファイル: DeviceService.cs プロジェクト: melfallas/SILO
        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);
        }
コード例 #2
0
ファイル: SynchronizeService.cs プロジェクト: melfallas/SILO
        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);
        }
コード例 #3
0
        private void setIncrementTableValues()
        {
            LPR_LocalParameter listIncrementParam = ParameterService.getInitialListIncrementParam();

            if (listIncrementParam == null)
            {
                ParameterService.setInitialListIncrementParam("0", 5);
            }
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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));
        }