Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            JPNotification jPNotification = db.JPNotifications.Find(id);

            db.JPNotifications.Remove(jPNotification);
            db.SaveChanges();
            return(RedirectToAction("Update"));
        }
Esempio n. 2
0
        // GET: JPNotifications/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JPNotification jPNotification = db.JPNotifications.Find(id);

            if (jPNotification == null)
            {
                return(HttpNotFound());
            }
            return(View(jPNotification));
        }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "JPHireId,JPStudentId,JPCompanyName,JPJobTitle,JPJobCategory,JPSalary,JPCompanyCity,JPCompanyState,JPSecondJob,JPCareersPage,JPHireDate")] JPHire jPHire)
        {
            if (ModelState.IsValid)
            {
                // Grabs the active users ID and uses it to identify the users row in JPStudents table to edit JPGraduated and JPHired from false to true.
                string    userID    = User.Identity.GetUserId();
                JPStudent jpStudent = db.JPStudents.Where(x => x.ApplicationUserId == userID).FirstOrDefault();
                jpStudent.JPGraduated = true;
                jpStudent.JPHired     = true;


                //Auto-populating JPHireId, ApplicationUserId, and JPHireDate during user creation.
                jPHire.JPHireId          = Guid.NewGuid();
                jPHire.JPHireDate        = DateTime.Now;
                jPHire.ApplicationUserId = userID;

                db.Entry(jpStudent).State = EntityState.Modified;
                db.JPHires.Add(jPHire);


                //Create JPNotification record

                JPNotification jPNotification = new JPNotification();
                jPNotification.JPStudent        = jpStudent;
                jPNotification.Hire             = true;
                jPNotification.NotificationDate = DateTime.Now;


                db.JPNotifications.Add(jPNotification);
                db.SaveChanges();


                //Build notification email and assign sender/recipient
                MailMessage message = new MailMessage();
                message.To.Add(new MailAddress("*****@*****.**"));
                message.From       = new MailAddress("*****@*****.**");//REPLACE WITH VALID VALUE
                message.Subject    = "Automated Hiring Alert";
                message.Body       = jpStudent.JPName + " has submit a Hiring form. This is an automated notification.";
                message.IsBodyHtml = false;

                //Send notification email to portland jobs director via async task
                HostingEnvironment.QueueBackgroundWorkItem(_ => SendEmail(message));

                return(RedirectToAction("Index"));
            }

            //ViewBag.JPStudentId = new SelectList(db.JPStudents, "JPStudentId", "JPName", jPHire.JPStudentId);
            return(View(jPHire));
        }
        public ActionResult Create([Bind(Include = "JPAppId,JPStudentId,JPCompanyName,JPJobTitle,JPJobCategory,JPCompanyCity,JPCompanyState,JPStudentLocation")] JPApplication jPApplication)
        {
            if (ModelState.IsValid)
            {
                //Auto-populating JPAppId, ApplicationUserId, and JPApplicationDate during user creation.
                jPApplication.JPAppId           = Guid.NewGuid();
                jPApplication.ApplicationUserId = User.Identity.GetUserId();
                jPApplication.JPApplicationDate = DateTime.Now;
                string    userID    = User.Identity.GetUserId();
                JPStudent jpStudent = db.JPStudents.Where(x => x.ApplicationUserId == userID).FirstOrDefault();
                jPApplication.HeardBack = false;
                jPApplication.Interview = false;

                jPApplication.JPStudentLocation = jpStudent.JPStudentLocation;
                db.JPApplications.Add(jPApplication);

                //Create JPNotifcation with Graduate = true if total user applications =35


                var applications = from s in db.JPApplications.Where(x => x.ApplicationUserId == userID)
                                   select s;
                int appCount = applications.Count();
                if (appCount == 34)
                {
                    JPNotification jPNotification = new JPNotification();
                    jPNotification.Graduate         = true;
                    jPNotification.NotificationDate = DateTime.Now;
                    jPNotification.JPStudent        = jpStudent;
                    db.JPNotifications.Add(jPNotification);
                }
                db.SaveChanges();
                return(RedirectToAction("StudentIndex"));
            }


            //ViewBag.JPStudentId = new SelectList(db.JPStudents, "JPStudentId", "JPName", jPApplication.JPStudentId);
            return(View(jPApplication));
        }
Esempio n. 5
0
        public ActionResult Create([Bind(Include = "JPHireId,JPStudentId,JPCompanyName,JPJobTitle,JPJobCategory,JPSalary,JPCompanyCity,JPCompanyState,JPSecondJob,JPCareersPage,JPHireDate")] JPHire jPHire)
        {
            if (ModelState.IsValid)
            {
                // Grabs the active users ID and uses it to identify the users row in JPStudents table to edit JPGraduated and JPHired from false to true.
                string    userID    = User.Identity.GetUserId();
                JPStudent jpStudent = db.JPStudents.Where(x => x.ApplicationUserId == userID).FirstOrDefault();
                jpStudent.JPGraduated = true;
                jpStudent.JPHired     = true;


                //Auto-populating JPHireId, ApplicationUserId, and JPHireDate during user creation.
                jPHire.JPHireId          = Guid.NewGuid();
                jPHire.JPHireDate        = DateTime.Now;
                jPHire.ApplicationUserId = userID;

                db.Entry(jpStudent).State = EntityState.Modified;
                db.JPHires.Add(jPHire);


                //Create JPNotification record

                JPNotification jPNotification = new JPNotification();
                jPNotification.JPStudent        = jpStudent;
                jPNotification.Hire             = true;
                jPNotification.NotificationDate = DateTime.Now;


                db.JPNotifications.Add(jPNotification);
                db.SaveChanges();

                return(View("Details"));
            }

            //ViewBag.JPStudentId = new SelectList(db.JPStudents, "JPStudentId", "JPName", jPHire.JPStudentId);
            return(View(jPHire));
        }