Applications

We found 10 examples in language CSharp for this search. You will see 42 fragments of code.

        public bool DataExists()
        {
            if (!(_dbContext.AcceptLevel.Any() && _dbContext.Applications.Any() &&
                _dbContext.AuthDate.Any() && _dbContext.Employee.Any() &&
                _dbContext.Phones.Any()))
            { return false; }
            else { return true; }
        }

        public IEnumerable<ApplicationsDto> GetAllDepartments()
        {
            List<ApplicationsDto> allDep = new List<ApplicationsDto>();
            foreach (ApplicationsEntity dep in _dbContext.Applications)
            {
                allDep.Add(GetDepById(dep.AppId));
            }
            return allDep;
        }

        public ApplicationsDto GetDepById(int id)
        {
            ApplicationsDto dto = new ApplicationsDto();
            dto = Mapper.Map<ApplicationsDto>(_dbContext.Applications.FirstOrDefault(t => t.AppId == id));
            if (dto == null)
            {
                throw new Exception($"There is no departments with id = {id}");
            }
            return dto;
        }

        public ApplicationsDto GetDepByName(string id)
        {
            ApplicationsDto dto = new ApplicationsDto();
            dto = Mapper.Map<ApplicationsDto>(_dbContext.Applications.FirstOrDefault(t => t.AppHeader == id));
            if (dto == null)
            {
                throw new Exception($"There is no departments with id = {id}");
            }
            return dto;
        }

        public void DeleteDep(string name)
        {
            ApplicationsEntity depEntity = _dbContext.Applications.FirstOrDefault(t => t.AppHeader == name);
            if (depEntity == null)
            {
                throw new Exception($"There is no dep with name = {depEntity.AppHeader}");
            }

            _dbContext.Applications.Remove(depEntity);
            _dbContext.SaveChanges();
        }


		private static IOrderedQueryable<Application> ByMethodOfTransit(IQueryable<Application> applications, bool desc, bool isFirst)
		{
			return Order(applications, desc, isFirst, a => a.Transit.MethodOfTransitId);
		}

		public IQueryable<Application> Order(IQueryable<Application> applications, IList<Order> orders)
		{
			if(orders == null || orders.Count == 0)
			{
				return applications;
			}

			var isFirst = true;

			foreach(var order in orders)
			{
				applications = Map[order.OrderType](applications, order.Desc, isFirst);

				isFirst = false;
			}

			return AdditionalOrdering((IOrderedQueryable<Application>)applications, orders);
		}

		private static IOrderedQueryable<Application> AdditionalOrdering(IOrderedQueryable<Application> applications,
			IEnumerable<Order> orders)
		{
			if(orders.All(x => x.OrderType != OrderType.Id))
			{
				applications = applications.ThenByDescending(x => x.Id);
			}

			return applications;
		}

		private static IOrderedQueryable<Application> ByAirWaybillBill(IQueryable<Application> applications, bool desc,
			bool isFirst)
		{
			var ordered = Order(applications, desc, isFirst, x => !x.AirWaybillId.HasValue);

			return desc
				? ordered.ThenByDescending(x => x.AirWaybill.CreationTimestamp)
				: ordered.ThenBy(x => x.AirWaybill.CreationTimestamp);
		}

		private static IOrderedQueryable<Application> ByClientNic(IQueryable<Application> applications, bool desc,
			bool isFirst)
		{
			return Order(applications, desc, isFirst, a => a.Client.Nic);
		}

		private static IOrderedQueryable<Application> ById(IQueryable<Application> applications, bool desc, bool isFirst)
		{
			return Order(applications, desc, isFirst, x => x.Id);
		}


        private void Add(WebSiteApplications applications)
        {
            _webSiteApplications[applications.VerticalId] = applications;
        }



        [Route("api/myapplications")]
        public IHttpActionResult GetMyApplications()
        {
            var applications = _applicationService.UserApplications();

            var response = Mapper.Map<IEnumerable<ApplicationsDataView>>(applications);

            return Ok(response);
        }

        [Route("api/incomingapplications")]
        public IHttpActionResult GetIncomingApplications(bool forwarded = false, bool? received = null, bool archived = false)
        {

            var applications = _applicationService.IncomingAppsApplications(forwarded, received, archived);

            var response = Mapper.Map<IEnumerable<ApplicationsDataView>>(applications);

            return Ok(response);
        }


        [Route("api/applicationstosign")]
        public IHttpActionResult GetApplicationsToSign(bool? signed = null)
        {

            var applications = _applicationService.ApplicationsToSign(signed);

            var response =   Mapper.Map<IEnumerable<ApplicationsToSignDataView>>(applications);

            return Ok(response);
        }

        [Route("api/applicationstoapprove")]
        public IHttpActionResult GetApplicationsForApproval(bool? signed = null, bool? approved = null, bool sendToHead =true)
        {

            var applications = _applicationService.ApplicationsToApprove(signed, approved, sendToHead);
            var response = Mapper.Map<IEnumerable<ApplicationsToSignDataView>>(applications);

            return Ok(response);
        }


        public async Task<Applications> Get(int id)
        {
            return await _dbContext.Applications.FindAsync(id);
        }

        public async Task<ApplicationsListResponse> Get(TableSortingWithFilterRequest request)
        {
            return new ApplicationsListResponse
            {
                Data = await _dbContext.Applications.ToListAsync(),
                Total = await _dbContext.Applications.CountAsync()
            };
        }

        public async Task<Applications> Post(Applications applications)
        {
            _dbContext.Applications.Add(applications);
            await _dbContext.SaveChangesAsync();
            return applications;
        }

        public async Task PutState(int id, StateEnum stateEnum)
        {
            var applications = await _dbContext.Applications.FindAsync(id);
            _dbContext.Applications.Attach(applications);
            applications.State = stateEnum;
            await _dbContext.SaveChangesAsync();
        }


        public List<Application> GetApplications()
        {
            return applications;
        }


        [HttpPost(nameof(GetList))]
        [Produces("application/json")]
        public async Task<ApplicationsListResponse> GetList([FromBody] TableSortingWithFilterRequest request)
        {
            return await _applicationsService.Get(request);
        }

        [HttpPost(nameof(GetListWithoutFilter))]
        [Produces("application/json")]
        public async Task<ApplicationsListResponse> GetListWithoutFilter([FromBody] TableSortingRequest request)
        {
            return await _applicationsService.Get(request);
        }

        [HttpGet("{id}")]
        [Produces("application/json")]
        public async Task<Applications> Get(int id)
        {
            return await _applicationsService.Get(id);
        }

        [HttpPost(nameof(Post))]
        [Produces("application/json")]
        public async Task<Applications> Post([FromBody] Applications applications)
        {
            return await _applicationsService.Post(applications);
        }

        [HttpPut("{id}")]
        public async Task PutState(int id, StateEnum stateEnum)
        {
            //if (id != applications.Id)
            //{
            //    throw new ApiBadRequest();
            //}

            await _applicationsService.PutState(id, stateEnum);
        }

        [HttpDelete("{id}")]
        public async Task Delete(int id)
        {
            await _applicationsService.Delete(id);
        }


        // GET: Applicant_Job_Applications
        public ActionResult Index()
        {
            var applicant_Job_Applications = db.Applicant_Job_Applications.Include(a => a.Applicant_Profiles).Include(a => a.Company_Jobs);
            return View(applicant_Job_Applications.ToList());
        }

        // GET: Applicant_Job_Applications/Details/5
        public ActionResult Details(Guid? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Applicant_Job_Applications applicant_Job_Applications = db.Applicant_Job_Applications.Find(id);
            if (applicant_Job_Applications == null)
            {
                return HttpNotFound();
            }
            return View(applicant_Job_Applications);
        }

        // GET: Applicant_Job_Applications/Create
        public ActionResult Create()
        {
            ViewBag.Applicant = new SelectList(db.Applicant_Profiles, "Id", "Currency");
            ViewBag.Job = new SelectList(db.Company_Jobs, "Id", "Id");
            return View();
        }

        // POST: Applicant_Job_Applications/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "Id,Applicant,Job,Application_Date,Time_Stamp")] Applicant_Job_Applications applicant_Job_Applications)
        {
            if (ModelState.IsValid)
            {
                applicant_Job_Applications.Id = Guid.NewGuid();
                db.Applicant_Job_Applications.Add(applicant_Job_Applications);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.Applicant = new SelectList(db.Applicant_Profiles, "Id", "Currency", applicant_Job_Applications.Applicant);
            ViewBag.Job = new SelectList(db.Company_Jobs, "Id", "Id", applicant_Job_Applications.Job);
            return View(applicant_Job_Applications);
        }

        // GET: Applicant_Job_Applications/Edit/5
        public ActionResult Edit(Guid? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Applicant_Job_Applications applicant_Job_Applications = db.Applicant_Job_Applications.Find(id);
            if (applicant_Job_Applications == null)
            {
                return HttpNotFound();
            }
            ViewBag.Applicant = new SelectList(db.Applicant_Profiles, "Id", "Currency", applicant_Job_Applications.Applicant);
            ViewBag.Job = new SelectList(db.Company_Jobs, "Id", "Id", applicant_Job_Applications.Job);
            return View(applicant_Job_Applications);
        }

        // POST: Applicant_Job_Applications/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "Id,Applicant,Job,Application_Date,Time_Stamp")] Applicant_Job_Applications applicant_Job_Applications)
        {
            if (ModelState.IsValid)
            {
                db.Entry(applicant_Job_Applications).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            ViewBag.Applicant = new SelectList(db.Applicant_Profiles, "Id", "Currency", applicant_Job_Applications.Applicant);
            ViewBag.Job = new SelectList(db.Company_Jobs, "Id", "Id", applicant_Job_Applications.Job);
            return View(applicant_Job_Applications);
        }


        // GET: Applicant_Job_Applications
        public ActionResult Index()
        {
            var applicant_Job_Applications = db.Applicant_Job_Applications.Include(a => a.Applicant_Profiles).Include(a => a.Company_Jobs);
            return View(applicant_Job_Applications.ToList());
        }

        // GET: Applicant_Job_Applications/Details/5
        public ActionResult Details(Guid? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Applicant_Job_Applications applicant_Job_Applications = db.Applicant_Job_Applications.Find(id);
            if (applicant_Job_Applications == null)
            {
                return HttpNotFound();
            }
            return View(applicant_Job_Applications);
        }

        // GET: Applicant_Job_Applications/Create
        public ActionResult Create()
        {
            ViewBag.Applicant = new SelectList(db.Applicant_Profiles, "Id", "Currency");
            ViewBag.Job = new SelectList(db.Company_Jobs, "Id", "Id");
            return View();
        }

        // POST: Applicant_Job_Applications/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "Id,Applicant,Job,Application_Date,Time_Stamp")] Applicant_Job_Applications applicant_Job_Applications)
        {
            if (ModelState.IsValid)
            {
                applicant_Job_Applications.Id = Guid.NewGuid();
                db.Applicant_Job_Applications.Add(applicant_Job_Applications);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.Applicant = new SelectList(db.Applicant_Profiles, "Id", "Currency", applicant_Job_Applications.Applicant);
            ViewBag.Job = new SelectList(db.Company_Jobs, "Id", "Id", applicant_Job_Applications.Job);
            return View(applicant_Job_Applications);
        }

        // GET: Applicant_Job_Applications/Edit/5
        public ActionResult Edit(Guid? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Applicant_Job_Applications applicant_Job_Applications = db.Applicant_Job_Applications.Find(id);
            if (applicant_Job_Applications == null)
            {
                return HttpNotFound();
            }
            ViewBag.Applicant = new SelectList(db.Applicant_Profiles, "Id", "Currency", applicant_Job_Applications.Applicant);
            ViewBag.Job = new SelectList(db.Company_Jobs, "Id", "Id", applicant_Job_Applications.Job);
            return View(applicant_Job_Applications);
        }

        // POST: Applicant_Job_Applications/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "Id,Applicant,Job,Application_Date,Time_Stamp")] Applicant_Job_Applications applicant_Job_Applications)
        {
            if (ModelState.IsValid)
            {
                db.Entry(applicant_Job_Applications).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            ViewBag.Applicant = new SelectList(db.Applicant_Profiles, "Id", "Currency", applicant_Job_Applications.Applicant);
            ViewBag.Job = new SelectList(db.Company_Jobs, "Id", "Id", applicant_Job_Applications.Job);
            return View(applicant_Job_Applications);
        }


        [TestMethod]
        public void TestEmptyPositions()
        {
            var applicantId = Guid.NewGuid();

            // Null.

            Assert.AreEqual(0, _applicationsQuery.GetApplications<InternalApplication>(applicantId, null, true).Count);

            // Empty.

            Assert.AreEqual(0, _applicationsQuery.GetApplications<InternalApplication>(applicantId, new Guid[0], true).Count);
        }

        [TestMethod]
        public void TestErrors()
        {
            var applicantId = Guid.NewGuid();
            var positionId = Guid.NewGuid();

            var application = new InternalApplication
            {
                PositionId = positionId,
                ApplicantId = applicantId,
                CoverLetterText = new string('a', 2000),
            };
            AssertException.Thrown<ValidationErrorsException>(() => _applicationsCommand.CreateApplication(application));

            application.CoverLetterText = new string('a', 900);
            _applicationsCommand.CreateApplication(application);

            AssertApplication(application, _applicationsQuery.GetApplication<InternalApplication>(application.Id, true));

            var applications = _applicationsQuery.GetApplications<InternalApplication>(applicantId, true);
            Assert.AreEqual(1, applications.Count);
            AssertApplication(application, applications[0]);

            applications = _applicationsQuery.GetApplications<InternalApplication>(new[] { application.Id }, true);
            Assert.AreEqual(1, applications.Count);
            AssertApplication(application, applications[0]);

            applications = _applicationsQuery.GetApplications<InternalApplication>(applicantId, new[] { positionId }, true);
            Assert.AreEqual(1, applications.Count);
            AssertApplication(application, applications[0]);

            applications = _applicationsQuery.GetApplicationsByPositionId<InternalApplication>(positionId, true);
            Assert.AreEqual(1, applications.Count);
            AssertApplication(application, applications[0]);
        }

        private static void AssertApplication(InternalApplication expectedApplication, InternalApplication application)
        {
            Assert.AreEqual(expectedApplication.Id, application.Id);
            Assert.AreEqual(expectedApplication.PositionId, application.PositionId);
            Assert.AreEqual(expectedApplication.ApplicantId, application.ApplicantId);
            Assert.AreEqual(expectedApplication.ApplicantEmail, application.ApplicantEmail);
            Assert.AreEqual(expectedApplication.CoverLetterText, application.CoverLetterText);
            Assert.AreEqual(expectedApplication.IsPending, application.IsPending);
            Assert.AreEqual(expectedApplication.IsPositionFeatured, application.IsPositionFeatured);
            Assert.AreEqual(expectedApplication.ResumeFileId, application.ResumeFileId);
            Assert.AreEqual(expectedApplication.ResumeId, application.ResumeId);
        }

Steeltoe.Discovery.Eureka.AppInfo.Applications : Object

Methods :

public String get_AppsHashCode()
public Int64 get_Version()
public Boolean get_ReturnUpInstancesOnly()
public Void set_ReturnUpInstancesOnly(Boolean value = )
public IList<Application> GetRegisteredApplications()
public Application GetRegisteredApplication(String appName = )
public IList<InstanceInfo> GetInstancesBySecureVirtualHostName(String secureVirtualHostName = )
public IList<InstanceInfo> GetInstancesByVirtualHostName(String virtualHostName = )
public String ToString()
public Type GetType()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()