public async Task <ObservableCollection <ServicesViewModel> > GetServices(string key) { var activeWindowsServices = new ObservableCollection <ServicesViewModel>(); var allServices = await _webservice.GetServerOtherParamsAsync("Windows Services installed", key); var value = allServices.Value; var deserializeAll = Newtonsoft.Json.JsonConvert.DeserializeObject <List <WindowsServicesValue> >(value); var configuration = _webservice.GetServicesConfig(key); var deserializeConf = Newtonsoft.Json.JsonConvert.DeserializeObject <List <CheckedServices> >(configuration); var color = Color.FromRgb(99, 255, 74); foreach (var d in deserializeAll) { foreach (var c in deserializeConf) { if (d.ServiceName == c.ServiceName) { var status = ServicesValidator.validate(d); if (status == ServicesValidator.outcome.NotOK) { color = Color.FromRgb(192, 0, 2); } else { color = Color.FromRgb(99, 255, 74); } var service = new ServicesViewModel(d.ServiceName, d.DisplayName, d.ServiceType, d.Status, color); activeWindowsServices.Add(service); } } } return(activeWindowsServices); }
// GET: Services/Details/5 public async Task <IActionResult> Details(int?id) { var user = await _userManager.GetUserAsync(User); if (user == null) { return(RedirectToAction(nameof(AccountController.Login), "Account")); // throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } if (id == null) { return(NotFound()); } var model = new ServicesViewModel(); model.Notificaciones = _empleadosData.GetNotifications(); model.ServicesData = await _context.ServicesData .SingleOrDefaultAsync(m => m.ID == id); model.Nombre = model.ServicesData.Nombre; model.Descripcion = model.ServicesData.Descripcion; model.Icon = model.ServicesData.icon; if (model.ServicesData == null) { return(NotFound()); } return(View(model)); }
public async Task <IActionResult> Put(int id, [FromBody] ServicesViewModel services) { if (ModelState.IsValid) { try { Services _services = Mapper.Map <Services>(services); Departements departements = _unitOfWork.Departements.GetSingleOrDefault(e => e.Id == services.departementsId); _services.Departements = departements; // _services.Name = _services.Name.ToUpper(); _unitOfWork.Services.Update(_services); await _unitOfWork.SaveChangesAsync(); return(Ok("OK")); } catch (Exception ex) { return(BadRequest(ex.Data)); } } else { return(BadRequest(ModelState)); } }
[SetToSession("SortState")] //Фильтр действий для сохранение в сессию состояния сортировки public IActionResult Index(SortState sortOrder) { // Считывание данных из сессии var sessionService = HttpContext.Session.Get("Service"); var sessionSortState = HttpContext.Session.Get("SortState"); if (sessionService != null) { _service = Transformations.DictionaryToObject <ServiceViewModel>(sessionService); } if ((sessionSortState != null)) { if ((sessionSortState.Count > 0) & (sortOrder == SortState.No)) { sortOrder = (SortState)Enum.Parse(typeof(SortState), sessionSortState["sortOrder"]); } } // Сортировка и фильтрация данных IQueryable <Service> hotelContext = _context.Services; hotelContext = Sort_Search(hotelContext, sortOrder, _service.RoomType ?? "", _service.ClientFio ?? ""); // Формирование модели для передачи представлению _service.SortViewModel = new SortViewModel(sortOrder); ServicesViewModel services = new ServicesViewModel { Services = hotelContext, ServiceViewModel = _service }; return(View(services)); }
// GET: Services public async Task <IActionResult> Index() { var user = await _userManager.GetUserAsync(User); if (user == null) { return(RedirectToAction(nameof(AccountController.Login), "Account")); // throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } else { try { ViewBag.sms = TempData["sms"].ToString(); } catch { } var model = new ServicesViewModel(); model.Notificaciones = _empleadosData.GetNotifications(); model.Servicios = _empleadosData.GetAllServices(); return(View(model)); } }
public Home() { _cloudServicesRepository = Container.Get <ICloudServicesRepository>(); _viewModel = new ServicesViewModel(); DataContext = _viewModel; InitializeComponent(); }
[SetToSession("Service")] //Фильтр действий для сохранение в сессию параметров отбора public IActionResult Index(ServiceViewModel service) { // Считывание данных из сессии var sessionSortState = HttpContext.Session.Get("SortState"); var sortOrder = new SortState(); if (sessionSortState.Count > 0) { sortOrder = (SortState)Enum.Parse(typeof(SortState), sessionSortState["sortOrder"]); } // Сортировка и фильтрация данных IQueryable <Service> hotelContext = _context.Services; hotelContext = Sort_Search(hotelContext, sortOrder, service.RoomType ?? "", service.ClientFio ?? ""); // Формирование модели для передачи представлению service.SortViewModel = new SortViewModel(sortOrder); ServicesViewModel services = new ServicesViewModel { Services = hotelContext, ServiceViewModel = service }; return(View(services)); }
public ActionResult Services() { ServicesViewModel viewModel = new ServicesViewModel(); viewModel.pagesData = getData.getPageInfo(Request.Path); return(View(viewModel)); }
// GET: Services/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var service = await _context.Services.FindAsync(id); if (service == null) { return(NotFound()); } ServicesViewModel viewModel = new ServicesViewModel { Id = service.Id, Title = service.Title, Image = service.Image, Description = service.Description, Verified = service.Verified, Price = service.Price, WorkShopId = service.WorkShopId, }; return(PartialView(viewModel)); }
public JsonServices AnimalsServices() { JsonServices jsonServices = new JsonServices(); List <ServicesViewModel> AnimalsServicesOBJ = new List <ServicesViewModel>(); try { var animal = _place.ServicesTypeAnimal(); foreach (var item in animal) { ServicesViewModel AnimalsObj = new ServicesViewModel(); //Places AnimalsObj.Name = item.Name; AnimalsObj.Phone = item.PhoneNumber; //link AnimalsObj.Title = _link.FindById(item.Id).Title; AnimalsObj.Description = _link.FindById(item.Id).Description; AnimalsObj.Icon = _link.FindById(item.Id).Icon; //address AnimalsObj.LocationX = _address.FindById(item.Id).LocationX; AnimalsObj.LocationX = _address.FindById(item.Id).LocationY; AnimalsObj.LocationX = _address.FindById(item.Id).LocationR; AnimalsServicesOBJ.Add(AnimalsObj); } jsonServices.Result = AnimalsServicesOBJ; return(jsonServices); } catch (Exception ex) { _ = ex.Message; return(jsonServices); } }
// GET: Services/Delete/5 public async Task <IActionResult> Delete(int?id) { if (id == null) { return(NotFound()); } var service = await _context.Services .Include(s => s.WorkShop) .FirstOrDefaultAsync(m => m.Id == id); ServicesViewModel viewModel = new ServicesViewModel { Id = service.Id, Title = service.Title, Image = service.Image, Description = service.Description, Verified = service.Verified, Price = service.Price, WorkShopId = service.WorkShopId, }; if (service == null) { return(NotFound()); } return(PartialView(viewModel)); }
public IActionResult Services() { var result = new ServicesViewModel(); foreach (var cryptoCode in _Options.ExternalServicesByCryptoCode.Keys) { int i = 0; foreach (var grpcService in _Options.ExternalServicesByCryptoCode.GetServices <ExternalLnd>(cryptoCode)) { result.LNDServices.Add(new ServicesViewModel.LNDServiceViewModel() { Crypto = cryptoCode, Type = grpcService.Type, Index = i++, }); } } foreach (var externalService in _Options.ExternalServices) { result.ExternalServices.Add(new ServicesViewModel.ExternalService() { Name = externalService.Key, Link = this.Request.GetRelativePath(externalService.Value) }); } if (_Options.SSHSettings != null) { result.ExternalServices.Add(new ServicesViewModel.ExternalService() { Name = "SSH", Link = this.Url.Action(nameof(SSHService)) }); } return(View(result)); }
// GET: Services public ActionResult Index() { string apiroot = "https://www.metabittrader.com/"; string coin = "BTX"; var iclient = new RestClient(); iclient.BaseUrl = new Uri(apiroot + coin + "/api/"); var req = new RestRequest("/peers", Method.GET); //req.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; }; IRestResponse <List <PeerInfo> > response = iclient.Execute <List <PeerInfo> >(req); var peers = response.Data; ViewBag.Peers = peers; var vm = new ServicesViewModel() { Services = new List <ForkService>() { new ForkService() { Coin = coin, Peers = peers.Select(p => new Peer() { IP = p.ip }).ToList() } } }; return(View(vm)); }
public List <ServicesViewModel> GetNodeList() { var list = new List <ServicesViewModel>(); try { var services = client.Agent.Services(); var checks = client.Agent.Checks().Result.Response; foreach (var item in services.Result.Response) { var svcID = item.Value.ID; if (item.Value.Service == "taskservice" && checks.ContainsKey("service:" + svcID)) { var service = new ServicesViewModel(); service.Node = checks["service:" + svcID].Node; service.ServiceId = svcID; service.ServiceName = item.Value.Service; service.ServiceAddress = $"http://{item.Value.Address}:{item.Value.Port}"; service.ServiceIP = $"{item.Value.Address}:{item.Value.Port}"; service.ServiceState = checks["service:" + svcID].Status.Status; list.Add(service); } } } catch (Exception ex) { Log.SysLog("Consul GetServicesList", ex); } return(list); }
public JsonServices ClearanceServices() { JsonServices jsonServices = new JsonServices(); List <ServicesViewModel> ClearanceServicesOBJ = new List <ServicesViewModel>(); try { var Cleaaance = _place.ServicesTypeClearance(); foreach (var item in Cleaaance) { ServicesViewModel ClearanceObj = new ServicesViewModel(); //Places ClearanceObj.Name = item.Name; ClearanceObj.Phone = item.PhoneNumber; //link ClearanceObj.Title = _link.FindById(item.Id).Title; ClearanceObj.Description = _link.FindById(item.Id).Description; ClearanceObj.Icon = _link.FindById(item.Id).Icon; //address ClearanceObj.LocationX = _address.FindById(item.Id).LocationX; ClearanceObj.LocationX = _address.FindById(item.Id).LocationY; ClearanceObj.LocationX = _address.FindById(item.Id).LocationR; ClearanceServicesOBJ.Add(ClearanceObj); } jsonServices.Result = ClearanceServicesOBJ; return(jsonServices); } catch (Exception ex) { _ = ex.Message; return(jsonServices); } }
public async Task <IActionResult> Services() { var result = new ServicesViewModel(); result.ExternalServices = _Options.ExternalServices.ToList(); foreach (var externalService in _Options.OtherExternalServices) { result.OtherExternalServices.Add(new ServicesViewModel.OtherExternalService() { Name = externalService.Key, Link = this.Request.GetAbsoluteUriNoPathBase(externalService.Value).AbsoluteUri }); } if (CanShowSSHService()) { result.OtherExternalServices.Add(new ServicesViewModel.OtherExternalService() { Name = "SSH", Link = this.Url.Action(nameof(SSHService)) }); } result.OtherExternalServices.Add(new ServicesViewModel.OtherExternalService() { Name = "Dynamic DNS", Link = this.Url.Action(nameof(DynamicDnsServices)) }); foreach (var torService in _torServices.Services) { if (torService.VirtualPort == 80) { result.TorHttpServices.Add(new ServicesViewModel.OtherExternalService() { Name = torService.Name, Link = $"http://{torService.OnionHost}" }); } else if (TryParseAsExternalService(torService, out var externalService)) { result.ExternalServices.Add(externalService); } else { result.TorOtherServices.Add(new ServicesViewModel.OtherExternalService() { Name = torService.Name, Link = $"{torService.OnionHost}:{torService.VirtualPort}" }); } } var storageSettings = await _SettingsRepository.GetSettingAsync <StorageSettings>(); result.ExternalStorageServices.Add(new ServicesViewModel.OtherExternalService() { Name = storageSettings == null ? "Not set" : storageSettings.Provider.ToString(), Link = Url.Action("Storage") }); return(View(result)); }
// GET: Services/Create public ActionResult Create() { var model = new ServicesViewModel(); // servicesRepository.GetServers(model); servicesRepository.GetApps(model); return(View(model)); }
public void Given_new_viewmodel_Message_should_not_be_null_or_empty() { // arrange and act var vm = new ServicesViewModel(); // assert Assert.IsFalse(string.IsNullOrEmpty(vm.Message)); }
public ServicesPage(IBLEDevice device) { InitializeComponent(); BindingContext = vm = new ServicesViewModel(device) { Navigation = Navigation }; }
public IActionResult Index() { var viewModel = new ServicesViewModel() { Services = _dataManager.Services.GetServices().ToList() }; return(View(viewModel)); }
public ServicesPage(Data.Model.CarService cs) { InitializeComponent(); BindingContext = model = new ServicesViewModel() { CarService = cs }; csModel = cs; }
public ActionResult ProductsAmdServices() { DBDal dal = new DBDal(); List <Service> objServices = dal.Services.ToList <Service>(); ServicesViewModel servicevm = new ServicesViewModel(); servicevm.service = new Service(); servicevm.services = objServices; return(View(servicevm)); }
public IActionResult Index(string id) { WebAtSolutionContext _webcontext = new WebAtSolutionContext(); ServicesViewModel model = new ServicesViewModel(); model.service = _webcontext.Service.SingleOrDefault(p => p.Id == id && p.RowStatus != 1); model.listService = _webcontext.Service .OrderByDescending(p => p.CreatedDate) .ToList(); return(View(model)); }
public ActionResult New() { var service = new Service(); ServicesViewModel model = new ServicesViewModel { Service = service, ServiceCategories = _categories.Get() }; return(View("ServicesForm", model)); }
// GET: Services public ActionResult Index() { ServicesViewModel model = new ServicesViewModel() { Service = db.Service.ToList(), Testimonials = db.Testimonials.ToList(), Cover = db.Covers.FirstOrDefault(c => c.Page == "Service").Photo }; return(View(model)); }
public static async Task <ServicesViewModel> GetDataServices(WebAtSolutionContext webContext) { ServicesViewModel model = new ServicesViewModel(); model.listService = webContext.Service .OrderByDescending(p => p.CreatedDate) .ToList();; model.listProj = webContext.Project.ToList(); model.listProjType = webContext.ProjectType.ToList(); return(model); }
public ActionResult Report(ServicesViewModel model, Boolean isFullReport) { if (ModelState.IsValid) { List <ServiceViewModel> Services = new List <ServiceViewModel>(); if (isFullReport) { Services = db.Appointments.ToList().Select(a => new AppointmentViewModels.ServiceViewModel() { Id = a.ID, ServiceType = a.service_type, ServiceName = a.service_name, ServiceDate = a.appoint_date, ServicePrice = a.service_price, SuppliesPrice = a.supplies_price, TotalPrice = a.service_price + a.supplies_price }).ToList(); return(new PdfActionResult("Report", Services)); } foreach (var item in model.SelectedServices) { var s = db.Appointments.ToList().Where(a => a.ID == item).Select(a => new AppointmentViewModels.ServiceViewModel() { Id = a.ID, ServiceType = a.service_type, ServiceName = a.service_name, ServiceDate = a.appoint_date, ServicePrice = a.service_price, SuppliesPrice = a.supplies_price, TotalPrice = a.service_price + a.supplies_price }).FirstOrDefault(); Services.Add(s); } return(new PdfActionResult("Report", Services)); } var services = db.Appointments.ToList().Select(a => new AppointmentViewModels.ServiceViewModel() { Id = a.ID, ServiceType = a.service_type, ServiceName = a.service_name, ServiceDate = a.appoint_date, ServicePrice = a.service_price, SuppliesPrice = a.supplies_price, TotalPrice = a.service_price + a.supplies_price }).ToList(); model.AvailableServices = services; return(View(model)); }
public ActionResult Services() { ServicesViewModel model = new ServicesViewModel(); model.ParentServices = db.Services.Where(x => x.IsDeleted != true && x.ParentId == null). ToList(); foreach (var parentServic in model.ParentServices) { model.ChildServices.Add(parentServic.Id, db.Services.Where(x => x.IsDeleted == false && x.ParentId == parentServic.Id).ToList()); } return(View(model)); }
private void View_Loaded(object sender, System.Windows.RoutedEventArgs e) { ServicesViewModel vm = (ServicesViewModel)DataContext; vm.BeforeRefresh += BeforeRefresh; vm.OnRefresh += OnRefresh; if (_isFirstLoad) { SetInitialGridWidth(); } _isFirstLoad = true; }
public IActionResult Index() { ServicesViewModel model = new ServicesViewModel { Breadcrumb = _context.Breadcrumbs.FirstOrDefault(), Promos = _context.Promos.Take(3).ToList(), Services = _context.Services.ToList(), Partners = _context.Partners.ToList() }; return(View(model)); }
public void Start() { IsRunning = true; config = new MenuItem { Name = "Services" }; config.Clicked += (e, s) => { try { svm = new ServicesViewModel {Plugin = this}; var element = FloatingHelpers.CreateFloatingElement("Services", new Point(600, 400), new Size(800, 600), svm); element.CanFullScreen = true; AppStateSettings.Instance.FloatingItems.AddFloatingElement(element); } catch (SystemException ex) { Logger.Log("ServicesPlugin", "Cannot start Services plugin", ex.Message, Logger.Level.Error, true); } }; AppState.MainMenuItems.Add(config); }