Exemple #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));
        }
Exemple #2
0
        public ActionResult EmployTesterForJob(int?id)
        {
            SelectTestJobTesterViewModel jobTester = new SelectTestJobTesterViewModel();

            if (id == null)
            {
                WarningViewModel erv = new WarningViewModel()
                {
                    Title = "HATA 404",
                    RedirectingTimeout = 2000,
                    RedirectingUrl     = "/Job_Adv/Details/" + id
                };
                erv.Items.Add("Hatalı Parametre..!");
                return(View("Warning", erv));
            }

            Test_Job tj = testJobManager.Find(x => x.JobAdvId == id.Value);

            if (tj != null && tj.job_testers != null)
            {
                Test_Job test_Job = testJobManager.Find(x => x.JobAdvId == id.Value);
                if (test_Job == null)
                {
                    return(HttpNotFound());
                }
                List <Tester> ts = new List <Tester>();
                foreach (var item in testerManager.List(x => x.isReady))
                {
                    ts.Add(item);
                }
                jobTester.Adv_Id     = id.Value;
                jobTester.Testers    = ts;
                jobTester.Test_job   = test_Job;
                jobTester.limit      = test_Job.tester_limit;
                jobTester.jobtesters = test_Job.job_testers;
                jobTester.Remaining  = test_Job.tester_limit - test_Job.job_testers.Count;
                return(View(jobTester));
            }
            else
            {
                WarningViewModel erv = new WarningViewModel()
                {
                    Title = "HATA",
                    RedirectingTimeout = 2000,
                    RedirectingUrl     = "/Job_Adv/Details/" + id
                };
                erv.Items.Add("Henüz bir kullanım senaryosu oluşturmadınız..!");
                return(View("Warning", erv));
            }
        }