Ejemplo n.º 1
0
        public Boolean addUpdate(EventType t)
        {
            var result = from ets in db.event_types
                         where ets.event_type_id == t.event_type_id
                         select ets;

            if (result.Any())
            {
                // need to update
                event_type et = db.event_types.Single(x => x.event_type_id == t.event_type_id);

                et.title    = t.title;
                et.event_id = t.event_id;

                db.SubmitChanges();
            }
            else
            {
                // need to add
                event_type et = new event_type();

                et.event_type_id = t.event_type_id;
                et.title         = t.title;
                et.event_id      = t.event_id;

                db.event_types.InsertOnSubmit(et);

                db.SubmitChanges();
            }

            return(true);
        }
Ejemplo n.º 2
0
        private void actOnPlayer(Player p, event_type et)
        {
            switch (et)
            {
            case event_type.ADD_COIN:
                p.gold++;
                break;

            case event_type.LOSE_HEALTH:
                p.current_health--;
                break;

            case event_type.ROLL_DICE:
                //p.rollDice();
                break;

            case event_type.GAIN_HEALTH:
                p.current_health++;
                break;

            case event_type.DRAW_CARD:
                p.getCards().Add(new Card(card_type.ITEM, null, item_type.CONSUMABLE));
                break;
            }
        }
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 <event_type>(okgetResult.Value);


            var newEntity = new event_type();

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

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

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

            Assert.Equal(entity.type, result.type);
        }
Ejemplo n.º 4
0
 public void AssignSpecial(int[] rolls, event_type et)
 {
     if (!this.specialField)
     {
         this.specialCardEvents = new List <special>();
         this.specialField      = true;
     }
     this.specialCardEvents.Add(new special(rolls, et));
 }
Ejemplo n.º 5
0
        public static event_type parse_event_type(string name)
        {
            event_type ret = (event_type)c_csharp_runPINVOKE.parse_event_type(name);

            if (c_csharp_runPINVOKE.SWIGPendingException.Pending)
            {
                throw c_csharp_runPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 6
0
        public Boolean delete(Int32 id)
        {
            event_type ev = db.event_types.Single(x => x.id == id);

            db.event_types.DeleteOnSubmit(ev);

            db.SubmitChanges();

            return(true);
        }
Ejemplo n.º 7
0
        public Boolean update(EventType t)
        {
            // need to update
            event_type et = db.event_types.Single(x => x.id == t.id);

            et.event_type_id = t.event_type_id;
            et.title         = t.title;
            et.bg_color      = t.bgcolor;

            db.SubmitChanges();

            return(true);
        }
Ejemplo n.º 8
0
 public async Task <IActionResult> Put(int id, [FromBody] event_type entity)
 {
     try
     {
         if (id < 0 || !isValid(entity))
         {
             return(new BadRequestResult());
         }
         return(Ok(await agent.Update <event_type>(id, entity)));
     }
     catch (Exception ex)
     {
         return(await HandleExceptionAsync(ex));
     }
 }
Ejemplo n.º 9
0
        public Boolean add(EventType t)
        {
            // need to add
            event_type et = new event_type();

            et.event_type_id = t.event_type_id;
            et.title         = t.title;
            et.bg_color      = t.bgcolor;
            et.event_id      = t.event_id;

            db.event_types.InsertOnSubmit(et);

            db.SubmitChanges();

            return(true);
        }
Ejemplo n.º 10
0
 public async Task <IActionResult> Post([FromBody] event_type entity)
 {
     try
     {
         if (!isValid(entity))
         {
             return(new BadRequestResult());
         }
         //sm(agent.Messages);
         return(Ok(await agent.Add <event_type>(entity)));
     }
     catch (Exception ex)
     {
         //sm(agent.Messages);
         return(await HandleExceptionAsync(ex));
     }
 }
Ejemplo n.º 11
0
        public async Task Post()
        {
            //Arrange
            var entity = new event_type()
            {
                type = "TestPost"
            };


            //Act
            var response = await controller.Post(entity);

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


            Assert.Equal("TestPost", result.type);
        }
Ejemplo n.º 12
0
 public special(int[] rolls, event_type et)
 {
     this.rolls           = rolls;
     this.resulting_event = et;
 }
Ejemplo n.º 13
0
 public void set(ulong date_time, ulong point_ticks, uint lane, uint tile, uint cycle, event_type event_type, uint event_value, double elapsed_ms, ulong elapsed_ticks)
 {
     c_csharp_metricsPINVOKE.event_metric_set__SWIG_1(swigCPtr, date_time, point_ticks, lane, tile, cycle, (int)event_type, event_value, elapsed_ms, elapsed_ticks);
 }
Ejemplo n.º 14
0
        public static string to_string(event_type value)
        {
            string ret = c_csharp_runPINVOKE.to_string__SWIG_15((int)value);

            return(ret);
        }
Ejemplo n.º 15
0
 public void event_type(event_type event_type)
 {
     c_csharp_metricsPINVOKE.base_event_metric_event_type__SWIG_1(swigCPtr, (int)event_type);
 }
Ejemplo n.º 16
0
 public void set(uint lane, uint tile, uint cycle, ulong date_time, event_type event_type, uint event_value)
 {
     c_csharp_metricsPINVOKE.event_metric_set__SWIG_0(swigCPtr, lane, tile, cycle, date_time, (int)event_type, event_value);
 }
Ejemplo n.º 17
0
        public static bool is_interval_event(event_type type)
        {
            bool ret = c_csharp_run_metricsPINVOKE.is_interval_event((int)type);

            return(ret);
        }
Ejemplo n.º 18
0
        public static metric_feature_type to_feature(event_type type)
        {
            metric_feature_type ret = (metric_feature_type)c_csharp_run_metricsPINVOKE.to_feature__SWIG_2((int)type);

            return(ret);
        }
Ejemplo n.º 19
0
 public base_event_metric(uint lane, uint tile, uint cycle, event_type event_type) : this(c_csharp_metricsPINVOKE.new_base_event_metric__SWIG_0(lane, tile, cycle, (int)event_type), true)
 {
 }
Ejemplo n.º 20
0
 public eventsubscribe()
 {
     this.typeField = event_type.any;
     this.actionField = action_option.add;
     this.resource_idField = "any";
     this.resource_typeField = event_resource_type.any;
 }
Ejemplo n.º 21
0
 public void set_base(uint lane, uint tile, uint cycle, event_type event_type)
 {
     c_csharp_metricsPINVOKE.base_event_metric_set_base__SWIG_1(swigCPtr, lane, tile, cycle, (int)event_type);
 }
Ejemplo n.º 22
0
        public event_type event_type()
        {
            event_type ret = (event_type)c_csharp_metricsPINVOKE.base_event_metric_event_type__SWIG_0(swigCPtr);

            return(ret);
        }
Ejemplo n.º 23
0
 public event_metric(uint lane, uint tile, uint cycle, ulong date_time, event_type event_type, double elapsed_ms) : this(c_csharp_metricsPINVOKE.new_event_metric__SWIG_5(lane, tile, cycle, date_time, (int)event_type, elapsed_ms), true)
 {
 }