Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        protected void taskGridView_SelectedIndexChanged(object sender, EventArgs e)
        {
            eventBO getDetails = new eventBO();

            GridViewRow row = taskGridView.SelectedRow;

            eventId = Convert.ToInt32(taskGridView.SelectedRow.Cells[0].Text);
            eventDetails.Visible = true;
            eventPanel.Visible   = false;
            events eventobj = getDetails.GetEventById(eventId);

            selectedEventLbl.Text       = eventobj.eventName.ToString();
            selectedSDateLbl.Text       = eventobj.eventSDate.ToString();
            selectedEDateLbl.Text       = eventobj.eventEDate.ToString();
            selectedSTimeLbl.Text       = eventobj.eventSTime.ToString();
            selectedETimeLbl.Text       = eventobj.eventETime.ToString();
            selectedDescripLbl.Text     = eventobj.eventDescription.ToString();
            selectedMaxCapLbl.Text      = eventobj.maxCapacity.ToString();
            selectedCcaPointsLbl.Text   = eventobj.CcaPoints.ToString();
            selectedOrionPointsLbl.Text = eventobj.Orion_Points.ToString();

            test();


            // 
        }
Ejemplo n.º 2
0
        protected void editBtn_Click(object sender, EventArgs e)
        {
            if (taskGridView.SelectedIndex < 0)
            {
                ///Label1.Text = "Please select a event";
            }
            else
            {
                eventBO getDetails = new eventBO();
                events  eventobj   = getDetails.GetEventById(eventId);
                String  user_Id    = Request.Cookies["CurrentLoggedInUser"].Value;
                eventId = int.Parse(taskGridView.SelectedRow.Cells[0].Text);

                Session["eventIdSession"]     = eventId;
                Session["nameSession"]        = selectedEventLbl.Text;
                Session["sDateSession"]       = selectedSDateLbl.Text;
                Session["eDateSession"]       = selectedEDateLbl.Text;
                Session["sTimeSession"]       = selectedSTimeLbl.Text;
                Session["eTimeSession"]       = selectedETimeLbl.Text;
                Session["descriptionSession"] = selectedDescripLbl.Text;
                Session["maxCapSession"]      = selectedMaxCapLbl.Text;
                Session["ccaPointsSession"]   = selectedCcaPointsLbl.Text;
                Session["orionPointsSession"] = selectedOrionPointsLbl.Text;
                Session["userIdSession"]      = user_Id;


                Response.Redirect("updateEventPage.aspx");
            }
        }
Ejemplo n.º 3
0
        public async Task Put()
        {
            //Arrange
            var get = await controller.Get(1);

            var okgetResult = Assert.IsType <OkObjectResult>(get);
            var entity      = Assert.IsType <events>(okgetResult.Value);


            var newEntity = new events();

            newEntity.event_name = "isaac";
            //should test the equals Equatable for all these too
            var huh = entity.Equals(newEntity);

            entity.event_name = "editStat";
            //Act
            var response = await controller.Put(1, entity);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(response);
            var result   = Assert.IsType <events>(okResult.Value);

            Assert.Equal(entity.event_name, result.event_name);
        }
Ejemplo n.º 4
0
            static public void UseTicket(user user, ticket ticket, events events)
            {
                attended_event ae = new attended_event();

                ae.attended = 1;
                ae.eventid  = events.eventid;

                var editingUser = (from u in db.users
                                   join pt in db.purchased_tickets
                                   on u.userid equals pt.userid
                                   where u.userid == user.userid
                                   select u).Distinct().Single();

                var editingTicket = (from pt in db.purchased_tickets
                                     where pt.userid == editingUser.userid &&
                                     pt.ticketid == ticket.ticketid
                                     select pt).First();

                if (editingTicket.ticket.condition != "annual" || editingTicket.ticket.condition != "life")
                {
                    editingTicket.used = 1;
                }

                editingTicket.attended_events.Add(ae);

                db.SubmitChanges();
            }
Ejemplo n.º 5
0
        public events FillEvent(EventsOfDay eventsOfDay, events _event)
        {
            events Event;

            if (_event == null)
            {
                Event = new events();
            }
            else
            {
                Event = _event;
            }
            {
                Event.UserID      = eventsOfDay.UserId;
                Event.Comments    = eventsOfDay.Comments;
                Event.EventDesc   = eventsOfDay.EventDesc;
                Event.Date        = eventsOfDay.Date;
                Event.FactoryList = PackFactoryList(eventsOfDay);

                if (eventsOfDay.Activities.Count > 0)
                {
                    Event.State = eventsOfDay.Activities[0].ActivityKey;
                }
            }
            return(Event);
        }
Ejemplo n.º 6
0
        public JsonResult SaveEvent(events e)
        {
            var status = false;

            using (EntitiesDap db = new EntitiesDap())
            {
                if (e.Id > 0)
                {
                    //Update the event
                    var v = db.events.Where(a => a.Id == e.Id).FirstOrDefault();
                    if (v != null)
                    {
                        v.Subject     = e.Subject;
                        v.Start       = e.Start;
                        v.End         = e.End;
                        v.Description = e.Description;
                        v.IsFullDay   = e.IsFullDay;
                        v.ThemeColor  = e.ThemeColor;
                    }
                }
                else
                {
                    db.events.Add(e);
                }

                db.SaveChanges();
                status = true;
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
        protected void AllEventGridView_SelectedIndexChanged(object sender, EventArgs e)
        {
            //eventDetails.Visible = true;

            eventBO getDetails = new eventBO();

            GridViewRow row = AllEventGridView.SelectedRow;

            eventId = Convert.ToInt32(AllEventGridView.SelectedRow.Cells[0].Text);

            events eventobj = getDetails.GetEventById(eventId);
            events test     = getDetails.getNumParticipants(eventId);



            selectedEventIdLbl.Text = eventobj.eventId.ToString();
            selectedEventLbl.Text   = eventobj.eventName.ToString();
            selectedSDateLbl.Text   = eventobj.eventSDate.ToString();
            selectedEDateLbl.Text   = eventobj.eventEDate.ToString();
            selectedMaxCapLbl.Text  = eventobj.maxCapacity.ToString();
            selectedSTimeLbl.Text   = eventobj.eventSTime.ToString();
            selectedETimeLbl.Text   = eventobj.eventETime.ToString();
            selectedDescripLbl.Text = eventobj.eventDescription.ToString();
            ccaPointLbl.Text        = eventobj.CcaPoints.ToString();
            orionPointLbl.Text      = eventobj.Orion_Points.ToString();
            currentCapacLbl.Text    = test.maxCapacity.ToString();
            ccaPointLbl.Text        = eventobj.CcaPoints.ToString();
            orionPointLbl.Text      = eventobj.Orion_Points.ToString();
            participatorId          = Request.Cookies["CurrentLoggedInUser"].Value;
            idLbl.Text                = participatorId.ToString();
            creatorIdLbl.Text         = eventobj.creatorId;
            eventDetailsPanel.Visible = true;
            EventPanel.Visible        = false;
        }
Ejemplo n.º 8
0
 public IActionResult New(events newevent, string type)
 {
     if (ModelState.IsValid)
     {
         if (newevent.date > DateTime.Now)
         {
             events addevent = new events
             {
                 title       = newevent.title,
                 time        = newevent.time,
                 date        = newevent.date,
                 duration    = newevent.duration + type,
                 description = newevent.description,
                 UserId      = HttpContext.Session.GetInt32("userid").Value
             };
             _context.Add(addevent);
             _context.SaveChanges();
             return(RedirectToAction("Home"));
         }
         else
         {
             ViewBag.err = "Please input future time";
             return(View(newevent));
         }
     }
     else
     {
         return(View(newevent));
     }
 }
Ejemplo n.º 9
0
        private static void Main(string[] args)
        {
            timewarp _timewarp = new timewarp();
            events   _events   = new events();

            foreach (Event @event in _events.all())
            {
                DateTime?nullable;
                int      num;
                if (@event.timerun)
                {
                    nullable = @event.timewarp;
                    num      = nullable.HasValue ? 1 : 0;
                }
                else
                {
                    num = 0;
                }
                if (num != 0)
                {
                    nullable = @event.last_timerun;
                    var dif     = (DateTime.Now - Convert.ToDateTime((object)@event.last_timerun));
                    int minutes = !nullable.HasValue ? 1 : (dif.Minutes == 0 ? 1 : dif.Minutes);
                    _timewarp.runtime(@event.id, minutes);
                }
            }
        }
Ejemplo n.º 10
0
        // POST api/student
        public HttpResponseMessage Post(events Event)
        {
            string msg = "";

            if (Event.eventDate > Event.checkIn)
            {
                msg = "Check In: " + Event.checkIn.ToShortDateString() + " before event Date: " + Event.eventDate.ToShortDateString() + "?";
            }
            else if (Event.checkOut > Event.eventDate)
            {
                msg = "Check Out: " + Event.checkOut.ToShortDateString() + " after event Date: " + Event.eventDate.ToShortDateString() + "?";
            }

            if (msg.Length > 0)
            {
                var    response = Request.CreateResponse(HttpStatusCode.InternalServerError, msg);
                string url      = Url.Link("DefaultApi", new { msg });
                response.Headers.Location = new Uri(url);
                return(response);
            }
            else
            {
                EventsRepository.InsertEvent(ref Event);
                var    response = Request.CreateResponse(HttpStatusCode.Created, Event);
                string url      = Url.Link("DefaultApi", new { Event.id });
                response.Headers.Location = new Uri(url);
                return(response);
            }
        }
Ejemplo n.º 11
0
        static public events GetEvent(int EventId)
        {
            // create our NHibernate session factory
            var sessionFactory = FluentNHibernate.CreateSessionFactory();

            events evt = null;

            using (var session = sessionFactory.OpenSession())
            {
                // retreive all stores and display them
                using (session.BeginTransaction())
                {
                    try
                    {
                        // This never worked. I would use entity framework next time.
                        evt = session.CreateCriteria(typeof(events))
                              .Add(NHibernate.Criterion.Restrictions.Eq("id", EventId))
                              .UniqueResult <events>();
                        //evt =  session.Get<events>(EventId);
                    }
                    catch (Exception Ex)
                    { // for some reason doesn't take the first time!!
                      //  return session.CreateCriteria(typeof(events)).List<events>();
                        string msg = Ex.ToString();
                        return(null);
                    }
                }
            }

            Mapper.CreateMap <events, events>();
            events evt2 = Mapper.Map <events, events>(evt);

            return(evt2);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// On Add or Edit, if the "EventPictureFile" is provided then this
        /// function will save it to disk and update the "eventpictureurl" property
        /// of the events class instance.
        /// </summary>
        /// <param name="events"></param>
        private void SaveEventPictureAndUpdateEvent(ref events events)
        {
            if (events.EventPictureFile != null)
            {
                byte[] buffer = new byte[events.EventPictureFile.ContentLength];
                events.EventPictureFile.InputStream.Read(buffer, 0, events.EventPictureFile.ContentLength);

                // ensure folder exists
                if (!Directory.Exists(Server.MapPath("~/uploads")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/uploads"));
                }
                if (!Directory.Exists(Server.MapPath("~/uploads/events")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/uploads/events"));
                }

                // save file to disk
                string fileName       = string.Format("{0}_{1}", DateTime.Now.ToString("yyyyMMddhhmmss"), events.EventPictureFile.FileName);
                string filePath       = string.Format("/uploads/events/{0}", fileName);
                string mappedFilePath = Server.MapPath(string.Format("~{0}", filePath));
                events.EventPictureFile.SaveAs(mappedFilePath);

                // update model
                events.eventpictureurl = filePath;
            }
        }
Ejemplo n.º 13
0
        public JsonResult GetEvents()
        {
            try
            {
                string myUrl = "http://www.shoprite.com/health-events/";
                HtmlWeb web = new HtmlWeb();
                HtmlDocument doc = web.Load(myUrl);

                List<events> eventList = new List<events>();

                var theseEvents = doc.DocumentNode.SelectNodes("//p[@class='pageheadline']/a");

                if (theseEvents != null)
                {
                    foreach (var item in theseEvents)
                    {
                        events e = new events();
                        e.store = item.InnerText;
                        e.link = item.Attributes["href"].Value;
                        eventList.Add(e);
                    }
                }
                
                return Json(new
                {
                    status = "ok",
                    eventList
                }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception e)
            {

                throw;
            }
        }
Ejemplo n.º 14
0
        // POST api/inventory
        //public HttpResponseMessage Post(List<order> ords)
        public events Post(events evt)
        {
            //DetailsRepository.saveAll(ords);
            DetailsRepository.saveAll(evt);

            var sessionFactory = FluentNHibernate.CreateSessionFactory();

            using (var session = sessionFactory.OpenSession())
            {
                // retreive all stores and display them
                using (session.BeginTransaction())
                {
                    evt = session.Load <events>(evt.id);

                    IList <order> ord = evt.orderList.ToList();

                    foreach (order o in ord)
                    {
                        o.orderEvent = null;
                    }
                }
            }

            return(evt);
            //string msg = "Items updated";
            //var response = Request.CreateResponse(HttpStatusCode.Created, evt);
            //string url = Url.Link("DefaultApi", new { evt.id });
            //response.Headers.Location = new Uri(url);
            //return response;
        }
Ejemplo n.º 15
0
        static public void saveAll(events evt)
        {
            // create our NHibernate session factory
            var sessionFactory = FluentNHibernate.CreateSessionFactory();

            using (var session = sessionFactory.OpenSession())
            {
                // retreive all stores and display them
                using (session.BeginTransaction())
                {
                    foreach (order o in evt.orderList)
                    {
                        o.checkin    = evt.checkIn;
                        o.checkout   = evt.checkOut;
                        o.orderEvent = evt;
                    }


                    session.SaveOrUpdate(evt);

                    /*
                     * foreach (order ord in ords)
                     * {
                     *  session.Update(ord);
                     * }
                     */

                    session.Transaction.Commit();

                    InventoryAvailability.Set(evt.id);
                }
            }
        }
Ejemplo n.º 16
0
        public async Task <IActionResult> Put(int id, [FromBody] events entity)
        {
            try
            {
                if (id < 0 || !isValid(entity))
                {
                    return(new BadRequestResult());                            // This returns HTTP 404
                }
                //sm(agent.Messages);

                var loggedInMember = LoggedInUser();
                if (loggedInMember == null)
                {
                    return(new BadRequestObjectResult("Invalid input parameters"));
                }
                entity.last_updated    = DateTime.Now;
                entity.last_updated_by = loggedInMember.member_id;

                return(Ok(await agent.Update <events>(id, entity)));
            }
            catch (Exception ex)
            {
                //sm(agent.Messages);
                return(await HandleExceptionAsync(ex));
            }
        }
Ejemplo n.º 17
0
        public ActionResult BoardEvents(BoardEventsViewModel boardEventsParam, int delete = 0)
        {
            var boardEvents = boardEventsParam;

            if (ModelState.IsValid)
            {
                if (delete == 1)
                {
                    List <ElementaryActivity> activities = boardEvents.EventsOfDay.Activities.ToList();
                    activities.RemoveAll(item => item.Check == true);
                    boardEvents.EventsOfDay.Activities = activities;
                }

                events Event = eventService.GetEventsByDayAndUserId(boardEvents.EventsOfDay.Date, boardEvents.EventsOfDay.UserId);
                if (Event == null)
                {
                    Event = eventService.CreateFilledEvent(boardEvents.EventsOfDay);
                }
                else
                {
                    Event = eventService.FillEvent(boardEvents.EventsOfDay, Event);
                }
                eventService.UpdateEvent(Event);
            }
            boardEvents.Factories = dataService.GetFactoryList();

            if (delete == 1)
            {
                return(RedirectToAction("BoardEvents", new { dateParam = boardEvents.EventsOfDay.Date, userId = boardEvents.EventsOfDay.UserId }));
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 18
0
        public ActionResult AddActivity(ElementaryActivity activity, DateTime date, string userId)
        {
            if (ModelState.IsValid)
            {
                events Event       = eventService.GetEventsByDayAndUserId(date, userId);
                var    eventsOfDay = eventService.GetUserEventsOfDay(date, userId);
                eventsOfDay.Activities.Add(activity);
                Event = eventService.FillEvent(eventsOfDay, Event);
                if (Event.ID != null)
                {
                    eventService.UpdateEvent(Event);
                }
                else
                {
                    Event.ID = Guid.NewGuid().ToString();
                    eventService.AddEvent(Event);
                }

                return(RedirectToAction("BoardEvents", new { userId = userId, dateParam = date }));
            }
            //       return RedirectToAction("Index");
            ViewBag.Date      = date;
            ViewBag.UserId    = userId;
            ViewBag.States    = EventHelper.States;
            ViewBag.Factories = dataService.GetFactoryList();
            return(View(activity));
        }
Ejemplo n.º 19
0
        // PUT api/Events/5
        public async Task <IHttpActionResult> Putevents(int id, events events)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != events.bkno)
            {
                return(BadRequest());
            }

            db.Entry(events).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!eventsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 20
0
        public BaseTran <events> GeteventsList(int?src, int?level, long?begin_t, long?end_t)
        {
            BaseTran <events> send = new BaseTran <events>();
            List <events>     lst  = new List <events>();

            foreach (var item in dict)
            {
                events Val  = item.Value.Clone();
                events data = null;

                if (src != null)
                {
                    if (Val.src == src)
                    {
                        data = Val.Clone();
                    }
                    else
                    {
                        data = null;
                    }
                }

                if (level != null)
                {
                    if (Val.level == level)
                    {
                        data = Val.Clone();
                    }
                    else
                    {
                        data = null;
                    }
                }

                if (begin_t != null && end_t != null)
                {
                    if (Val.t >= begin_t && Val.t <= end_t)
                    {
                        data = Val.Clone();
                    }
                    else
                    {
                        data = null;
                    }
                }

                if (data != null)
                {
                    lst.Add(data);
                }
            }


            send.total = lst.Count;
            send.msg   = "ok";
            send.data  = lst;

            return(send);
        }
Ejemplo n.º 21
0
 public void AddEvent(events _event)
 {
     _entities.Context.events.Add(_event);
     if (_event.ID != null && _event.ID != "00000000-0000-0000-0000-000000000000")
     {
         SaveChanges();
     }
 }
Ejemplo n.º 22
0
        public override global::System.Data.DataSet Clone()
        {
            events cln = ((events)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Ejemplo n.º 23
0
        public ActionResult DeleteConfirmed(int id)
        {
            events events = db.events.Find(id);

            db.events.Remove(events);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 24
0
        /* <summary></summary>
         * <param name="ID"></param>
         * <returns></returns>
         * <author></author>
         */
        public static List <events> SearchEventsByName(events eventName)
        {
            var db     = new VERK2015_H17Entities1();
            var bEvent = (from x in db.events.Where(y => y.event_name.Contains(eventName.event_name))
                          select x).ToList();

            return(bEvent);
        }
Ejemplo n.º 25
0
        //load into student sign up grid.
        public List <events> getsignUpEventList(String participatorId)
        {
            SqlDataAdapter da;
            DataSet        ds = new DataSet();

            //declare list to hold collection of events objs
            List <events> eventList = new List <events>();

            //retrieve conn string from web config
            //done at class level

            //sql commant to select data from table
            StringBuilder sqlCommand = new StringBuilder();

            // sqlCommand.AppendLine("SELECT eventName, eventSDate ,FORMAT(eventSTime,'hh:mm tt') AS eventSTime, eventEDate,");
            //sqlCommand.AppendLine("eventETime, eventDescription, maxCapacity, eventName, eventSDate ,FORMAT(eventSTime,'hh:mm tt') AS eventSTime, eventEDate,");
            sqlCommand.AppendLine("Select eventId, eventName, eventSDate,eventEDate,eventSTime, eventETime");

            sqlCommand.AppendLine("from eventSignUp where participatorId = @paraparticipatorId");

            //Instantiate sqlcommnd instance
            SqlConnection objsqlconn = new SqlConnection(DBConnect);

            //RETRIEVE RECORD USING DATAADAPTER
            da = new SqlDataAdapter(sqlCommand.ToString(), objsqlconn);
            da.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;
            da.SelectCommand.CommandType = CommandType.Text;
            da.SelectCommand.Parameters.AddWithValue("@paraparticipatorId", participatorId);
            //fill dataset to table
            da.Fill(ds, "myEventsGV");

            //if no record, set list to null
            int count = ds.Tables["myEventsGV"].Rows.Count;

            if (count == 0)
            {
                eventList = null;
            }
            else
            {
                // Step 7 : Iterate DataRow to extract table column tdTerm and tdRate and
                //          create interestRte instance and add the instance to a List collection
                foreach (DataRow row in ds.Tables["myEventsGV"].Rows)
                {
                    events objEvent = new events();
                    objEvent.eventId    = Convert.ToInt32(row["eventId"]);
                    objEvent.eventName  = Convert.ToString(row["eventName"]);
                    objEvent.eventSDate = Convert.ToString(row["eventSDATE"]);
                    objEvent.eventEDate = Convert.ToString(row["eventEDATE"]);
                    objEvent.eventSTime = Convert.ToString(row["eventSTime"]);
                    objEvent.eventETime = Convert.ToString(row["eventETime"]);

                    eventList.Add(objEvent);
                }
            }

            return(eventList);
        }
    public void Zoom(bool zoomIn)
    {
        events val = (zoomIn) ? events.ZoomIn : events.ZoomOut;
        string log = (zoomIn) ? "Sending zoom in" : "Sending zoom out";

        Debug.Log(log);
        SendPack(129, 129, (int)val, 0);
        receiveToBytes();
    }
    public void Tap(bool down, int x, int y)
    {
        events val = (down) ? events.MousePress: events.MouseRelease;
        string log = (down) ? "Mouse down" : "Mouse up";

        Debug.Log(log);
        SendPack(x, y, (int)val, 0);
        receiveToBytes();
    }
    public void ModKey(int x, int y, bool down, keys key)
    {
        events val = (down) ? events.ModKeyDown : events.ModKeyUp;
        string log = "Modifier Key pressed";

        Debug.Log(log);
        SendPack(x, y, (int)val, (int)key);
        receiveToBytes();
    }
Ejemplo n.º 29
0
        //get details of event joined
        //to retrieve specific event
        public events GetEventJoinedById(int eventId, String participatorId)
        {
            SqlDataAdapter da;
            DataSet        ds = new DataSet();

            //declare list to hold collection of events objs
            events theevent = new events();

            //retrieve conn string from web config
            //done at class level

            //sql commant to select data from table
            StringBuilder sqlCommand = new StringBuilder();

            // sqlCommand.AppendLine("SELECT eventName, eventSDate ,FORMAT(eventSTime,'hh:mm tt') AS eventSTime, eventEDate,");
            //sqlCommand.AppendLine("eventETime, eventDescription, maxCapacity, eventName, eventSDate ,FORMAT(eventSTime,'hh:mm tt') AS eventSTime, eventEDate,");
            sqlCommand.AppendLine("Select * ");
            sqlCommand.AppendLine("from eventSignUp where eventId= '" + eventId + "' and participatorId = '" + participatorId + "' ");

            //Instantiate sqlcommnd instance
            SqlConnection objsqlconn = new SqlConnection(DBConnect);

            //RETRIEVE RECORD USING DATAADAPTER
            da = new SqlDataAdapter(sqlCommand.ToString(), objsqlconn);

            //fill dataset to table
            da.Fill(ds, "theTable");

            //if no record, set list to null
            int count = ds.Tables["theTable"].Rows.Count;

            if (count == 0)
            {
                theevent = null;
            }
            else
            {
                // Step 7 : Iterate DataRow to extract table column tdTerm and tdRate and
                //          create interestRte instance and add the instance to a List collection
                foreach (DataRow row in ds.Tables["theTable"].Rows)
                {
                    theevent.eventId          = Convert.ToInt32(row["eventId"]);
                    theevent.eventName        = Convert.ToString(row["eventName"]);
                    theevent.eventSDate       = Convert.ToString(row["eventSDATE"]);
                    theevent.eventEDate       = Convert.ToString(row["eventEDATE"]);
                    theevent.eventSTime       = Convert.ToString(row["eventSTime"]);
                    theevent.eventETime       = Convert.ToString(row["eventETime"]);
                    theevent.eventDescription = Convert.ToString(row["eventDescription"]);
                    //theevent.maxCapacity = Convert.ToInt32(row["maxCapacity"]);
                    theevent.CcaPoints    = Convert.ToInt32(row["CCAPoints"]);
                    theevent.Orion_Points = Convert.ToInt32(row["Orion_Points"]);
                    //  theevent.participatorId = Convert.ToString(row["participatorId"]);
                }
            }

            return(theevent);
        }
Ejemplo n.º 30
0
 //INSERT
 public bool commitInsert(events ev)
 {
     using (objEvents)
     {
         objEvents.events.InsertOnSubmit(ev);
         objEvents.SubmitChanges();
         return(true);
     }
 }
Ejemplo n.º 31
0
 public void invoke(events.PhysicalAttackEvent eventObject)
 {
     if (eventObject.Origin.Equals(this.owner))
     {
         //If on air shit or whatever & prend quelque merda
         owner.changeState(EntityState.Attacking, true, true);
         owner.changeState(EntityState.IsAvailable, false, false);
         owner.changeIntProperty(EntityProperty.Action, ActionsList.Attack, true);
     }
 }
Ejemplo n.º 32
0
 public void invoke(events.DeadEvent eventArgs)
 {
     this.areaItems.Remove(eventArgs.DeadEntity);
 }
Ejemplo n.º 33
0
    protected void PageSize(Object sender, EventArgs e)
    {
        // items().rowlimit = Convert.ToInt16(drplstPageSize.SelectedValue.ToString());

            string dir = "current";

            events ev = new events();

            pagestatus.row = Convert.ToInt16(((DropDownList)sender).SelectedValue.ToString());//dir;

            BLItems.raise(sender, EventArgs.Empty);

           /// navigate(sender, pagestatus);

            //  pagestatus.page = Convert.ToInt16(drplstPageSize.SelectedValue.ToString());

            //  pagestatus.row = Convert.ToInt16(drplstPageSize.SelectedValue.ToString());

          ///  messages.raise(sender, EventArgs.Empty);

         //   NavigationLink_Click(dir);
    }
Ejemplo n.º 34
0
        // DELETE
        public static bool DeleteEvent(events ev)
        {
            events eventToDelete = GetEventById(ev.Id);

            eventToDelete.IsDeleted = true;

            int affectedRows;
            try
            {
                affectedRows = Context.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                foreach (DbEntityValidationResult item in ex.EntityValidationErrors)
                {
                    // Get entry

                    DbEntityEntry entry = item.Entry;
                    string entityTypeName = entry.Entity.GetType().Name;

                    // Display or log error messages

                    foreach (DbValidationError subItem in item.ValidationErrors)
                    {
                        string message = string.Format("Error '{0}' occurred in {1} at {2}",
                                 subItem.ErrorMessage, entityTypeName, subItem.PropertyName);
                        Console.WriteLine(message);
                    }
                    // Rollback changes

                    switch (entry.State)
                    {
                        case EntityState.Added:
                            entry.State = EntityState.Detached;
                            break;
                        case EntityState.Modified:
                            entry.CurrentValues.SetValues(entry.OriginalValues);
                            entry.State = EntityState.Unchanged;
                            break;
                        case EntityState.Deleted:
                            entry.State = EntityState.Unchanged;
                            break;
                    }
                }

                return false;
            }

            return affectedRows > 0;
        }
Ejemplo n.º 35
0
        // UPDATE
        public static int UpdateEvent(events ev)
        {
            events eventToUpdate = GetEventById(ev.Id);

            eventToUpdate.Title = ev.Title;
            eventToUpdate.Description = ev.Description;
            eventToUpdate.Summary = ev.Summary;
            eventToUpdate.Other = ev.Other;
            eventToUpdate.Location = ev.Location;
            eventToUpdate.ImageUrl = ev.ImageUrl;
            eventToUpdate.EventUrl = ev.EventUrl;
            eventToUpdate.DayEvent = ev.DayEvent;
            eventToUpdate.StartDate = ev.StartDate;
            eventToUpdate.EndDate = ev.EndDate;
            eventToUpdate.TargetGroup = ev.TargetGroup;
            eventToUpdate.ApproximateAttendees = ev.ApproximateAttendees;
            eventToUpdate.DisplayInCommunity = ev.DisplayInCommunity;
            eventToUpdate.subcategories = ev.subcategories;
            //if (eventToUpdate.associationsinevents.Count() != 0)
            //{
            //    for (int i = 0; i < eventToUpdate.associationsinevents.Count(); i++)
            //    {
            //        eventToUpdate.associationsinevents.Remove(eventToUpdate.associationsinevents.ElementAt(i));
            //        Database.Context.associationsinevents.AddOrUpdate(eventToUpdate.associationsinevents.ElementAt(i));
            //    }
            //}
            //foreach (var associationsinevents in ev.associations)
            //{
            //    eventToUpdate.associations.Add(associationsinevents);
            //}
            eventToUpdate.associations = ev.associations;
            eventToUpdate.communities = ev.communities;

            int affectedRows;

            try
            {
                affectedRows = Context.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                foreach (DbEntityValidationResult item in ex.EntityValidationErrors)
                {
                    // Get entry

                    DbEntityEntry entry = item.Entry;
                    string entityTypeName = entry.Entity.GetType().Name;

                    // Display or log error messages

                    foreach (DbValidationError subItem in item.ValidationErrors)
                    {
                        string message = string.Format("Error '{0}' occurred in {1} at {2}",
                                 subItem.ErrorMessage, entityTypeName, subItem.PropertyName);
                        Console.WriteLine(message);
                    }
                    // Rollback changes

                    switch (entry.State)
                    {
                        case EntityState.Added:
                            entry.State = EntityState.Detached;
                            break;
                        case EntityState.Modified:
                            entry.CurrentValues.SetValues(entry.OriginalValues);
                            entry.State = EntityState.Unchanged;
                            break;
                        case EntityState.Deleted:
                            entry.State = EntityState.Unchanged;
                            break;
                    }
                }

                return affectedRows = 0;
            }
            Context.Entry(eventToUpdate).Reload();
            return affectedRows;
        }
Ejemplo n.º 36
0
        // ADD
        public static bool AddEvent(events ev)
        {
            Context.events.Add(ev);
            try
            {
                Context.SaveChanges();
            }
                //catch (DbEntityValidationException ex)
                //{
                //    using (var sw = new StreamWriter(File.Open(@"C:\Users\Robin\Desktop\myfile2.txt", FileMode.CreateNew), Encoding.GetEncoding("iso-8859-1")))
                //    {
                //        foreach (var str in ex.EntityValidationErrors)
                //        {
                //            foreach (var valErr in str.ValidationErrors)
                //            {
                //                sw.WriteLine(str.Entry + "###" + valErr.PropertyName + "###" + valErr.ErrorMessage);
                //            }

                //        }
                //    }
                //}
            catch (DbUpdateException dbEx)
            {
                return false;
            }
            catch (DbEntityValidationException ex)
            {
                foreach (DbEntityValidationResult item in ex.EntityValidationErrors)
                {
                    // Get entry

                    DbEntityEntry entry = item.Entry;
                    string entityTypeName = entry.Entity.GetType().Name;

                    // Display or log error messages

                    foreach (DbValidationError subItem in item.ValidationErrors)
                    {
                        string message = string.Format("Error '{0}' occurred in {1} at {2}",
                                 subItem.ErrorMessage, entityTypeName, subItem.PropertyName);
                        Console.WriteLine(message);
                    }
                    // Rollback changes

                    switch (entry.State)
                    {
                        case EntityState.Added:
                            entry.State = EntityState.Detached;
                            break;
                        case EntityState.Modified:
                            entry.CurrentValues.SetValues(entry.OriginalValues);
                            entry.State = EntityState.Unchanged;
                            break;
                        case EntityState.Deleted:
                            entry.State = EntityState.Unchanged;
                            break;
                    }
                }
                return false;
            }
            Context.Entry(ev).Reload();
            return true;
        }
Ejemplo n.º 37
0
 protected internal bool HasListenerForTyp(events.EventType eventType)
 {
     if (_listeners is List<IListener> && _listeners.Count > 0)
         foreach (IListener listener in _listeners)
             if (listener.ListensFor(eventType))
                 return true;
     return false;
 }