Beispiel #1
0
        private void AddKey(ConnectionInfo connectionInfo, List <KeyInfo> listKeyInfo)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                BarcodeInfo bInfo = new BarcodeInfo();

                if (listKeyInfo != null)
                {
                    foreach (KeyInfo keyInfo in listKeyInfo)
                    {
                        VRTicketType vrTicketType = m.VRTicketTypes.Where(x => x.ID == keyInfo.KeyTypeID).FirstOrDefault();

                        if (vrTicketType != null)
                        {
                            BarcodeItem barcodeItem = new BarcodeItem()
                            {
                                IsPrintingKey = true,
                                KeyName       = vrTicketType.Type,
                                Minutes       = keyInfo.Minutes
                            };

                            bInfo.BarcodeItems.Add(barcodeItem);
                        }
                    }

                    GenerateBarcode(connectionInfo, bInfo);
                    GetKey(connectionInfo);
                }
            }
        }
Beispiel #2
0
        private void GenerateBarcode(ConnectionInfo connectionInfo, BarcodeInfo barcodeInfo)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                if (barcodeInfo.BarcodeItems.Count > 0)
                {
                    foreach (BarcodeItem bi in barcodeInfo.BarcodeItems)
                    {
                        VRTicketType vrTT       = null;
                        string       ticketType = "";
                        Guid         guid       = Utility.CreateGuid();

                        bi.DateStampCreate = DateTime.Now;

                        if (bi.IsPrintingTicket)
                        {
                            ticketType = "TICKET";
                        }
                        else if (bi.IsPrintingKey)
                        {
                            ticketType = bi.KeyName;
                        }

                        vrTT = m.VRTicketTypes.Where(x => x.Type == ticketType).FirstOrDefault();


                        VRTicket vrt = new VRTicket()
                        {
                            GUID            = guid.ToString(),
                            Minutes         = bi.Minutes,
                            TimeStampCreate = bi.DateStampCreate,
                            VRTicketTypeID  = (vrTT != null) ? (int?)vrTT.ID : null,
                            WaiverLogID     = bi.WaiverLogID
                        };

                        //string t = Convert.ToBase64String(guid.ToByteArray()).Replace("=", "");

                        //byte[] b = Convert.FromBase64String(t + "==");

                        //var g = new Guid(b);

                        m.Add(vrt);
                        bi.GUID = guid;
                    }

                    m.SaveChanges();
                    //m.Cache.Release(m.VRTickets);

                    VRCommandServer vcs = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GENERATE_BARCODE, barcodeInfo);

                    if (connectionInfo != null)
                    {
                        SendCommandToPeer(connectionInfo, vcs);
                    }
                    else
                    {
                        foreach (ConnectionInfo managingSysConn in _targetManagingSystemConnection)
                        {
                            SendCommandToPeer(managingSysConn, vcs);
                        }
                    }
                }
            }
        }