public BusinessLayerResult <Test_Master> RemoveTestMasterById(int id)
        {
            BusinessLayerResult <Test_Master> res = new BusinessLayerResult <Test_Master>();
            Test_Master test_master = Find(x => x.UserId == id);

            if (test_master != null)
            {
                Test_Job res_tj = repo_test_job.List().Where(x => x.job_test_master == test_master).Where(x => x.confirmation == false).FirstOrDefault();
                if (res_tj != null)
                {
                    res.AddError(ErrorMessageCode.TesterHasUncompletedJob, "Test Master'ın henüz tamamlanmamış" +
                                 res_tj.test_job_title + " görevi vardır..!");
                    return(res);
                }
                if (Delete(test_master) == 0)
                {
                    res.AddError(ErrorMessageCode.UserCouldNotRemove, "Kullanıcı Silinemedi");
                    return(res);
                }
            }
            else
            {
                res.AddError(ErrorMessageCode.UserCouldNotFind, "Kullanıcı Bulunamadı");
            }
            return(res);
        }
Example #2
0
        public ActionResult Edit(JobAnsEditViewModel job_Ans, HttpPostedFileBase AdvImage)
        {
            Random rnd = new Random();
            string pic = null;

            if (ModelState.IsValid)
            {
                if (AdvImage != null &&
                    (AdvImage.ContentType == "image/jpeg" ||
                     AdvImage.ContentType == "image/jpg" ||
                     AdvImage.ContentType == "image/png"))
                {
                    string filename = $"ans_{rnd.Next()}.{AdvImage.ContentType.Split('/')[1]}";

                    AdvImage.SaveAs(Server.MapPath($"~/Images/Ans_Images/{filename}"));
                    pic = filename;
                }
                Nullable <DateTime> d  = new DateTime();
                Test_Job            tj = testJobManager.Find(x => x.TestJobID == job_Ans.testjob_id);
                Job_Ans             ja = jobAnsManager.Find(x => x.JobAnsId == job_Ans.old_ansid);
                ja.ans_title      = job_Ans.ans_title;
                ja.ans_desc       = job_Ans.ans_desc;
                ja.isSubmitted    = job_Ans.isSubmitted;
                ja.State          = (job_Ans.isSubmitted == true) ? "Gönderildi" : "Düzenlendi";
                ja.ModifiedTime   = DateTime.Now;
                ja.SubmitTime     = (job_Ans.isSubmitted == true) ? DateTime.Now : d;
                ja.ans_screenshot = (pic != null) ? pic : ja.ans_screenshot;
                jobAnsManager.Update(ja);
                return(RedirectToAction("Index"));
            }
            return(View(job_Ans));
        }
Example #3
0
 public ActionResult Edit(Test_Job test_Job)
 {
     if (ModelState.IsValid)
     {
         return(RedirectToAction("Index"));
     }
     testJobManager.Update(test_Job);
     return(View(test_Job));
 }
Example #4
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));
        }
Example #5
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));
            }
        }
Example #6
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Test_Job tj = testJobManager.Find(x => x.JobAdvId == id.Value);

            if (tj == null)
            {
                return(HttpNotFound());
            }
            return(View());
        }
Example #7
0
        // GET: Test_Job/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Test_Job tj = testJobManager.Find(x => x.JobAdvId == id);

            if (tj == null)
            {
                return(HttpNotFound("Kullanım Senaryosu Bulunamadı..!"));
            }

            return(View(tj));
        }
Example #8
0
        public ActionResult Create(JobAnsViewModel job_Ans, HttpPostedFileBase AdvImage)
        {
            Random rnd = new Random();
            string pic = null;

            if (ModelState.IsValid)
            {
                if (AdvImage != null &&
                    (AdvImage.ContentType == "image/jpeg" ||
                     AdvImage.ContentType == "image/jpg" ||
                     AdvImage.ContentType == "image/png"))
                {
                    string filename = $"ans_{rnd.Next()}.{AdvImage.ContentType.Split('/')[1]}";

                    AdvImage.SaveAs(Server.MapPath($"~/Images/Ans_Images/{filename}"));
                    pic = filename;
                }
                Test_Job tj = testJobManager.Find(x => x.TestJobID == job_Ans.testjob_id);

                Job_Ans ja = new Job_Ans()
                {
                    ans_desc       = job_Ans.ans_desc,
                    ans_title      = job_Ans.ans_title,
                    isSubmitted    = job_Ans.isSubmitted,
                    ModifiedTime   = DateTime.Now,
                    State          = (job_Ans.isSubmitted) ? "Gönderildi" : "Kaydedildi",
                    SubmitTime     = DateTime.Now,
                    test_job       = tj,
                    tester         = Session["login"] as Tester,
                    ans_screenshot = pic
                };
                tj.job_answers.Add(ja);
                testJobManager.Update(tj);
                return(RedirectToAction("Index"));
            }

            return(View(job_Ans));
        }
Example #9
0
        public ActionResult Create(TestJobRegisterViewModel test_job)
        {
            if (ModelState.IsValid)
            {
                Job_Adv  ja = jobAdvManager.Find(x => x.JobAdvId == test_job.adv_id);
                Test_Job TJ = new Test_Job()
                {
                    test_job_title  = test_job.testjob_title,
                    description     = test_job.testjob_desc,
                    tester_limit    = test_job.tester_limit,
                    start_date      = DateTime.Now,
                    JobAdvId        = ja.JobAdvId,
                    Job_Adv         = jobAdvManager.Find(x => x.JobAdvId == ja.JobAdvId),
                    finish_date     = test_job.finish_Date,
                    job_test_master = (CurrentSession.User as Test_Master),
                    price           = test_job.price,
                    job_customer    = jobAdvManager.Find(x => x.JobAdvId == ja.JobAdvId).adv_customer
                };
                testJobManager.Insert(TJ);
                return(RedirectToAction("Details", "Job_Adv", new { id = test_job.adv_id }));
            }

            return(View(test_job));
        }
Example #10
0
        // GET: Job_Ans/Details/5
        public ActionResult Details(int?id)
        {
            if (Session["login"] is Tester)
            {
                Test_Job tj = testJobManager.Find(x => x.TestJobID == id.Value);

                Job_Ans JA = tj.job_answers.Find(x => x.tester == Session["login"] as Tester);
                return(View(JA));
            }
            if (Session["login"] is Test_Master)
            {
                Job_Ans JA = jobAnsManager.Find(x => x.JobAnsId == id.Value);
                return(View(JA));
            }
            if (Session["login"] is Admin)
            {
                Job_Ans JA = jobAnsManager.Find(x => x.JobAnsId == id.Value);
                return(View(JA));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }