public ActionResult GetEvent(int MemberID) { List <EventWithType> events = new List <EventWithType>(); EventWithType ewtype; using (Service1Client wcf = new Service1Client()) { var myEvents = wcf.GetMyEventList(MemberID); foreach (tblEvent e in myEvents) { ewtype = new EventWithType(); ewtype.EventID = e.EventID; ewtype.Date = e.Date; ewtype.EventName = e.EventName; ewtype.TypeOfEventID = e.TypeOfEventID; ewtype.EventType = wcf.GetOneTypeOfEvent((int)e.TypeOfEventID).EventType; events.Add(ewtype); } } Session["AddEventForMember"] = MemberID; if (events.Count == 0) { if ((bool)Session["Admin"]) { return(RedirectToAction("Create", "Event")); } TempData["Success"] = "Za ovu osobu nema podataka u bazi"; return(RedirectToAction("Index", "Event")); } return(View(events)); }
//mylist public ActionResult Index2() { var x = Session["MemberSession"] as tblMember; List <EventWithType> events = new List <EventWithType>(); EventWithType ewtype; using (Service1Client wcf = new Service1Client()) { var myEvents = wcf.GetMyEventList(x.MemberID); foreach (tblEvent e in myEvents) { ewtype = new EventWithType(); ewtype.EventID = e.EventID; ewtype.Date = e.Date; ewtype.EventName = e.EventName; ewtype.TypeOfEventID = e.TypeOfEventID; ewtype.EventType = wcf.GetOneTypeOfEvent((int)e.TypeOfEventID).EventType; events.Add(ewtype); } } if (events.Count == 0) { TempData["Success"] = "U bazi podataka ne postoje dogadjaji na kojima ste prisustvovali"; return(RedirectToAction("Create2", "Event")); } return(View(events)); }
public ExprEvent(CType type, Expr obj, EventWithType ev) : base(ExpressionKind.Event, type) { OptionalObject = obj; EventWithType = ev; }
// GET: Event1 public ActionResult Index(string search) { List <EventWithType> events = new List <EventWithType>(); EventWithType ewtype; using (Service1Client wcf = new Service1Client()) { var myEvents = wcf.GetEventList(); foreach (tblEvent e in myEvents) { ewtype = new EventWithType(); ewtype.EventID = e.EventID; ewtype.Date = e.Date; ewtype.EventName = e.EventName; ewtype.Location = e.Location; ewtype.TypeOfEventID = e.TypeOfEventID; if (e.TypeOfEventID != 0) { ewtype.EventType = wcf.GetOneTypeOfEvent((int)e.TypeOfEventID).EventType; } else { ewtype.EventType = "Nedefinisano"; } ewtype.NumberOfMember = wcf.GetNumberOfMemberOnSpecificEvent(e.EventID); events.Add(ewtype); } } if (events.Count == 0) { TempData["Success"] = "U bazi podataka ne postoje dogadjaji"; return(RedirectToAction("Create", "Event1")); } foreach (EventWithType e in events) { if (e.EventName != null) { e.EventName = e.EventName.ToUpper(); } else { e.EventName = ""; } if (e.Location != null) { e.Location = e.Location.ToUpper(); } else { e.Location = ""; } if (e.EventType != null) { e.EventType = e.EventType.ToUpper(); } else { e.EventType = ""; } } if (search != null) { return(View(events.Where(x => (x.EventName).Contains(search.ToUpper()) || (x.Location).Contains(search.ToUpper()) || (x.EventType).Contains(search.ToUpper()) || (x.NumberOfMember.ToString()).Contains(search.ToUpper()) || (x.Date.ToString()).Contains(search.ToUpper())).ToList())); } else { return(View(events)); } }