Esempio n. 1
0
        protected void Application_Start()
        {
            Tex.Initialise("ClassBooking");
            Tex.AddTCPListener("10.66.97.67", "9060", false, "Jim");

            Tex.Log("App Online CB");
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
Esempio n. 2
0
 public ActionResult Delete(int id)
 {
     Tex.Log("Delete called" + id.ToString());
     try {
         GymClass gymClass = db.GymClass.Find(id);
         db.GymClass.Remove(gymClass);
         var bookings = db.MemberClassBookings.Where(cb => cb.GymClassId == id).ToList();
         db.MemberClassBookings.RemoveRange(bookings);
         db.SaveChanges();
         Tex.Log("returning");
         return(Json("", JsonRequestBehavior.AllowGet));
     } catch (Exception ex) {
         Tex.Dump(ex, "Exception GymClassController/delete");
         throw;
     }
 }
Esempio n. 3
0
        private static GymMember FindGymMember(IPrincipal user)
        {
            GymContext db = new GymContext();

            Tex.Log("Verifying Member", user.Identity.Name);
            var nameParts = user.Identity.Name.Split('\\');

            if (nameParts.Length < 1)
            {
                Tex.Log("incorrect number of name parts returned");
                return(null);
            }
            string sName = nameParts[1];

            Tex.Log("checking for ", sName);

            return(db.GymMembers.SingleOrDefault(m => m.StaffId == sName));
        }
Esempio n. 4
0
        public ActionResult Edit([Bind(Include = "GymClassId,Description,GymClassTypeId,ClassTime,ClassDate,MaxCapacity,MaxWaitList,ClassBookings,ClassWaiting")] ClassBookingDetail gymClass)
        {
            Tex.Log("Enter GymClassController/Edit");
            try {
                if (ModelState.IsValid)
                {
                    if (gymClass != null)
                    {
                        Tex.Log("Model Valid - GC ID " + gymClass.GymClassId);
                    }
                    GymClass dbClass = db.GymClass.Find(gymClass.GymClassId);
                    GymClassMapper.CopyGymClass(gymClass.ToModel(), dbClass);
                    db.Entry(dbClass).State = EntityState.Modified;

                    if (gymClass.ClassBookings != null && gymClass.ClassBookings.Any())
                    {
                        foreach (var booking in gymClass.ClassBookings)
                        {
                            db.Entry(booking).State = EntityState.Modified;
                        }
                    }
                    if (gymClass.ClassWaiting != null && gymClass.ClassWaiting.Any())
                    {
                        foreach (var booking in gymClass.ClassWaiting)
                        {
                            db.Entry(booking).State = EntityState.Modified;
                        }
                    }
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                return(View(gymClass));
            } catch (Exception ex) {
                Tex.Dump(ex, "Excetption - GymClassControler/Edit");
                throw;
            }
        }