Esempio n. 1
0
        private void BindDropDownLists(Kiosk kiosk = null)
        {
            RockContext      rockContext      = new RockContext();
            KioskTypeService kioskTypeService = new KioskTypeService(rockContext);

            var kioskTypes = kioskTypeService
                             .Queryable()
                             .OrderBy(t => t.Name)
                             .Select(t => new
            {
                t.Name,
                t.Id
            })
                             .ToList();

            ddlManualKioskType.DataSource = kioskTypes;
            ddlManualKioskType.DataBind();

            ddlKioskType.DataSource = kioskTypes;
            ddlKioskType.DataBind();

            var preSelectedKioskTypeId = GetBlockUserPreference("KioskTypeId").AsInteger();

            if (kioskTypes.Where(k => k.Id == preSelectedKioskTypeId).Any())
            {
                ddlManualKioskType.SelectedValue = preSelectedKioskTypeId.ToString();
            }
        }
Esempio n. 2
0
        public static void Clear(List <int> groupTypeIds)
        {
            RockContext      rockContext      = new RockContext();
            KioskTypeService kioskTypeService = new KioskTypeService(rockContext);
            KioskService     kioskService     = new KioskService(rockContext);
            DeviceService    deviceService    = new DeviceService(rockContext);



            var kioskTypeIds = kioskTypeService.Queryable()
                               .Where(k => k.GroupTypes.Select(gt => gt.Id).Where(i => groupTypeIds.Contains(i)).Any())
                               .Select(kt => kt.Id)
                               .ToList();

            var deviceNames = kioskService.Queryable()
                              .Where(k => kioskTypeIds.Contains(k.KioskTypeId ?? 0)).Select(k => k.Name)
                              .ToList();

            var devices = deviceService.Queryable().Where(d => deviceNames.Contains(d.Name)).ToList();

            foreach (var device in devices)
            {
                FlushItem(device.Id);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Binds the grid.
        /// </summary>
        private void BindGrid()
        {
            var kioskTypeService = new KioskTypeService(new RockContext());
            var kioskTypes       = kioskTypeService.Queryable()
                                   .Select(kt => kt)
                                   .OrderBy(k => k.Name)
                                   .ToList();

            gKioskTypes.DataSource = kioskTypes;
            gKioskTypes.DataBind();
        }
Esempio n. 4
0
        private void BindDropDownList(Kiosk kiosk = null)
        {
            RockContext      rockContext      = new RockContext();
            KioskTypeService kioskTypeService = new KioskTypeService(rockContext);


            ddlKioskType.DataSource = kioskTypeService
                                      .Queryable()
                                      .OrderBy(t => t.Name)
                                      .Select(t => new
            {
                t.Name,
                t.Id
            })
                                      .ToList();
            ddlKioskType.DataBind();
        }
Esempio n. 5
0
        private void BindDropDownList(Kiosk kiosk = null)
        {
            RockContext      rockContext      = new RockContext();
            KioskTypeService kioskTypeService = new KioskTypeService(rockContext);


            ddlKioskType.DataSource = kioskTypeService
                                      .Queryable()
                                      .OrderBy(t => t.Name)
                                      .Select(t => new
            {
                t.Name,
                t.Id
            })
                                      .ToList();
            ddlKioskType.DataBind();


            ddlPrintFrom.BindToEnum <PrintFrom>();

            ddlPrinter.Items.Clear();
            ddlPrinter.DataSource = new DeviceService(new RockContext())
                                    .GetByDeviceTypeGuid(new Guid(Rock.SystemGuid.DefinedValue.DEVICE_TYPE_PRINTER))
                                    .OrderBy(d => d.Name)
                                    .ToList();
            ddlPrinter.DataBind();
            ddlPrinter.Items.Insert(0, new ListItem(None.Text, None.IdValue));

            if (kiosk != null)
            {
                ddlKioskType.SetValue(kiosk.KioskTypeId);
                ddlPrintTo.SetValue(kiosk.PrintToOverride.ConvertToInt().ToString());
                ddlPrinter.SetValue(kiosk.PrinterDeviceId);
                ddlPrintFrom.SetValue(kiosk.PrintFrom.ConvertToInt().ToString());
            }
        }