public ActionResult Index() { var domainModel = _policyService.GetByUserId(CurrentUserId); var model = new DeviceListViewModel(domainModel); return View(model); }
public StatisticPage() { DeviceListViewModel viewModel = new DeviceListViewModel(); DataContext = viewModel; InitializeComponent(); }
public ActionResult Index() { var domainModel = _policyService.GetByUserId(CurrentUserId); var model = new DeviceListViewModel(domainModel); return(View(model)); }
public DeviceListPage(AuthViewModel authViewModel) { DeviceListViewModel viewModel = new DeviceListViewModel(authViewModel); DataContext = viewModel; InitializeComponent(); }
public ActionResult DeviceList() { var deviceListDomainModel = _policyService.GetAll(); var deviceListViewModel = new DeviceListViewModel(deviceListDomainModel); return(View(deviceListViewModel)); }
public DeviceListViewModel getListDevices(ParamGetListDevices param) { var returndata = new DeviceListViewModel(); returndata.listDevices = new List <DeviceViewModel>(); try { returndata.CountData = _db.Devices.Count(); returndata.listDevices = (from a in _db.Devices select new DeviceViewModel { Id = a.Id, IMEI = a.IMEI, Model = a.Model, SimCardNo = a.SimCardNo, Enabled = a.Enabled, CreatedDate = a.CreatedDate, CreatedDateFormat = a.CreatedDate.ToString("dd MMM yyyy"), CreatedBy = a.CreatedBy }).OrderBy(x => x.CreatedDate).Skip((param.page - 1) * param.itemPerPage).Take(param.itemPerPage).ToList(); return(returndata); } catch (Exception ex) { _logger.Log(LogLevel.Critical, ex.Message.ToString()); throw new ArgumentException(ex.Message); } }
public DeviceListViewModel GetAllDevice(string account, string token, int projectId) { DeviceService ds = new DeviceService(); DeviceListViewModel dlvm = ds.FindMenuDevices(token, projectId, account); return(dlvm); }
private async void Search_Clicked(object sender, EventArgs e) { DeviceListViewModel viewModel = new DeviceListViewModel(); if (String.IsNullOrEmpty(this.SerialNumber.Text)) { await DisplayAlert("Invalid serial number", "At least one character must be specified.", "OK"); } else { try { viewModel.SerialNumber = this.SerialNumber.Text; if (viewModel.Devices.Count == 1) { await Navigation.PushAsync(new DevicePage(viewModel.Devices[0])); } else { await Navigation.PushAsync(new DeviceListPage(viewModel)); } } catch (Exception ex) { await DisplayAlert("Error on requesting Devices", ex.Message, "OK"); } } }
public IActionResult GetSearch(string searchText, int limit = 25, int offset = 0) { try { var result = searchText.ToLower().Split(new char[] { ' ', ',' }).ToList(); var devices = _bl.GetFilteredDevicesUser(null) .ToList() .Select(i => { var newDeviceViewModel = new DeviceViewModel(i).LoadMeta(i); newDeviceViewModel.Stock = _bl.GetDevices().ToList().Where(j => j.Status.Description == "Verfügbar") .Count(j => j.DeviceGroupSlug == newDeviceViewModel.DeviceGroupSlug); return(newDeviceViewModel); }) .ToList(); result.ForEach(i => { devices = devices.Where(x => x.Name.ToLower().Contains(i) || x.Marke.ToLower().Contains(i) || x.InvNum.Contains(i)) .ToList(); }); var deviceList = new DeviceListViewModel(devices.Skip(offset).Take(limit), limit, devices.Count); return(Ok(deviceList)); } catch (Exception ex) { _log.LogError("Exception: {0}", ex); return(StatusCode(500)); } }
public IActionResult GetAll(int limit = 25, int offset = 0) { try { var devices = _bl.GetDevices() .ToList() .Select(i => { var newDeviceViewModel = new DeviceViewModel(i).LoadMeta(i); newDeviceViewModel.Stock = _bl.GetDevices().ToList().Where(j => j.Status.Description == "Verfügbar") .Count(j => j.DeviceGroupSlug == newDeviceViewModel.DeviceGroupSlug); return(newDeviceViewModel); }) .ToList(); var deviceList = new DeviceListViewModel(devices.Skip(offset).Take(limit), limit, devices.Count); return(Ok(deviceList)); } catch (Exception ex) { _log.LogError("Exception: {0}", ex); return(StatusCode(500)); } }
public DeviceEventTriggerViewModel(DeviceEventTrigger trigger) : base(trigger) { Option = new OptionViewModel(trigger, nameof(trigger.Option)); Device = new DeviceListViewModel(trigger, DeviceListViewModel.DeviceListKind.DefaultPlayback | DeviceListViewModel.DeviceListKind.Recording); Attach(Option); Attach(Device); }
public DefaultDeviceConditionViewModel(DefaultDeviceCondition condition) : base(condition) { Option = new OptionViewModel(condition, nameof(condition.Option)); Device = new DeviceListViewModel(condition, DeviceListViewModel.DeviceListKind.Recording); Attach(Option); Attach(Device); }
public SetDeviceMuteActionViewModel(SetDeviceMuteAction action) : base(action) { _action = action; Option = new OptionViewModel(action, nameof(action.Option)); Device = new DeviceListViewModel(action, DeviceListViewModel.DeviceListKind.Recording | DeviceListViewModel.DeviceListKind.DefaultPlayback); Attach(Option); Attach(Device); }
public AppEventTriggerViewModel(AppEventTrigger trigger) : base(trigger) { Option = new OptionViewModel(trigger, nameof(trigger.Option)); Device = new DeviceListViewModel(trigger, DeviceListViewModel.DeviceListKind.DefaultPlayback); App = new AppListViewModel(trigger, AppListViewModel.AppKind.Default); Attach(Option); Attach(Device); Attach(App); }
public SetAppMuteActionViewModel(SetAppMuteAction action) : base(action) { _action = action; Option = new OptionViewModel(action, nameof(action.Option)); App = new AppListViewModel(action, AppListViewModel.AppKind.EveryApp | AppListViewModel.AppKind.ForegroundApp); Device = new DeviceListViewModel(action, DeviceListViewModel.DeviceListKind.DefaultPlayback); Attach(Option); Attach(App); Attach(Device); }
public ActionResult View(int SiteId) { try { var provider = new SiteProvider(DomainSession.GetDataContextForUserContext(this.HttpContext)); DeviceListViewModel model = new DeviceListViewModel(provider.GetById(SiteId)); return(View(model)); } catch (Exception e) { return(View()); } }
public ActionResult View(int siteId) { try { string domainId = DomainSession.GetContextDomain(this.HttpContext); iotDomain d = Icont.Domains.First(dm => dm.DomainName.Equals(domainId)); DeviceListViewModel model = new DeviceListViewModel(d.Sites.First(s => s.Id == siteId)); return(View(model)); } catch (Exception e) { } return(View()); }
public DeviceListViewModel GetNormalDevice() { var vm = new DeviceListViewModel() { Devices = _context.Device.OfType <Device>().Select(x => new DeviceListItemViewModel { Id = x.Id, Manufacturer = x.Manufacturer, Model = x.Model, SerialNumber = x.SerialNumber, DeviceOwner = x.DeviceOwner, DeviceDescription = x.DeviceDescription, Categories = x.Categories }) }; return(vm); }
public ViewResult ProductsList(string category) { IEnumerable <Device> devices = null; string currCategory = ""; if (string.IsNullOrEmpty(category)) { devices = _devices.Devices.OrderBy(i => i.Id); } else { if (string.Equals("phones", category, StringComparison.OrdinalIgnoreCase)) { devices = _devices.Devices.Where(i => i.Category.CategoryName.Equals("Mobile phones")).OrderBy(i => i.Name); currCategory = "Mobile phones"; } else if (string.Equals("games", category, StringComparison.OrdinalIgnoreCase)) { devices = _devices.Devices.Where(i => i.Category.CategoryName.Equals("Game zone")).OrderBy(i => i.Name); currCategory = "Game zone"; } else if (string.Equals("computers", category, StringComparison.OrdinalIgnoreCase)) { devices = _devices.Devices.Where(i => i.Category.CategoryName.Equals("Computers")).OrderBy(i => i.Name); currCategory = "Computers & Notebooks"; } else { return(View("Error")); } } ViewBag.Title = "Devices List"; var deviceObj = new DeviceListViewModel { Devices = devices, CurrentCategory = currCategory }; return(View(deviceObj)); }
public DeviceListViewModel GetAllDevicesFilterByUserId(string userName) { var vm = new DeviceListViewModel() { Devices = _context.Device.Where(x => x.DeviceOwner.UserName == userName) .Select(x => new DeviceListItemViewModel { Id = x.Id, Manufacturer = x.Manufacturer, Model = x.Model, SerialNumber = x.SerialNumber, DeviceOwner = x.DeviceOwner, DeviceDescription = x.DeviceDescription, Categories = x.Categories }) }; return(vm); }
/// <summary> /// 查找项目下的设备列表 /// </summary> /// <param name="token">组织标示</param> /// <param name="projectId">项目标示</param> public DeviceListViewModel FindMenuDevices(string token, int projectId, string userName) { DeviceListViewModel dlvm = new DeviceListViewModel(); #region 验证用户是否有权限查看该节点 bool bRet = new UserService().IsAuthProject(userName, token, projectId, 0); if (!bRet) { //用户没有权限查看 dlvm.Success = false; dlvm.Message = "用户没有权限查看该项目下的设备"; return(dlvm); } #endregion //查找节点信息 List <ProjectModel> list = new List <ProjectModel>(); //查找所有叶子节点 list = FindMenu(projectId, token, list); foreach (var item in list) { List <DeviceModel> ldm = _dr.Find(item.Id, item.Token); foreach (var dm in ldm) { DeviceViewModel dvm = new DeviceViewModel(); dvm.DeviceName = dm.DeviceName; dvm.DeviceSn = dm.DeviceSn; dvm.DeviceNo = dm.DeviceNo; dvm.DeviceDescription = dm.DeviceDescription; dvm.ProjectId = dm.ProjectId; dvm.Token = dm.Token; dvm.TypeId = dm.TypeId; dvm.UseTime = dm.UseTime; dvm.ProductTime = dm.ProductTime; dlvm.list.Add(dvm); } } dlvm.Success = true; dlvm.Message = "获取该项目下的设备成功"; return(dlvm); }
public JsonResult GetListDevices([FromBody] ParamGetListDevices param) { var returnData = new DeviceListViewModel(); try { returnData = _facade.getListDevices(param); return(Json(new ApiResult <DeviceListViewModel>() { isSuccessful = true, Payload = returnData })); } catch (Exception ex) { return(Json(new ApiResult <DeviceListViewModel>() { isSuccessful = false, Payload = returnData, message = ex.Message })); } }
public ActionResult Index(int page = 1) { WSRequest request = new WSRequest("devices/?page=" + page); request.AddAuthorization(Session["token"].ToString()); var response = request.Get(); if (response.Code != 200) { return(RedirectToAction("Index", "Profile", new { message = "Não foi possível buscar os devices" })); } var body = response.Body; DeviceListViewModel model = new DeviceListViewModel(); var pagination = body.GetValue("pagination"); model.Pagination = new PaginationViewModel { NextPage = (bool)pagination["next_page"], PreviousPage = (bool)pagination["previous_page"], CurrentPage = (int)pagination["current_page"], TotalNumberPages = (int)pagination["total_number_pages"], }; model.Devices = new List <DeviceViewModel>(); foreach (var device in body["devices"]) { model.Devices.Add(new DeviceViewModel { IdDevice = (int)device["id_device"], //Alarm = (bool)device["alarm"], Alias = device["alias"].ToString(), Color = device["color"].ToString(), FrequencyUpdate = (int)device["frequency_update"], IdUser = (int)device["id_user"] }); } ; return(View(model)); }
public DeviceListView(DeviceListViewModel viewModel) { this.viewModel = viewModel; this.DataContext = viewModel; InitializeComponent(); //hideButton.Command = new DelegateCommand( // () => this.Visibility = Visibility.Collapsed, // () => true //); btnresetFilter.Click+=new RoutedEventHandler((o,e)=>{ valueFilter.Text = ""; }); Loaded += (s,a)=>{ deviceList.CreateBinding(DeviceListControl.FirmwareCaptionProperty, Strings, x => x.firmware); deviceList.CreateBinding(DeviceListControl.LocationCaptionProperty, Strings, x => x.location); deviceList.CreateBinding(DeviceListControl.AddressCaptionProperty, Strings, x => x.address); viewModel.LoadDevices(); }; }
private async void Scan_Clicked(object sender, EventArgs e) { var options = new MobileBarcodeScanningOptions { PossibleFormats = new List <BarcodeFormat> { BarcodeFormat.QR_CODE } }; var scanQRCode = new ZXingScannerPage(options) { DefaultOverlayTopText = "Align the code within the frame", DefaultOverlayBottomText = string.Empty, DefaultOverlayShowFlashButton = true }; await Navigation.PushAsync(scanQRCode); scanQRCode.OnScanResult += (resultOfQrCode) => { Device.BeginInvokeOnMainThread(async() => { await Navigation.PopAsync(); //LabelText1.Text = resultOfQrCode.Text; // parse json here String ztdid = GetDeviceId(resultOfQrCode.Text); if (string.IsNullOrEmpty(ztdid)) { await DisplayAlert("Device Unique Id", "No Unique ID Found. Please scan the valid QR Code", "OK"); } else { DeviceListViewModel viewModel = new DeviceListViewModel(); viewModel.ZtdId = ztdid; await Navigation.PushAsync(new DevicePage(viewModel.Devices[0])); } }); }; }
public DeviceListView(DeviceListViewModel viewModel) { this.viewModel = viewModel; this.DataContext = viewModel; InitializeComponent(); //hideButton.Command = new DelegateCommand( // () => this.Visibility = Visibility.Collapsed, // () => true //); btnresetFilter.Click += new RoutedEventHandler((o, e) => { valueFilter.Text = ""; }); Loaded += (s, a) => { deviceList.CreateBinding(DeviceListControl.FirmwareCaptionProperty, Strings, x => x.firmware); deviceList.CreateBinding(DeviceListControl.LocationCaptionProperty, Strings, x => x.location); deviceList.CreateBinding(DeviceListControl.AddressCaptionProperty, Strings, x => x.address); viewModel.LoadDevices(); }; }
public SetDefaultDeviceActionViewModel(SetDefaultDeviceAction action) : base(action) { Device = new DeviceListViewModel(action, DeviceListViewModel.DeviceListKind.Recording); Attach(Device); }
public DeviceListPage() { InitializeComponent(); BindingContext = _viewModel = new DeviceListViewModel(); }
public MainPageViewModel(MainWindowViewModel ownerWindow) : base(ownerWindow) { DeviceListVM = new DeviceListViewModel(); _IsStreamRuning = false; IsTCPIPChecked = true; }
public DeviceListPage(DeviceListViewModel model) { InitializeComponent(); BindingContext = model; }