Exemplo n.º 1
0
/*      Commented out details, create and delete for now
 *
 *      // GET: JPStudentRundown/Details/5
 *      public ActionResult Details(int id)
 *      {
 *          return View();
 *      }
 *
 *      // GET: JPStudentRundown/Create
 *      public ActionResult Create()
 *      {
 *          return View();
 *      }
 *
 *      // POST: JPStudentRundown/Create
 *      [HttpPost]
 *      public ActionResult Create(FormCollection collection)
 *      {
 *          try
 *          {
 *              // TODO: Add insert logic here
 *
 *              return RedirectToAction("Index");
 *          }
 *          catch
 *          {
 *              return View();
 *          }
 *      }
 */
        // GET: JPStudentRundown/Edit/5
        public ActionResult Edit(int id)
        {
            //JPStudentRundown jpStudent = BuildRundownObj(id);
            JPStudent jpStudent = db.JPStudents.Find(id);

            return(View(jpStudent));
        }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            JPStudent jPStudent = db.JPStudents.Find(id);

            db.JPStudents.Remove(jPStudent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "JPStudentId,JPName,JPEmail,JPStudentLocation,JPStartDate,JPLinkedIn,JPGithubLink,JPPortfolio,JPContact,JPGraduated,JPHired,ApplicationUserId")] JPStudent jPStudent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jPStudent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "JPStudentId,JPName,JPEmail,JPStudentLocation,JPStartDate,JPLinkedIn,JPPortfolio,JPContact")] JPStudent jPStudent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jPStudent).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(jPStudent));
 }
        public ActionResult DeleteConfirmed(int id)
        {
            JPStudent jPStudent   = db.JPStudents.Find(id);
            var       jPChecklist = db.JPChecklists
                                    .Where(b => b.ApplicationUserid == jPStudent.ApplicationUserId)
                                    .FirstOrDefault();

            db.JPStudents.Remove(jPStudent);
            db.JPChecklists.Remove(jPChecklist);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
        /* private ViewResult View(object p)
         * {
         *    throw new NotImplementedException();
         * }*/

        // GET: JPStudents/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JPStudent jPStudent = db.JPStudents.Find(id);

            if (jPStudent == null)
            {
                return(HttpNotFound());
            }
            return(View(jPStudent));
        }
Exemplo n.º 7
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));
        }
Exemplo n.º 8
0
        // GET: JPStudentRundown/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JPStudent        jpstudent        = db.JPStudents.Find(id);
            JPStudentRundown jPStudentRundown = new JPStudentRundown(jpstudent);

            if (jPStudentRundown == null)
            {
                return(HttpNotFound());
            }
            return(View(jPStudentRundown));
        }
Exemplo n.º 9
0
 //public JPStudentRundown(string name, string email, string loc, int daycount, string linkedin, string port, int jpid)
 public JPStudentRundown(JPStudent student)
 {
     StudentName      = name;
     StudentEmail     = email;
     StudentLocation  = loc;
     StudentDayCount  = daycount;
     StudentLinkedIn  = linkedin;
     StudentPortfolio = port;
     JPStudentId      = jpid;
     StudentName      = student.JPName;
     StudentEmail     = student.JPEmail;
     StudentLocation  = student.JPStudentLocation.ToString();
     StudentDayCount  = student.DaysSinceStart;
     StudentLinkedIn  = student.JPLinkedIn;
     StudentPortfolio = student.JPPortfolio;
     JPStudentId      = student.JPStudentId;
 }
Exemplo n.º 10
0
        public ActionResult Create([Bind(Include = "JPStudentId,JPName,JPEmail,JPStudentLocation,JPStartDate,JPLinkedIn,JPPortfolio,JPContact")] JPStudent jPStudent)
        {
            if (ModelState.IsValid)
            {
                // Test to see if URL provided has http or https in it. If not, then save as is. If it does, strip the protocol.
                string linkedInUrl = jPStudent.JPLinkedIn;
                Regex  regexLI     = new Regex(@"^http(s)?://");
                Match  matchLI     = regexLI.Match(linkedInUrl);
                if (matchLI.Success)
                {
                    Uri    linkedInNewURL = new Uri(linkedInUrl);
                    string linkedInOutput = linkedInNewURL.Host + linkedInNewURL.PathAndQuery;
                    jPStudent.JPLinkedIn = linkedInOutput;
                }
                else
                {
                    jPStudent.JPLinkedIn = linkedInUrl;
                }

                // Test to see if URL provided has http or https in it. If not, then save as is. If it does, strip the protocol.
                string portfolioUrl = jPStudent.JPPortfolio;
                Regex  regexP       = new Regex(@"^http(s)?://");
                Match  matchP       = regexP.Match(portfolioUrl);
                if (matchP.Success)
                {
                    Uri    portfolioNewURL = new Uri(portfolioUrl);
                    string portfolioOutput = portfolioNewURL.Host + portfolioNewURL.PathAndQuery;
                    jPStudent.JPPortfolio = portfolioOutput;
                }
                else
                {
                    jPStudent.JPPortfolio = portfolioUrl;
                }

                jPStudent.JPStartDate = DateTime.Now;
                jPStudent.JPGraduated = false;
                db.JPStudents.Add(jPStudent);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(jPStudent));
        }
        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));
        }
Exemplo n.º 12
0
 //public JPStudentRundown(string name, string email, string loc, int daycount, string linkedin, string port, int totalApplications, int totalApplicationsThisWeek, int jpid, bool jpGraduated, int calculateLastContactDate, int checkListStatus)
 public JPStudentRundown(JPStudent student, int totalApplications, int totalApplicationsThisWeek, int calculateLastContactDate, int checkListStatus)
 {
     StudentName               = name;
     StudentEmail              = email;
     StudentLocation           = loc;
     StudentDayCount           = daycount;
     StudentLinkedIn           = linkedin;
     StudentPortfolio          = port;
     StudentName               = student.JPName;
     StudentEmail              = student.JPEmail;
     StudentLocation           = student.JPStudentLocation.ToString();
     StudentDayCount           = student.DaysSinceStart;
     StudentLinkedIn           = student.JPLinkedIn;
     StudentPortfolio          = student.JPPortfolio;
     TotalApplications         = totalApplications;
     TotalApplicationsThisWeek = totalApplicationsThisWeek;
     JPStudentId               = jpid;
     JPGraduated               = jpGraduated;
     JPStudentId               = student.JPStudentId;
     JPGraduated               = student.JPGraduated;
     CalculateLastContactDate  = calculateLastContactDate;
     CheckListStatus           = checkListStatus;
 }
Exemplo n.º 13
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));
        }
        public ActionResult Create([Bind(Include =
                                             "JPStudentId,JPName,JPEmail,JPStudentLocation,JPStartDate," +
                                             "JPLinkedIn,JPPortfolio,JPGithubLink,JPContact,JPGraduated,JPHired")] JPStudent jPStudent)
        {
            //if (ModelState.IsValid)
            //{
            //    db.JPStudents.Add(jPStudent);
            //    db.SaveChanges();
            //    return RedirectToAction("Index");
            //}

            //return View(jPStudent);

            if (ModelState.IsValid)
            {
                // Test to see if URL provided has http or https in it.
                // If not, then save as is. If it does, strip the protocol.
                string linkedInUrl = jPStudent.JPLinkedIn;
                Regex  regexLI     = new Regex(@"^http(s)?://");
                Match  matchLI     = regexLI.Match(linkedInUrl);
                if (matchLI.Success)
                {
                    Uri    linkedInNewURL = new Uri(linkedInUrl);
                    string linkedInOutput = linkedInNewURL.Host + linkedInNewURL.PathAndQuery;
                    jPStudent.JPLinkedIn = linkedInOutput;
                }
                else
                {
                    jPStudent.JPLinkedIn = linkedInUrl;
                }

                // Test to see if URL provided has http or https in it. If not,
                // then save as is. If it does, strip the protocol.
                string portfolioUrl = jPStudent.JPPortfolio;
                Regex  regexP       = new Regex(@"^http(s)?://");
                Match  matchP       = regexP.Match(portfolioUrl);
                if (matchP.Success)
                {
                    Uri    portfolioNewURL = new Uri(portfolioUrl);
                    string portfolioOutput = portfolioNewURL.Host + portfolioNewURL.PathAndQuery;
                    jPStudent.JPPortfolio = portfolioOutput;
                }
                else
                {
                    jPStudent.JPPortfolio = portfolioUrl;
                }

                JPLatestContact jPLatestContact = new JPLatestContact
                {
                    JPLatestContactDate = DateTime.Now,
                    ApplicationUserId   = User.Identity.GetUserId(),
                    JPLatestContactId   = Guid.NewGuid()
                };

                db.JPLatestContacts.Add(jPLatestContact);


                db.SaveChanges();

                jPStudent.JPStartDate = DateTime.Now;
                jPStudent.JPGraduated = false;
                jPStudent.JPHired     = false;

                jPStudent.ApplicationUserId = User.Identity.GetUserId();
                db.JPStudents.Add(jPStudent);
                db.SaveChanges();

                var checklist = new JPChecklist();
                checklist.ApplicationUserid = User.Identity.GetUserId();
                checklist.JPBusinessCards   = checklist.JPCleanGitHub = checklist.JPMeetups = checklist.JpRoundTables = checklist.JPUpdatedLinkedIn = checklist.JPUpdatedPortfolioSite = false;
                db.JPChecklists.Add(checklist);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(jPStudent));
        }
Exemplo n.º 15
0
 public JPStudentRundown(JPStudent jpstudent)
 {
     this.jpstudent = jpstudent;
 }
        /*      Commented out details, create and delete for now
         *
         *      // GET: JPStudentRundown/Details/5
         *      public ActionResult Details(int id)
         *      {
         *          return View();
         *      }
         *
         *      // GET: JPStudentRundown/Create
         *      public ActionResult Create()
         *      {
         *          return View();
         *      }
         *
         *      // POST: JPStudentRundown/Create
         *      [HttpPost]
         *      public ActionResult Create(FormCollection collection)
         *      {
         *          try
         *          {
         *              // TODO: Add insert logic here
         *
         *              return RedirectToAction("Index");
         *          }
         *          catch
         *          {
         *              return View();
         *          }
         *      }
         */
        // GET: JPStudentRundown/Edit/5
        public ActionResult Edit(int id)
        {
            JPStudent student = db.JPStudents.Find(id);

            return(View(student));
        }
Exemplo n.º 17
0
 public JPStudentRundown(JPStudent jpstudent, int totalApplications, int totalApplicationsThisWeek)
 {
     this.jpstudent                 = jpstudent;
     this.totalApplications         = totalApplications;
     this.totalApplicationsThisWeek = totalApplicationsThisWeek;
 }