public ActionResult Details(int id)
        {
            C.Event Event = EventService.Get(id);
            IEnumerable <C.EmployeeEvent> SubscribedEmployees = EventService.GetSubscriptionStatus(id);
            bool subscribed = false;

            foreach (C.EmployeeEvent Subscription in SubscribedEmployees)
            {
                if (Subscription.EmployeeId == SessionUser.GetUser().Id&& !(bool)Subscription.Cancelled)
                {
                    subscribed = true;
                }
            }
            DetailsForm form = new DetailsForm
            {
                Id               = (int)Event.Id,
                CreatorId        = Event.CreatorId,
                Name             = Event.Title,
                Description      = Event.Description,
                Address          = Event.Address,
                StartDate        = Event.Start,
                EndDate          = Event.End,
                CreationDate     = Event.Created,
                OpenSubscription = Event.Open,
                Subscribed       = subscribed,
                Documents        = DocumentService.GetForEvent((int)Event.Id).Select(d => new Doc.ListForm {
                    Name = d.Filename, Id = (int)d.Id
                })
            };

            return(View(form));
        }
        public ActionResult Delete(int id, DeleteForm form)
        {
            //C.Event e = new C.Event(form.Id, form.CreatorId, null, form.Name, form.Description, form.Address, form.StartDate, form.EndDate, form.CreationDate, null, form.OpenSubscription, false);
            C.Event e = new C.Event();
            e.Id = id;
            try
            {
                EventService.Delete(e, SessionUser.GetUser().Id);
            }
            catch (System.Data.SqlClient.SqlException Exception)
            {
                throw Exception;
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(int id)
        {
            C.Event    Event = EventService.Get(id);
            DeleteForm form  = new DeleteForm
            {
                Id           = (int)Event.Id,
                CreatorId    = Event.CreatorId,
                Name         = Event.Title,
                Description  = Event.Description,
                DepartmentId = Event.DepartmentId,
                Address      = Event.Address,
                StartDate    = Event.Start,
                EndDate      = Event.End,
                CreationDate = Event.Created
            };

            return(View(form));
        }
Ejemplo n.º 4
0
 internal static G.Event ToGlobal(this C.Event entity)
 {
     return(new G.Event
     {
         Id = entity.Id,
         CreatorId = entity.CreatorId,
         DepartmentId = entity.DepartmentId,
         Name = entity.Title,
         Description = entity.Description,
         Address = entity.Address,
         StartDate = entity.Start,
         EndDate = entity.End,
         CreationDate = entity.Created,
         Subscribed = entity.Subscribed,
         Open = entity.Open,
         Cancelled = entity.Cancelled
     });
 }
        public ActionResult ConfirmSubscription(int id)
        {
            C.Event     Event = EventService.Get(id);
            DetailsForm Form  = new DetailsForm
            {
                Id               = (int)Event.Id,
                CreatorId        = Event.CreatorId,
                DepartmentId     = Event.DepartmentId,
                Name             = Event.Title,
                Description      = Event.Description,
                Address          = Event.Address,
                StartDate        = Event.Start,
                EndDate          = Event.End,
                OpenSubscription = Event.Open,
                CreationDate     = Event.Created
            };

            return(View(Form));
        }
        public ActionResult Details(int id)
        {
            C.Event     Event = EventService.Get(id);
            DetailsForm form  = new DetailsForm
            {
                Id           = (int)Event.Id,
                CreatorId    = Event.CreatorId,
                Name         = Event.Title,
                Description  = Event.Description,
                Address      = Event.Address,
                StartDate    = Event.Start,
                EndDate      = Event.End,
                CreationDate = Event.Created,
                Creator      = EmployeeService.Get(Event.CreatorId),
                Department   = (Event.DepartmentId != null) ? DepartmentService.GetDepartmentById((int)Event.DepartmentId) : null
            };

            return(View(form));
        }
Ejemplo n.º 7
0
 internal static G.Event ToGlobal(this C.Event events)
 {
     return(new G.Event()
     {
         Id = events.Id,
         Name = events.Name,
         Description = events.Description,
         City = events.City,
         Street = events.Street,
         Number = events.Number,
         NumberBox = events.NumberBox,
         ZipCode = events.ZipCode,
         Country = events.Country,
         StartDate = events.StartDate,
         EndDate = events.EndDate,
         FullDay = events.FullDay,
         EmployeeId = events.EmployeeId
     });
 }
        public ActionResult Edit(int id)
        {
            C.Event Event = EventService.Get(id);
            List <SelectListItem> DepartmentList = new List <SelectListItem>
            {
                new SelectListItem
                {
                    Text  = "Toute l'entreprise",
                    Value = "-1"
                }
            };

            foreach (C.Department dep in DepartmentService.GetAllActive())
            {
                DepartmentList.Add(new SelectListItem
                {
                    Text  = dep.Title,
                    Value = dep.Id.ToString()
                });
            }
            EditForm form = new EditForm
            {
                Id                   = (int)Event.Id,
                Name                 = Event.Title,
                Description          = Event.Description,
                Address              = Event.Address,
                StartDate            = Event.Start,
                EndDate              = Event.End,
                OpenEvent            = Event.Open,
                DepartmentList       = DepartmentList,
                SelectedDepartmentId = Event.DepartmentId,
                CreatorId            = Event.CreatorId,
                Created              = Event.Created
            };

            return(View(form));
        }