// public ActionResult StatisticsData() // { // var Em = serviceResource.GetAll(); // var A = unit.getRepository<Professeur>().GetAll(); // var B = unit.getRepository<Document>().GetAll(); // var query = (from i in B // from k in A // join l in GetAll() on new { i.DocumentCode, k.AdherantCode } equals new { l.DocumentCode, l.AdherantCode } // where l.Doc.Etat == Etat.Disponible && l.Date.Year == DateTime.Now.Year // select l).Count(); // ReportDocument rd = new ReportDocument(); // rd.Load(System.IO.Path.Combine(Server.MapPath("~/Reports"), "CrystalReport1.rpt")); // rd.SetDataSource(data_); // //rd.SetParameterValue("chemin", Server.MapPath("~/Content/Upload") + "/"); // Response.Buffer = false; // Response.ClearContent(); // Response.ClearHeaders(); // try // { // Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); // stream.Seek(0, SeekOrigin.Begin); // return File(stream, "application/pdf", "LetterofEmployement.pdf"); // } // catch (Exception ex) // { // throw; // } // } public ActionResult Index1() { List <ResourcesViewModel> lists = new List <ResourcesViewModel>(); foreach (var item in serviceResource.GetAll()) { ResourcesViewModel ResourcesViewModel = new ResourcesViewModel(); ResourcesViewModel.firstname = item.firstname; ResourcesViewModel.lastname = item.lastname; ResourcesViewModel.address = item.address; ResourcesViewModel.Email = item.Email; ResourcesViewModel.PhoneNumber = item.PhoneNumber; ResourcesViewModel.type = item.type; ResourcesViewModel.score = item.score; lists.Add(ResourcesViewModel); } try { // TODO: Add insert logic here return(View(lists)); } catch { return(View()); } }
private async Task RefreshObjectContainerTask(bool force) { await Client.RefreshObjectContainer(force); ResourcesViewModel.Synchronize(ObjectContainer.Instance.CurrentSelectedPlanet); TopBarViewModel.UpdatePlayerPlanets(ObjectContainer.Instance.PlayerPlanets); CheckHostileMissions(); }
public ResourcesView() { InitializeComponent(); DataContext = _viewModel = new ResourcesViewModel();; _viewModel.PropertyChanged += ViewModelOnPropertyChanged; Loaded += OnResourcesViewLoaded; }
public ResourcesView(DateTime date) { InitializeComponent(); DataContext = ViewModel = new ResourcesViewModel(date); ViewModel.PropertyChanged += ViewModelOnPropertyChanged; Owner = Application.Current.MainWindow; Loaded += OnResourcesViewLoaded; }
public ResourcesView() { InitializeComponent(); DataContext = _viewModel = new ResourcesViewModel(); ; _viewModel.PropertyChanged += ViewModelOnPropertyChanged; Loaded += OnResourcesViewLoaded; }
public IActionResult Index(DlsSubApplication dlsSubApplication) { var model = new ResourcesViewModel( dlsSubApplication, SupportPage.Resources, configuration.GetCurrentSystemBaseUrl(), resourcesService.GetAllResources() ); return(View("Index", model)); }
// GET: Resources/Delete/5 public ActionResult Delete(int id) { ResourcesViewModel user = new ResourcesViewModel(); Resource resource = new Resource(); resource = serviceResources.GetById(id); user.Id = resource.Id; user.firstname = resource.firstname; user.lastname = resource.lastname; user.Email = resource.Email; return(View(user)); }
// GET: Resources/Edit/5 public ActionResult Edit(int id) { ResourcesViewModel vm = new ResourcesViewModel(); Resource r = serviceResources.GetById(id); vm.Id = r.Id; vm.address = r.address; vm.availibilities = r.availibilities; vm.businessSector = r.businessSector; vm.CV = r.CV; return(View(vm)); }
public void Ctor_AssignsValues() { // Arrange var resources = _fixture.Create <Resource[]>(); var url = _fixture.Create <Url>(); // Act var vm = new ResourcesViewModel(resources, url); // Assert Assert.Equal(resources, vm.ResourcesList); Assert.Equal(url, vm.Url); }
//// GET: Resources Kids public ActionResult Kids(int?id) { ResourcesViewModel viewModel = new ResourcesViewModel(); viewModel.Init(3, _categoryRepository, _resourcesRepository); ViewBag.Title = "Kids"; if (id != null) { ViewBag.CategoryId = id; } return(View(viewModel)); }
public IActionResult Index() { var resources = _reserveBotContext.Resources.ToList(); var model = new ResourcesViewModel { Resources = new List <ResourceViewModel>() }; foreach (var resourceEntity in resources) { var resourceViewModel = new ResourceViewModel(); resourceViewModel.Id = resourceEntity.Id; resourceViewModel.Name = resourceEntity.Name; resourceViewModel.ResourceType = resourceEntity.ResourceType.ToString(); resourceViewModel.Team = resourceEntity.Team?.Name; model.Resources.Add(resourceViewModel); } return(View(model)); }
// Methods public ActionResult <ResourcesViewModel> Index() { // ResourcesViewModel var viewModel = new ResourcesViewModel(); { // BaseDirectory var baseDirectory = AppContext.BaseDirectory; if (Directory.Exists(baseDirectory) == false) { throw new InvalidOperationException("baseDirectory=null"); } // EntryAssembly var entryAssembly = Assembly.GetEntryAssembly(); if (entryAssembly == null) { throw new InvalidOperationException($"{nameof(entryAssembly)}=null"); } // ModuleAssembly var moduleAssembly = Assembly.LoadFrom(Path.Combine(baseDirectory, $"{entryAssembly.GetName().Name}.Module.dll")); if (moduleAssembly == null) { throw new InvalidOperationException($"{nameof(moduleAssembly)}=null"); } { // ModuleResources viewModel.ModuleResources = moduleAssembly.GetManifestResourceNames().ToList(); // ModuleResourceFiles var moduleResourceFiles = new List <string>(); this.FillResourceFiles(new ManifestEmbeddedFileProvider(moduleAssembly), @"\", ref moduleResourceFiles); viewModel.ModuleResourceFiles = moduleResourceFiles; } } // Return return(viewModel); }
public MainWindowViewModel(OGameHttpClient client) : base(client) { ResourcesViewModel = new ResourcesViewModel(client); TopBarViewModel = new TopBarViewModel(ResourcesViewModel); GalaxyViewModel = new GalaxyViewModel(client); Observable.Interval(TimeSpan.FromMinutes(5)) .SubscribeOnDispatcher() .DelayTask(() => TimeSpan.FromMinutes(Random.Next(10, 20))) .Select(i => SafeHttpTask(() => RefreshObjectContainerTask(false))) .Subscribe(); Observable.Interval(TimeSpan.FromMinutes(1)) .SubscribeOnDispatcher() .Where(i => WorkerQueueActionRunner.ExecutionQueue.Any()) .Subscribe(token => { WorkerQueueActionRunner.CheckQueue(); }); Init(); }
public IActionResult Index() { _logger.LogTrace("HomeController.Index entered."); try { var resourcesInGroup = _resourcesRepo.GetAllAsync().Result; var resourcesViewModel = new ResourcesViewModel { SubscriptionId = _frontendSettings.ResourcesConfig.SubscriptionId, ResourceGroupName = _frontendSettings.ResourcesConfig.ResourceGroupName, ResourcesInGroup = resourcesInGroup }; _logger.LogInformation($"Retrieved #{resourcesInGroup.Count} from {_frontendSettings.ResourcesConfig.ResourceGroupName} in {_frontendSettings.ResourcesConfig.SubscriptionId}."); return(View(resourcesViewModel)); } finally { _logger.LogTrace("HomeController.Index completed."); } }
public ActionResult ExportReport() { List <ResourcesViewModel> lists = new List <ResourcesViewModel>(); foreach (var item in serviceResource.GetAll()) { ResourcesViewModel ResourcesViewModel = new ResourcesViewModel(); ResourcesViewModel.firstname = item.firstname; ResourcesViewModel.lastname = item.lastname; ResourcesViewModel.address = item.address; ResourcesViewModel.Email = item.Email; ResourcesViewModel.PhoneNumber = item.PhoneNumber; ResourcesViewModel.type = item.type; ResourcesViewModel.score = item.score; lists.Add(ResourcesViewModel); } ReportDocument rd = new ReportDocument(); rd.Load(Path.Combine(Server.MapPath("~/Reports"), "EmployeevsFreelancer.rpt")); rd.SetDataSource(lists); //rd.SetDataSource("Rania"); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); try { Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "EmployeevsFreelancer.pdf")); } catch (Exception ex) { throw; //return View("IndexA","Offer"); } }
// GET: AppointmentResources/Edit/5 public ActionResult Edit(int?id) { if (!caSession.AuthoriseSession()) { return(Redirect((string)Session["ErrorUrl"])); } // get properties of current tenant var tenant = caCurrent.CurrentTenant(); // get properties of user caUser user = caCurrent.CurrentUser(); var wareh = _activityServices.GetAllPermittedWarehousesForUser(user.UserId, user.TenantId, user.SuperUser == true, false); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ResourcesViewModel appointmentResources = Mapper.Map(_employeeServices.GetAppointmentResourceById(id.Value), new ResourcesViewModel()); if (appointmentResources == null) { return(HttpNotFound()); } var jTypes = LookupServices.GetAllJobTypes(CurrentTenantId).Select(m => new { m.JobTypeId, m.Name }).ToList(); ViewBag.JobTypes = new MultiSelectList(jTypes, "JobTypeId", "Name", _employeeServices.GetResourceJobTypeIds(appointmentResources.ResourceId)); ViewBag.RolesList1 = new SelectList(_rolesServices.GetAllRoles(tenant.TenantId), "Id", "RoleName", _rolesServices.GetAllRolesByResource(appointmentResources.ResourceId)); ViewBag.GroupsList1 = new SelectList(_groupsServices.GetAllGroups(tenant.TenantId), "Id", "GroupName", _groupsServices.GetResourceGroupIds(appointmentResources.ResourceId)); ViewBag.Countries = new SelectList(LookupServices.GetAllGlobalCountries(), "CountryID", "CountryName", appointmentResources.GlobalCountry?.CountryID); ViewBag.TenantLocations = new MultiSelectList(_tenantLocationsServices.GetAllTenantLocations(tenant.TenantId).Where(x => wareh.Any(a => a.WId == x.WarehouseId)), "WarehouseId", "WarehouseName", _employeeShiftsStoresServices.GetEmployeeShifts_StoresByEmployeeId(appointmentResources.ResourceId).Select(p => p.WarehouseId)); ViewBag.Users = new SelectList(_userService.GetAllAuthUsers(CurrentTenantId), "UserId", "UserName", appointmentResources?.AuthUserId); return(View(appointmentResources)); }
public ActionResult Resources() { var userId = User != null ? User.Identity.GetUserId() : string.Empty; var res = this.playerService.GetPlayerResources(userId); var hourlyRes = this.playerService.GetHourlyResourceIncome(userId); var resVM = new ResourcesViewModel { Energy = res.Energy, Crystal = res.Crystal, Metal = res.Metal, EnergyPerHour = hourlyRes[0], CrystalPerHour = hourlyRes[1], MetalPerHour = hourlyRes[2] }; return View("_Resources", resVM); }
public ActionResult Create(ResourcesViewModel appointmentResources, List <int> JobTypeIds, List <int> RolesList1, List <int> GroupsList1) { if (!caSession.AuthoriseSession()) { return(Redirect((string)Session["ErrorUrl"])); } // get properties of current tenant var tenant = caCurrent.CurrentTenant(); // get properties of user caUser user = caCurrent.CurrentUser(); var wareh = _activityServices.GetAllPermittedWarehousesForUser(user.UserId, user.TenantId, user.SuperUser == true, false); appointmentResources.TenantId = CurrentTenantId; if (ModelState.IsValid) { //insert contactnumber int contacNumbersId = _contactNumbersServices.Insert(Mapper.Map <ContactNumbers>(appointmentResources.ContactNumbers)); appointmentResources.ContactNumbersId = contacNumbersId; //insert address int addressId = _addressServices.Insert(Mapper.Map <Address>(appointmentResources.Address)); appointmentResources.AddressId = addressId; //insert employee appointmentResources.CreatedBy = user.UserId; appointmentResources.UpdatedBy = user.UserId; appointmentResources.DateCreated = DateTime.UtcNow; appointmentResources.DateUpdated = DateTime.UtcNow; appointmentResources.TenantId = tenant.TenantId; int employeeId = _employeeServices.InsertEmployee(Mapper.Map <Resources>(appointmentResources)); appointmentResources.ResourceId = employeeId; //insert employeeShifts_Store if (appointmentResources.StoresList != null) { foreach (var item in appointmentResources.StoresList) { var insert = new EmployeeShifts_Stores() { ResourceId = employeeId, WarehouseId = item, }; _employeeShiftsStoresServices.Insert(insert); } } //insert employeeRoles if (RolesList1 != null) { foreach (var item in RolesList1) { if (item != 0) { var insert = new EmployeeRoles() { ResourceId = employeeId, RolesId = item, TenantId = tenant.TenantId, DateCreated = DateTime.UtcNow, DateUpdated = DateTime.UtcNow, CreatedBy = user.UserId, UpdatedBy = user.UserId }; _employeeRolesServices.Insert(insert); } } } //insert employeeGroups if (GroupsList1 != null) { foreach (var item in GroupsList1) { if (item != 0) { var insert = new EmployeeGroups() { ResourceId = employeeId, GroupsId = item, TenantId = tenant.TenantId, DateCreated = DateTime.UtcNow, DateUpdated = DateTime.UtcNow, CreatedBy = user.UserId, UpdatedBy = user.UserId }; _employeeGroupsServices.Insert(insert); } } } // insert JobType Ids _employeeServices.AddResourceJobTypes(Mapper.Map <Resources>(appointmentResources), JobTypeIds); ViewBag.Success = $"Successfully Added"; return(RedirectToAction("Index")); } // viewbag data var jTypes = LookupServices.GetAllJobTypes(CurrentTenantId).Select(m => new { m.JobTypeId, m.Name }).ToList(); ViewBag.JobTypes = new MultiSelectList(jTypes, "JobTypeId", "Name"); ViewBag.RolesList1 = new SelectList(_rolesServices.GetAllRoles(tenant.TenantId), "Id", "RoleName"); ViewBag.GroupsList1 = new SelectList(_groupsServices.GetAllGroups(tenant.TenantId), "Id", "GroupName"); ViewBag.Countries = new SelectList(LookupServices.GetAllGlobalCountries(), "CountryID", "CountryName"); ViewBag.TenantLocations = new MultiSelectList(_tenantLocationsServices.GetAllTenantLocations(tenant.TenantId).Where(x => wareh.Any(a => a.WId == x.WarehouseId)), "WarehouseId", "WarehouseName"); ViewBag.Users = new SelectList(_userService.GetAllAuthUsers(CurrentTenantId), "UserId", "UserName"); ViewBag.Warning = $"There is some problem with entereis, please check and try to save again"; return(View(appointmentResources)); }
public ActionResult Edit(ResourcesViewModel appointmentResources, List <int> JobTypeIds, List <int> RolesList1, List <int> GroupsList1) { // get properties of current tenant var tenant = caCurrent.CurrentTenant(); // get properties of user caUser user = caCurrent.CurrentUser(); var wareh = _activityServices.GetAllPermittedWarehousesForUser(user.UserId, user.TenantId, user.SuperUser == true, false); if (ModelState.IsValid) { appointmentResources.TenantId = CurrentTenantId; //update Resources newEmployee = _employeeServices.GetByEmployeeId(appointmentResources.ResourceId); newEmployee.HolidayEntitlement = appointmentResources.HolidayEntitlement; newEmployee.HourlyRate = appointmentResources.HourlyRate; newEmployee.PersonTitle = appointmentResources.PersonTitle; newEmployee.FirstName = appointmentResources.FirstName; newEmployee.MiddleName = appointmentResources.MiddleName; newEmployee.SurName = appointmentResources.SurName; newEmployee.LikeToBeKnownAs = appointmentResources.LikeToBeKnownAs; newEmployee.Gender = appointmentResources.Gender; newEmployee.Married = appointmentResources.Married; newEmployee.Nationality = appointmentResources.Nationality; newEmployee.Color = appointmentResources.Color; newEmployee.IsActive = appointmentResources.IsActive; newEmployee.InternalStaff = appointmentResources.InternalStaff; newEmployee.Nationality = appointmentResources.Nationality; newEmployee.PayrollEmployeeNo = appointmentResources.PayrollEmployeeNo; newEmployee.AuthUserId = appointmentResources.AuthUserId; newEmployee.JobStartDate = appointmentResources.JobStartDate; // update address if (newEmployee.Address == null) { Address newAddress = new Address(); newAddress.AddressLine1 = appointmentResources.Address.AddressLine1; newAddress.AddressLine2 = appointmentResources.Address.AddressLine2; newAddress.AddressLine3 = appointmentResources.Address.AddressLine3; newAddress.CountryID = appointmentResources.Address.CountryID; newAddress.County = appointmentResources.Address.County; newAddress.HouseNumber = appointmentResources.Address.HouseNumber; newAddress.PostCode = appointmentResources.Address.PostCode; newAddress.Town = appointmentResources.Address.Town; int addressId = _addressServices.Insert(Mapper.Map <Address>(appointmentResources.Address)); newEmployee.AddressId = addressId; } else { newEmployee.Address.AddressLine1 = appointmentResources.Address.AddressLine1; newEmployee.Address.AddressLine2 = appointmentResources.Address.AddressLine2; newEmployee.Address.AddressLine3 = appointmentResources.Address.AddressLine3; newEmployee.Address.CountryID = appointmentResources.Address.CountryID; newEmployee.Address.County = appointmentResources.Address.County; newEmployee.Address.HouseNumber = appointmentResources.Address.HouseNumber; newEmployee.Address.PostCode = appointmentResources.Address.PostCode; newEmployee.Address.Town = appointmentResources.Address.Town; } if (newEmployee.ContactNumbers == null) { //insert contactnumber int contacNumbersId = _contactNumbersServices.Insert(Mapper.Map <ContactNumbers>(appointmentResources.ContactNumbers)); newEmployee.ContactNumbersId = contacNumbersId; } else { // update contacts newEmployee.ContactNumbers.HomeNumber = appointmentResources.ContactNumbers.HomeNumber; newEmployee.ContactNumbers.MobileNumber = appointmentResources.ContactNumbers.MobileNumber; newEmployee.ContactNumbers.WorkNumber = appointmentResources.ContactNumbers.WorkNumber; newEmployee.ContactNumbers.Fax = appointmentResources.ContactNumbers.Fax; newEmployee.ContactNumbers.EmailAddress = appointmentResources.ContactNumbers.EmailAddress; } newEmployee.UpdatedBy = user.UserId; newEmployee.DateUpdated = DateTime.UtcNow; _employeeServices.UpdateEmployee(newEmployee); //delete first EmployeeShifts_Store _employeeShiftsStoresServices.DeleteEmployeeShiftsStoresByEmployeeId(appointmentResources.ResourceId); //update EmployeeShifts_Store if (appointmentResources.StoresList != null) { foreach (var item in appointmentResources.StoresList.ToList()) { _employeeShiftsStoresServices.UpdateEmployeeShifts_StoresByEmployeeId(appointmentResources.ResourceId, item); } } //delete first EmployeeRoles _employeeRolesServices.DeleteEmployeeRolesByEmployeeId(appointmentResources.ResourceId); //update EmployeeRoles if (RolesList1 != null) { foreach (var item in RolesList1) { if (item != 0) //0=Select a Role { EmployeeRoles newRole = new EmployeeRoles { RolesId = item, ResourceId = appointmentResources.ResourceId, TenantId = tenant.TenantId, CreatedBy = user.UserId, UpdatedBy = user.UserId, DateCreated = DateTime.UtcNow, DateUpdated = DateTime.UtcNow, }; _employeeRolesServices.Insert(newRole); } } } //delete first EmployeeGroups _employeeGroupsServices.DeleteEmployeeGroupsByEmployeeId(appointmentResources.ResourceId); //update EmployeeGroups if (GroupsList1 != null) { foreach (var item in GroupsList1) { if (item != 0) //0=Select a Group { EmployeeGroups newGroup = new EmployeeGroups() { GroupsId = item, ResourceId = appointmentResources.ResourceId, TenantId = tenant.TenantId, CreatedBy = user.UserId, UpdatedBy = user.UserId, DateCreated = DateTime.UtcNow, DateUpdated = DateTime.UtcNow }; _employeeGroupsServices.Insert(newGroup); } } } _employeeServices.UpdateResourceJobTypes(Mapper.Map <Resources>(appointmentResources), JobTypeIds); return(RedirectToAction("Index")); } var jTypes = LookupServices.GetAllJobTypes(CurrentTenantId).Select(m => new { m.JobTypeId, m.Name }).ToList(); ViewBag.JobTypes = new MultiSelectList(jTypes, "JobTypeId", "Name", _employeeServices.GetResourceJobTypeIds(appointmentResources.ResourceId)); ViewBag.RolesList1 = new SelectList(_rolesServices.GetAllRoles(tenant.TenantId), "Id", "RoleName", _rolesServices.GetAllRolesByResource(appointmentResources.ResourceId)); ViewBag.GroupsList1 = new SelectList(_groupsServices.GetAllGroups(tenant.TenantId), "Id", "GroupName", _groupsServices.GetResourceGroupIds(appointmentResources.ResourceId)); ViewBag.Countries = new SelectList(LookupServices.GetAllGlobalCountries(), "CountryID", "CountryName", appointmentResources.GlobalCountry.CountryID); ViewBag.TenantLocations = new MultiSelectList(_tenantLocationsServices.GetAllTenantLocations(tenant.TenantId).Where(x => wareh.Any(a => a.WId == x.WarehouseId)), "WarehouseId", "WarehouseName", _employeeShiftsStoresServices.GetEmployeeShifts_StoresByEmployeeId(appointmentResources.ResourceId).Select(p => p.WarehouseId)); return(View(appointmentResources)); }