Пример #1
0
        public static List<EventItem> SerializeJSON(List<T_Event> events)
        {
            List<EventItem> list_event = new List<EventItem>();
            foreach (T_Event ev in events)
            {
                EventItem item = new EventItem()
                {
                    Id = ev.Id,
                    StartDate = ev.DateDebut,
                    EndDate = ev.DateFin.Value,
                    Description = ev.Description,
                    Titre = ev.Titre,
                    Type = ev.Type,
                    Image = ev.Image,
                    Email = ev.Email,
                    Tel = ev.Tel,
                    Website = ev.WebSite,
                    Salle = ev.T_Location.Name,
                    Ville = ev.T_Location.Ville,
                    Pays = ev.T_Location.Pays,
                    Rue = ev.T_Location.Rue,
                    CP = ev.T_Location.CP,
                    Latitude = ev.T_Location.Latitude,
                    Longitude = ev.T_Location.Longitude
                };
                list_event.Add(item);
            }

            return list_event;
        }
Пример #2
0
 public static List<EventItem> Search(string q)
 {
     List<EventItem> list_item = new List<EventItem>();
     List<T_Event> events = DataAccess.Tag.Search(q);
     foreach (T_Event ev in events)
     {
         EventItem item = new EventItem()
         {
             CP = ev.T_Location.CP.Substring(0, 2),
             Ville = ev.T_Location.Ville,
             Salle = ev.T_Location.Name,
             Type = ev.Type,
             Description = Tool.Truncate(ev.Description),
             Email = ev.Email,
             Id = ev.Id,
             Titre = ev.Titre,
             StartDate = ev.DateDebut
         };
         Event.ServerPathImage(ev, item);
         list_item.Add(item);
     }
     return list_item;
 }
Пример #3
0
        //
        // GET : /Event/Detail/Id

        public ActionResult Detail(long id, bool creation = false)
        {
            try
            {
                DataAccess.T_Event myevent = BusinessManagement.Event.Get(id, creation);
                DataAccess.T_User me = BusinessManagement.User.GetUserByPseudo(User.Identity.Name);
                EventDetail detail = new EventDetail();
                EventItem event_item = new EventItem()
                {
                    Id = myevent.Id,
                    StartDate = myevent.DateDebut,
                    EndDate = myevent.DateFin.GetValueOrDefault(),
                    Description = myevent.Description,
                    Titre = myevent.Titre,
                    Type = myevent.Type,
                    Email = myevent.Email,
                    Valide = myevent.Valide.GetValueOrDefault(),
                    Tel = myevent.Tel,
                    Website = myevent.WebSite,
                    Salle = myevent.T_Location.Name,
                    Ville = myevent.T_Location.Ville,
                    Pays = myevent.T_Location.Pays,
                    Rue = myevent.T_Location.Rue,
                    CP = myevent.T_Location.CP,
                    Latitude = myevent.T_Location.Latitude,
                    Longitude = myevent.T_Location.Longitude
                };
                BusinessManagement.Event.ServerPathImage(myevent, event_item);

                event_item.TagList = new List<string>();
                foreach (DataAccess.T_Tag tag in myevent.T_Tag)
                {
                    event_item.TagList.Add(tag.Name);
                }
                List<EventItem> list = new List<EventItem>();
                detail.Item = event_item;
                if (User.Identity.IsAuthenticated && (BusinessManagement.Tool.IsAdmin(User.Identity.Name) || BusinessManagement.Tool.IsModerator(User.Identity.Name)))
                {

                    list = BusinessManagement.Event.GetEventForAdmin(myevent, 10);

                }
                else
                {
                    list = BusinessManagement.Event.GetListEventByUserTag(myevent, me, 10);
                }
                detail.Events = list;
                return View(detail);
            }
            catch
            {
                return View("Error");
            }
        }
Пример #4
0
 public static List<EventItem> Refresh(int first_id, string type)
 {
     List<T_Event> list = DataAccess.Event.Refresh(first_id, type);
     List<EventItem> listEventItem = new List<EventItem>();
     foreach (T_Event myevent in list)
     {
         EventItem eventItem = new EventItem()
         {
             Id = myevent.Id,
             Titre = myevent.Titre,
             Description = BusinessManagement.Tool.Truncate(myevent.Description),
             Type = myevent.Type,
             StartDate = myevent.DateDebut,
             EndDate = myevent.DateFin.GetValueOrDefault(),
             Salle = myevent.T_Location.Name,
             Email = myevent.Email,
             Tel = myevent.Tel,
             Website = myevent.WebSite,
             CP = myevent.T_Location.CP.Substring(0, 2),
             Ville = myevent.T_Location.Ville,
             Rue = myevent.T_Location.Rue
         };
         ServerPathImage(myevent, eventItem);
         listEventItem.Add(eventItem);
     }
     return listEventItem;
 }
Пример #5
0
        public static List<EventItem> GetListEventByUserTag (T_Event myevent, T_User user, int nb)
        {
            List<EventItem> listRes = new List<EventItem>();
            List<T_Event> listEvent = new List<T_Event>();

            listEvent = DataAccess.Event.GetListEventByUserTag(myevent, user, nb);
            foreach (T_Event myev in listEvent)
            {
                EventItem eventItem = new EventItem()
                {
                    Id = myev.Id,
                    Titre = myev.Titre,
                    Description = myev.Description,
                    Type = myev.Type,
                    StartDate = myev.DateDebut,
                    EndDate = myev.DateFin.GetValueOrDefault(),
                    Salle = myev.T_Location.Name,
                    Email = myev.Email,
                    Tel = myev.Tel,
                    Website = myev.WebSite,
                    CP = myev.T_Location.CP,
                    Ville = myev.T_Location.Ville,
                    Rue = myev.T_Location.Rue
                };
                ServerPathImage(myev, eventItem);
                listRes.Add(eventItem);
            }

            return listRes;
        }
Пример #6
0
 static public List<EventItem> MyEvent(string pseudo)
 {
     List<T_Event> list = DataAccess.Event.MyEvent(pseudo);
     List<EventItem> listEventItem = new List<EventItem>();
     foreach (T_Event myevent in list)
     {
         EventItem eventItem = new EventItem()
         {
             Id = myevent.Id,
             Titre = myevent.Titre,
             Description = myevent.Description,
             Type = myevent.Type,
             StartDate = myevent.DateDebut,
             EndDate = myevent.DateFin.GetValueOrDefault(),
             Salle = myevent.T_Location.Name,
             Email = myevent.Email,
             Tel = myevent.Tel,
             Website = myevent.WebSite,
             CP = myevent.T_Location.CP,
             Ville = myevent.T_Location.Ville,
             Rue = myevent.T_Location.Rue
         };
         ServerPathImage(myevent, eventItem);
         listEventItem.Add(eventItem);
     }
     return listEventItem;
 }
Пример #7
0
        static public List<EventItem> GetListNonValid ()
        {
            List<EventItem> list = new List<EventItem>();
            List<T_Event> listEvent = DataAccess.Event.GetListNonValid();

            foreach (T_Event myevent in listEvent)
            {
                EventItem myeventitem = new EventItem()
                {
                    Id = myevent.Id,
                    Titre = myevent.Titre,
                    Description = myevent.Description,
                    Type = myevent.Type,
                    StartDate = myevent.DateDebut,
                    EndDate = myevent.DateFin.GetValueOrDefault(),
                    Salle = myevent.T_Location.Name,
                    Email = myevent.Email,
                    Tel = myevent.Tel,
                    Website = myevent.WebSite,
                    CP = myevent.T_Location.CP,
                    Ville = myevent.T_Location.Ville,
                    Rue = myevent.T_Location.Rue,
                    Valide = myevent.Valide.Value
                };
                ServerPathImage(myevent, myeventitem);
                list.Add(myeventitem);    
            }
            return list;


        }
Пример #8
0
 public static void ServerPathImage(T_Event myevent, EventItem myeventitem)
 {
     if (myevent.Image != null)
     {
         var tab = myevent.Image.Split('\\');
         var path = "Download/" + tab[tab.Length - 1];
         myeventitem.Image = path;
     }
 }
Пример #9
0
 static public List<EventItem> GetListLastAddEvent(int nbr, string type = "")
 {
     List<EventItem> list_eventItem = new List<EventItem>();
     List<DataAccess.T_Event> list_event = DataAccess.Event.GetListLastAddEvent(nbr, type);
     if (list_event != null)
     {
         foreach (DataAccess.T_Event myevent in list_event)
         {
             EventItem myeventitem = new EventItem()
             {
                 Id = myevent.Id,
                 Titre = myevent.Titre,
                 Description = myevent.Description,
                 Type = myevent.Type,
                 StartDate = myevent.DateDebut,
                 EndDate = myevent.DateFin.GetValueOrDefault(),
                 Salle = myevent.T_Location.Name,
                 Image = myevent.Image,
                 Email = myevent.Email,
                 Tel = myevent.Tel,
                 Website = myevent.WebSite,
                 CP = myevent.T_Location.CP,
                 Ville = myevent.T_Location.Ville,
                 Rue = myevent.T_Location.Rue
             };
             list_eventItem.Add(myeventitem);
         }
     }
     return list_eventItem;
 }