コード例 #1
0
        public ActionResult Create()
        {
            Random random    = new Random();
            long   rndKartID = 0;

            while (true)
            {
                rndKartID = LongRandom.Random(1000000000, 3999999999, random);
                if (_visitorsService.GetByKartId(rndKartID.ToString()) != null)
                {
                }
                else
                {
                    break;
                }
            }
            QRCodeEncoder encoder = new QRCodeEncoder();

            encoder.QRCodeEncodeMode   = QRCodeEncoder.ENCODE_MODE.BYTE;
            encoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.L;
            encoder.QRCodeVersion      = 4;
            Bitmap bitmap = encoder.Encode(rndKartID.ToString());
            var    kartID = DecodeBitmap(bitmap);

            TempData["bitmap"] = bitmap;
            var GecisGrubu = _groupMasterService.GetAllGroupsMaster();
            var model      = new QuicResponseViewModel
            {
                QRCode  = kartID,
                Grup_No = GecisGrubu.Select(a => new SelectListItem
                {
                    Text  = a.Grup_Adi,
                    Value = a.Grup_No.ToString()
                })
            };

            return(View(model));
        }