Beispiel #1
0
        public void DeleteTest()
        {
            AgileWorksWebAppealsDBEntities agileWorksWebAppealsDBEntities = new AgileWorksWebAppealsDBEntities();
            Appeals appeals = new Appeals();

            appeals.deadlineDatetime = new DateTime(2019, 1, 19);
            appeals.entryDatetime    = DateTime.Now;
            appeals.description      = "Test123456Delete";

            AppealsController appealsController = new AppealsController();

            agileWorksWebAppealsDBEntities.Appeals.Add(appeals);
            agileWorksWebAppealsDBEntities.SaveChanges();

            var ifExists = agileWorksWebAppealsDBEntities.Appeals.Where(x => x.appealId == appeals.appealId).FirstOrDefault();

            Assert.IsNotNull(ifExists);

            var result2 = appealsController.Delete(ifExists.appealId, new FormCollection());


            var isDeleted = agileWorksWebAppealsDBEntities.Appeals.Where(x => x.appealId == ifExists.appealId).FirstOrDefault();

            Assert.IsNull(isDeleted);
        }
Beispiel #2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            IAppeal laheKoht = new Appeal()
            {
                kirjeldus          = "Lahe Leht",
                lahendamiseT2htAeg = DateTime.Parse("10.07.2017 14:40:59")
            };

            Appeals.AadAppeal(laheKoht);

            IAppeal p88rdumine = new Appeal()
            {
                kirjeldus          = "Uus pöördumine",
                lahendamiseT2htAeg = DateTime.Parse("5.06.2017 18:38:32")
            };

            Appeals.AadAppeal(p88rdumine);

            IAppeal aegumata = new Appeal()
            {
                kirjeldus          = "Aegumata",
                lahendamiseT2htAeg = DateTime.Parse("5.06.2018 18:38:32")
            };

            Appeals.AadAppeal(aegumata);
        }
Beispiel #3
0
 public ActionResult Appeal(Appeal model)
 {
     if (ModelState.IsValid)
     {
         Appeals.AadAppeal(model);
         return(View("ThanksForInserting"));
     }
     return(View(model));
 }
Beispiel #4
0
        public void IndexTest()
        {
            Appeals           appeals           = new Appeals();
            AppealsController appealsController = new AppealsController();
            ViewResult        viewResult        = appealsController.Index(5) as ViewResult;

            Assert.IsNotNull(viewResult.Model);
            Assert.IsInstanceOfType(viewResult.Model, typeof(PagedList.PagedList <Appeals>));
        }
Beispiel #5
0
 private void FillAppeals()
 {
     if (File.Exists(_pathToZipAppeals))
     {
         Appeals.Clear();
         Thread myThread = new Thread(new ThreadStart(FillAppeal));
         myThread.Start();
     }
 }
Beispiel #6
0
 private void FileReader_onWrite()
 {
     foreach (var appeal in appeals)
     {
         App.Current.Dispatcher.BeginInvoke((Action) delegate // <--- HERE
         {
             Appeals.Add(new FillAppeal_VM {
                 FullName = appeal[0], InputPhone = appeal[1], CurrentDay = appeal[2], CurrentHour = Convert.ToInt32(appeal[3]), CurrentMinute = appeal[4], Status = appeal[5], ParticipantRole = appeal[6], Email = appeal[7], Company = appeal[8], Appeal = appeal[9], AdditionalInfo = appeal[10], UserName = appeal[11]
             });
         });
     }
 }
Beispiel #7
0
        public void TestIfPastAppealCanBeAdded()
        {
            AgileWorksWebAppealsDBEntities agileWorksWebAppealsDBEntities = new AgileWorksWebAppealsDBEntities();

            Appeals appeals = new Appeals();

            appeals.deadlineDatetime = new DateTime(1996, 1, 19);
            appeals.entryDatetime    = DateTime.Now;
            appeals.description      = "Test123456123456789";

            AppealsController appealsController = new AppealsController();

            var result = appealsController.Create(appeals);
        }
Beispiel #8
0
        // GET: Appeals/Delete/5
        public ActionResult Delete(int id)
        {
            using (AgileWorksWebAppealsDBEntities agileWorksDatabaseEntities = new AgileWorksWebAppealsDBEntities())
            {
                Appeals appeals = agileWorksDatabaseEntities.Appeals.Where(x => x.appealId == id).First();

                if (appeals != null)
                {
                    return(View(appeals));
                }
                else
                {
                    return(new HttpNotFoundResult("Appeal not found!"));
                }
            }
        }
Beispiel #9
0
        public void TestIfFutureAppealExists()
        {
            AgileWorksWebAppealsDBEntities agileWorksWebAppealsDBEntities = new AgileWorksWebAppealsDBEntities();

            Appeals appeals = new Appeals();

            appeals.deadlineDatetime = new DateTime(2020, 1, 19);
            appeals.entryDatetime    = DateTime.Now;
            appeals.description      = "Test123456123456789";

            AppealsController appealsController = new AppealsController();
            var result   = appealsController.Create(appeals);
            var ifExists = agileWorksWebAppealsDBEntities.Appeals.Where(x => x.appealId == appeals.appealId).FirstOrDefault();


            Assert.IsNotNull(ifExists);
            Assert.AreEqual(appeals.description, ifExists.description);
        }
Beispiel #10
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            using (AgileWorksWebAppealsDBEntities agileWorksDatabaseEntities = new AgileWorksWebAppealsDBEntities())
            {
                Appeals appeal = agileWorksDatabaseEntities.Appeals.Where(x => x.appealId == id).FirstOrDefault();

                if (appeal != null)
                {
                    agileWorksDatabaseEntities.Appeals.Remove(appeal);
                    agileWorksDatabaseEntities.SaveChanges();
                }
                else
                {
                    return(new HttpNotFoundResult("Appeal not found!"));
                }
            }

            return(RedirectToAction("Index"));
        }
Beispiel #11
0
        public ActionResult Create(Appeals appeals)
        {
            var now = DateTime.Now;

            using (AgileWorksWebAppealsDBEntities agileWorksDatabaseEntities = new AgileWorksWebAppealsDBEntities())
            {
                if (ModelState.IsValid)
                {
                    agileWorksDatabaseEntities.Appeals.Add(appeals);
                    agileWorksDatabaseEntities.SaveChanges();
                }
                else if (!ModelState.IsValid)
                {
                    return(View(appeals));
                }
            }

            return(RedirectToAction("Index"));
        }
Beispiel #12
0
 public ActionResult EndAppeal(int id)
 {
     Appeals.EndAppeal(id);
     return(View("ShowAppeals", Appeals.GetActiveAppeals()));
 }
Beispiel #13
0
        public ActionResult ShowAppeals()
        {
            List <IAppeal> appeals = Appeals.GetActiveAppeals();

            return(View(appeals));
        }