Ejemplo n.º 1
0
        public void CreateRateSession(Rate rating)
        {
            EventAttendee et = _dbContext.EventAttendees.Where(e => e.Event_ID == rating.EventID && e.Person_ID == rating.UserID).FirstOrDefault();
            EventAttendeeRating ert = new EventAttendeeRating();
            ert.Comments = rating.Comments;
            ert.EventAttendee_ID = et.ID;
            ert.ReferralSource = rating.ReferralSource;
            ert.Refreshments = rating.RateFood;
            ert.SignIn = rating.RateSignin;
            ert.Swag = rating.RateSwag;
            _dbContext.EventAttendeeRatings.Add(ert);
            _dbContext.SaveChanges();
            foreach (RateSession rateSession in rating.RatedSessions)
            {
                EventAttendeeSessionRating erst = new EventAttendeeSessionRating();
                erst.EventAttendee_ID = et.ID;
                erst.Ranking = rateSession.Rating;
                erst.Session_ID = rateSession.SessionID;
                erst.Timeslot_ID = rateSession.TimeSlotID;
                erst.Comments = rateSession.Comments;

                _dbContext.EventAttendeeSessionRatings.Add(erst);
            }
            _dbContext.SaveChanges();
        }
Ejemplo n.º 2
0
        public ActionResult Rate(int eventid, FormCollection frm)
        {
            var rating = new Services.Rate();

            rating.UserID         = CurrentUser.ID;
            rating.EventID        = eventid;
            rating.RateSignin     = int.Parse(frm["RateSignin"]);
            rating.RateSwag       = int.Parse(frm["RateSwag"]);
            rating.RateFood       = int.Parse(frm["RateFood"]);
            rating.ReferralSource = int.Parse(frm["RefSource"]);
            rating.Comments       = frm["Comments"];

            var rateSessions = new List <Services.RateSession>();

            for (int i = 0; i < 7; i++)
            {
                if (frm[string.Format("SessionID_{0}", i)] == null)
                {
                    continue;
                }

                int sessionID = int.Parse(frm[string.Format("SessionID_{0}", i)]);

                int    timeslotID  = int.Parse(frm[string.Format("Timeslot_{0}", i)]);
                int    rankSession = int.Parse(frm[string.Format("RateSession_{0}", i)]);
                string comments    = frm[string.Format("Comments_{0}", i)];
                if (rankSession > 0)
                {
                    var rateSession = new Services.RateSession();
                    rateSession.Rating     = rankSession;
                    rateSession.SessionID  = sessionID;
                    rateSession.TimeSlotID = timeslotID;
                    rateSession.Comments   = comments;
                    rateSessions.Add(rateSession);
                }
            }
            rating.RatedSessions = rateSessions.ToList();
            service.CreateRateSession(rating);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public ActionResult Rate(int eventid, FormCollection frm)
        {
            var rating = new Services.Rate();
            rating.UserID = CurrentUser.ID;
            rating.EventID = eventid;
            rating.RateSignin = int.Parse(frm["RateSignin"]);
            rating.RateSwag = int.Parse(frm["RateSwag"]);
            rating.RateFood = int.Parse(frm["RateFood"]);
            rating.ReferralSource = int.Parse(frm["RefSource"]);
            rating.Comments = frm["Comments"];

            var rateSessions = new List<Services.RateSession>();
            for (int i = 0; i < 7; i++)
            {
                if (frm[string.Format("SessionID_{0}", i)] == null)
                    continue;

                int sessionID = int.Parse(frm[string.Format("SessionID_{0}", i)]);

                int timeslotID = int.Parse(frm[string.Format("Timeslot_{0}", i)]);
                int rankSession = int.Parse(frm[string.Format("RateSession_{0}", i)]);
                string comments = frm[string.Format("Comments_{0}", i)];
                if (rankSession > 0)
                {
                    var rateSession = new Services.RateSession();
                    rateSession.Rating = rankSession;
                    rateSession.SessionID = sessionID;
                    rateSession.TimeSlotID = timeslotID;
                    rateSession.Comments = comments;
                    rateSessions.Add(rateSession);
                }
            }
            rating.RatedSessions = rateSessions.ToList();
            service.CreateRateSession(rating);
            return RedirectToAction("Index");
        }
Ejemplo n.º 4
0
 public void CreateRateSession(Rate rating)
 {
     _sessionRepository.CreateRateSession(rating);
 }