Beispiel #1
0
 public IActionResult Get(int id)
 {
     try
     {
         return(Ok(CandidateTask.SelectCandidateTask(id)));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Beispiel #2
0
 public IActionResult Delete(int id)
 {
     try
     {
         var candidateTask = CandidateTask.SelectCandidateTask(id);
         candidateTask.Delete();
         return(Ok("success"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Beispiel #3
0
        public ACandidateTask GetACandidateTask(CandidateTask candidateTask)
        {
            ACandidateTask aCandidateTask = new TSQLCandidateTask();

            aCandidateTask.ID        = candidateTask.ID;
            aCandidateTask.Candidate = GetACandidate(candidateTask.Candidate);
            aCandidateTask.Descr     = candidateTask.Descr;
            aCandidateTask.ExpectedCompletionDate = candidateTask.ExpectedCompletionDate;
            aCandidateTask.FactCompletionDate     = candidateTask.FactCompletionDate;
            aCandidateTask.InspectorName          = candidateTask.InspectorName;
            aCandidateTask.InspectorRating        = candidateTask.InspectorRating;
            aCandidateTask.ReceiptDate            = candidateTask.ReceiptDate;
            aCandidateTask.State = candidateTask.State;
            return(aCandidateTask);
        }
Beispiel #4
0
        public CandidateTask GetCandidateTask(ACandidateTask aCandidateTask)
        {
            CandidateTask candidateTask = new CandidateTask();

            candidateTask.ID        = aCandidateTask.ID;
            candidateTask.Candidate = GetCandidate(aCandidateTask.Candidate);
            candidateTask.Descr     = aCandidateTask.Descr;
            candidateTask.ExpectedCompletionDate = aCandidateTask.ExpectedCompletionDate;
            candidateTask.FactCompletionDate     = aCandidateTask.FactCompletionDate;
            candidateTask.InspectorName          = aCandidateTask.InspectorName;
            candidateTask.InspectorRating        = aCandidateTask.InspectorRating;
            candidateTask.ReceiptDate            = aCandidateTask.ReceiptDate;
            candidateTask.State = aCandidateTask.State;
            return(candidateTask);
        }
Beispiel #5
0
 public IActionResult SetCheckedPut(int id, String inspector, float rating)
 {
     try
     {
         var oldCandidateTask = CandidateTask.SelectCandidateTask(id);
         oldCandidateTask.UpdateChecked(inspector, rating);
         eMailWorcker.sendEMail("Определена оценка выполненой задачи", $"{inspector} выполнил задачувыстовил оценку {rating} задаче {oldCandidateTask.ID}, выполненой соискателем {oldCandidateTask.Candidate.Name}.", new List <string>()
         {
             oldCandidateTask.Candidate.HRMail
         });
         return(Ok("success"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Beispiel #6
0
 public IActionResult SetCompletedPut(int id, DateTime completiondtime)
 {
     try
     {
         var oldCandidateTask = CandidateTask.SelectCandidateTask(id);
         oldCandidateTask.UpdateCompleted(completiondtime);
         eMailWorcker.sendEMail("Соискатель выполнил задачу", $"Соискатель {oldCandidateTask.Candidate.Name} выполнил задачу {oldCandidateTask.ID} и сдал на проверку.", new List <string>()
         {
             oldCandidateTask.Candidate.HRMail
         });
         return(Ok("success"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Beispiel #7
0
 public IActionResult Post(CandidateTask candidateTask)
 {
     try
     {
         candidateTask.Insert();
         var candidate = Candidate.SelectCandidate(candidateTask.ID);
         eMailWorcker.sendEMail("Соискателю выдана задача", $"Выдана задача соискателю {candidate.Name} крайний срок выполнения {candidateTask.ExpectedCompletionDate}.", new List <string>()
         {
             candidate.HRMail
         });
         return(Ok("success"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Beispiel #8
0
        public TaskRunResult Run(CandidateTask task, string code)
        {
            AppDomain domain = null;

            try
            {
                domain = AppDomain.CreateDomain(
                    $"domain_{Guid.NewGuid().ToString()}",
                    AppDomain.CurrentDomain.Evidence,
                    AppDomain.CurrentDomain.SetupInformation);

                var runner = (UserTestRunner)domain.CreateInstanceAndUnwrap(
                    typeof(UserTestRunner).Assembly.FullName,
                    typeof(UserTestRunner).FullName,
                    true,
                    System.Reflection.BindingFlags.CreateInstance,
                    null,
                    new object[] { _nUnitFilterFactory },
                    null,
                    null);

                if (!runner.Run(task.TestClass.AssemblyInfo.Data, code, task.TestClass.Name, task.TestMethod?.Name))
                {
                    return(new TaskRunResult
                    {
                        Success = false,
                        ErrorMessage = runner.ErrorMessage
                    });
                }

                return(new TaskRunResult {
                    Success = true
                });
            }
            finally
            {
                if (domain != null)
                {
                    AppDomain.Unload(domain);
                }
            }
        }