예제 #1
0
        public ActionResult EmployTesterForJob(SelectTestJobTesterViewModel tjt)
        {
            if (ModelState.IsValid)
            {
                TesterManager tm = new TesterManager();
                if (tm == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                Test_Job tj = testJobManager.Find(x => x.JobAdvId == tjt.Adv_Id);
                if (tj == null)
                {
                    return(HttpNotFound());
                }

                if (tj.job_testers.Count == tj.tester_limit)
                {
                    WarningViewModel erv = new WarningViewModel()
                    {
                        Title = "HATA",
                        RedirectingTimeout = 2000,
                        RedirectingUrl     = "/Test_Job/EmployTesterForJob/" + tj.JobAdvId
                    };
                    erv.Items.Add("Görevin Tester Limiti Dolmuştur..!");
                    return(View("Warning", erv));
                }
                else
                {
                    Tester selectedTM = testerManager.GetTesterById(tjt.selectedTesterId).Result;
                    selectedTM.isReady = false;
                    tj.job_testers.Add(selectedTM);
                    if (tj.job_testers.Count == tj.tester_limit)
                    {
                        tj.start_date = DateTime.Now;
                    }
                    if (testJobManager.Update(tj) > 0)
                    {
                        selectedTM.notifications.Add(new Notification()
                        {
                            notification = tj.test_job_title + " Görevine Atandınız.", link = "/Test_Job/Details/" + tj.JobAdvId, IsRead = false
                        });
                        tm.Update(selectedTM);

                        OkViewModel OkntfyObj = new OkViewModel()
                        {
                            Title              = "Atama Başarılı..",
                            RedirectingUrl     = "/Job_Adv/Details/" + jobAdvManager.Find(y => y.JobAdvId == tjt.Adv_Id).JobAdvId,
                            RedirectingTimeout = 3000
                        };
                        OkntfyObj.Items.Add("Tester " + selectedTM.user_name + " " + selectedTM.user_surname + " Başarılı bir şekilde " + tj.test_job_title + " görevine atandı..!");
                        return(View("Ok", OkntfyObj));
                    }
                }
            }
            return(View(tjt));
        }
예제 #2
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Job_Adv job_Adv = jobAdvManager.Find(x => x.JobAdvId == id.Value);

            if (job_Adv == null)
            {
                return(HttpNotFound());
            }
            return(View(job_Adv));
        }