Beispiel #1
0
        public async Task <IActionResult> PutJob([FromRoute] int id, [FromBody] Job job)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != job.Id)
            {
                return(BadRequest());
            }

            _context.Entry(job).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!JobExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyName,Current, Description")] Company company)
        {
            if (id != company.Id)
            {
                return(NotFound());
            }
            // company.Id = id;

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(company);
                    await _context.SaveChangesAsync();

                    return(Ok(new JsonResult(company)));
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(company.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(BadRequest());
        }
Beispiel #3
0
        internal static async Task LockJC(int jobId, string regNumber, int superServiceOrderId, DateTime accrueDate)
        {
            Console.WriteLine($"Locking JC");
            Trace.WriteLine($"{regNumber}, , Locking JC ");

            try
            {
                using (var _dbContext = new JobDbContext(connectionString))
                {
                    //BILLABLE ITEM
                    var    dateStamp   = accrueDate;
                    string currentUser = "******";

                    var items = await _dbContext.BillableItem.Where(bi => bi.SuperServiceOrderId == superServiceOrderId && bi.BillableItemStatusIdentifier == BillableItemStatusIdentifier.QUEUED).ToListAsync();

                    items.ForEach(item =>
                    {
                        item.BillableItemStatusIdentifier = BillableItemStatusIdentifier.ACCRUAL_PENDING;
                        item.DateModified = dateStamp;
                        item.ModifiedBy   = currentUser;
                    });

                    var superServiceOrder = _dbContext.SuperServiceOrder.Include(sso => sso.Job)
                                            .FirstOrDefault(x => x.Id == superServiceOrderId);

                    superServiceOrder.AccrualPendingDateTime = dateStamp;
                    superServiceOrder.AccrualStatus          = AccrualStatus.PENDING;

                    if (superServiceOrder.Job.AccrualStatus != AccrualStatus.POSTED)
                    {
                        superServiceOrder.Job.AccrualStatus = AccrualStatus.PENDING;
                    }

                    superServiceOrder.ModifiedBy   = "*****@*****.**";
                    superServiceOrder.DateModified = dateStamp;

                    await _dbContext.SaveChangesAsync();

                    //PAYBLE ITEM
                    var pitems = await _dbContext.PayableItem.Where(pi => pi.SuperServiceOrderId == superServiceOrderId && pi.PayableItemStatusIdentifier == PayableItemStatusIdentifier.QUEUED).ToListAsync();

                    pitems.ForEach(item =>
                    {
                        item.PayableItemStatusIdentifier = PayableItemStatusIdentifier.ACCRUAL_PENDING;
                        item.DateModified = dateStamp;
                        item.ModifiedBy   = currentUser;
                    });

                    await _dbContext.SaveChangesAsync();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error While trying to lock");
                Trace.WriteLine($"{regNumber}, , Error while trying to lock");
                Trace.WriteLine($"{regNumber}, , {ex.Message}");
            }
        }
Beispiel #4
0
            public async Task <JsonEntityBase> Handle(SaveJobCmd request, CancellationToken cancellationToken)
            {
                if (_validationNotificationContext.HasErrorNotifications)
                {
                    return(_validationNotificationContext.GetErrorNotifications().Error());
                }

                var model = request.VM;

                if (model.IsNew || model.JobId <= 0)
                {
                    // add
                    var job = new JobInfo()
                    {
                        Cron            = model.Cron,
                        Status          = request.Trigger ? 1 : 0,
                        ExecutorHandler = model.ExecutorHandler,
                        ExecutorParam   = model.ExecutorParam,
                        InTime          = DateTime.Now,
                        Name            = model.JobName,
                        UpdateTime      = DateTime.Now,
                        ExecutorId      = model.ExecutorId,
                        CreateUser      = model.CreateUser,
                        SelectorType    = model.SelectorType
                    };

                    await _dbContext.JobInfo.AddAsync(job);

                    await _jobSchedulerHandler.AddOrUpdateJob(job, request.Trigger);

                    await _dbContext.SaveChangesAsync();
                }
                else
                {
                    var job = await _dbContext.JobInfo.FindAsync(model.JobId);

                    job.Cron            = model.Cron;
                    job.ExecutorHandler = model.ExecutorHandler;
                    job.ExecutorParam   = model.ExecutorParam;
                    job.Name            = model.JobName;
                    job.UpdateTime      = DateTime.Now;
                    job.ExecutorId      = model.ExecutorId;
                    job.SelectorType    = model.SelectorType;

                    if (request.Trigger)
                    {
                        job.Status = 1;
                    }

                    await _jobSchedulerHandler.AddOrUpdateJob(job, request.Trigger);

                    await _dbContext.SaveChangesAsync();
                }

                return(new { }.Success());
            }
        public async Task <IActionResult> Create([Bind("Id,ApplicationnId,Title,Content")] ApplicationBody applicationBody)
        {
            if (ModelState.IsValid)
            {
                _context.Add(applicationBody);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(applicationBody));
        }
Beispiel #6
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,BirthDate,Religion,Sex,Gender,Picture,PictureAlt,Nationality,Nationality2")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Create([Bind("Id,UserId,Title,Facility,AddressNation,FacilityAddressCity,FacilityAddressStreet,FacilityAddressState,Graduation,TestimonyUrl,StartDate,EndDate")] UserEducation userEducation)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userEducation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userEducation));
        }
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,CompanyBranchId,JobId,HeadHunterId,JobExchangeId,ApplicationnId,SalaryOffered,IsActive,Releasedate,JobOfferUrl")] JobOffer jobOffer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobOffer);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(jobOffer));
        }
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,UserId,AddressNation,AddressCity,AddressStreet,AddressState,PhoneNumber,PhoneNumberAlt,EmailAddress,EmailAddressAlt,Current")] UserContactData userContactData)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userContactData);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(userContactData));
        }
Beispiel #10
0
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,JobOfferId,Title,TitleAlt,TitleAlt2")] Job job)
        {
            if (ModelState.IsValid)
            {
                _context.Add(job);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(job));
        }
Beispiel #11
0
//[ValidateAntiForgeryToken]
        public async Task <ActionResult <Jobsuche> > Create([Bind("Id,UserId,JobOfferId,CompanyId,Email,JobId,Status,DateSent,DateAnswered,Proof")] Jobsuche jobsuche)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobsuche);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(jobsuche);
        }
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,IsActive")] HeadHunter headHunter)
        {
            if (ModelState.IsValid)
            {
                _context.Add(headHunter);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(headHunter));
        }
Beispiel #13
0
        public async Task <IActionResult> Create([Bind("Id,JobOfferId,Title,TitleAlt,TitleAlt2")] Job job)
        {
            if (ModelState.IsValid)
            {
                _context.Add(job);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(job));
        }
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,IsActive")] HeadHunter headHunter)
        {
            if (ModelState.IsValid)
            {
                _context.Add(headHunter);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(headHunter));
        }
Beispiel #15
0
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,CompanyId,JobExchangeId,AddressNation,AddressCity,AddressStreet,AddressState,PhoneNumber,PhoneNumberAlt,EmailAddress,IsActive")] HeadHunterContactData headHunterContactData)
        {
            if (ModelState.IsValid)
            {
                _context.Add(headHunterContactData);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(headHunterContactData));
        }
        public async Task <IActionResult> Create([Bind("Id,CompanyId,CompanyBranchId,Name,PhoneNumber,PhoneNumberAlt,EmailAddress,EmailAddressAlt,IsActive")] CompanyContactData companyContactData)
        {
            if (ModelState.IsValid)
            {
                _context.Add(companyContactData);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(companyContactData));
        }
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create(User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(Created(HttpContext.Request.Scheme + "://" + HttpContext.Request.Host + HttpContext.Request.Path + "/" + user.Id, user));
            }
            return(BadRequest("Model is not matching"));
        }
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,CompanyId,Name,Content,Date")] CompanyHistory companyHistory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(companyHistory);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(companyHistory));
        }
        public async Task <IActionResult> Create([Bind("Id,CompanyId,Name,Content,Date")] CompanyHistory companyHistory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(companyHistory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(companyHistory));
        }
        public async Task <IActionResult> Create([Bind("Id,UserId,Name,Content,Url")] UserWebsite userWebsite)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userWebsite);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userWebsite));
        }
Beispiel #21
0
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,UserId,SkillName,SkillDescritpion,SelfRating,Current")] UserSkill userSkill)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userSkill);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(userSkill));
        }
Beispiel #22
0
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,JobId,Name,Content")] JobSkill jobSkill)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobSkill);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(jobSkill));
        }
Beispiel #23
0
        public async Task <IActionResult> Create([Bind("Id,JobId,Name,Content")] JobSkill jobSkill)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobSkill);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobSkill));
        }
        //[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,Name,Url,Current")] JobExchange jobExchange)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobExchange);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(new JsonResult(jobExchange));
        }
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,UserId,Title,Description,SkillSummary,TestimonyUrl,Salary,StartDate,EndDate,Current")] UserJobHistory userJobHistory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userJobHistory);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(userJobHistory));
        }
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,ApplicationnId,Title,Content")] ApplicationFooter applicationFooter)
        {
            if (ModelState.IsValid)
            {
                _context.Add(applicationFooter);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(applicationFooter));
        }
Beispiel #27
0
        public async Task <IActionResult> Create([Bind("Id,UserId,SkillName,SkillDescritpion,SelfRating,Current")] UserSkill userSkill)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userSkill);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userSkill));
        }
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,JobId,DescriptionShort,DescriptionLong,Nation,Region,MinSalary,MaxSalary,Current")] JobData jobData)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobData);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(jobData));
        }
Beispiel #29
0
//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,UserId,JobOfferId,Title,Answer,DateSent,DateAnswered,Current")] Application application)
        {
            if (ModelState.IsValid)
            {
                _context.Add(application);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(new JsonResult(application));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,AgentId,JobNumber,Title,StartTime,EndTime,Status,CustomerName,CustomerAddress,CustomerPhoneNumber,WorkPerformed,Version,CreatedAt,UpdatedAt,Deleted")] Job job)
        {
            if (ModelState.IsValid)
            {
                db.JobsDbSet.Add(job);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(job));
        }