Esempio n. 1
0
 private static void FillHomelessCollection(IslandCollection islandCollection, SqlCommand cmd)
 {
     cmd.CommandText = QueryCollection.SELECT_HOMELESS_QUERY;
     using (SqlDataReader reader = cmd.ExecuteReader())
     {
         while (reader.Read())
         {
             int      id       = reader.GetInt32(0);
             string   surname  = reader.GetString(1);
             string   name     = reader.GetString(2);
             int      sex      = int.Parse(reader.GetString(3));
             DateTime birthday = reader.GetDateTime(4);
             Homeless homeless = new Homeless(id, name, surname, sex, birthday);
             if (!reader.IsDBNull(5))
             {
                 homeless.Deathday = reader.GetDateTime(4).ToString();
             }
             if (!reader.IsDBNull(6))
             {
                 homeless.Father = reader.GetString(5);
             }
             if (!reader.IsDBNull(7))
             {
                 homeless.Mother = reader.GetString(6);
             }
             islandCollection.AddHomeless(homeless);
         }
     }
 }
Esempio n. 2
0
        public async Task <int> Update(Homeless homeless)
        {
            var entity = await _dbContext.Homeless.FindAsync(homeless.Id);

            await _dbContext.SaveChangesAsync();

            return(entity.Id);
        }
Esempio n. 3
0
 private void populateEvents()
 {
     //EXAMPLE_EVENT();
     events.Add(Homeless.stealingFood(characters["Homeless"]));
     events.Add(Lady.childTantrum(characters["Lady"]));
     events.Add(Child.childTantrum(characters["Child"]));
     events.Add(Creep.creepRoam(characters["Creep"]));
     return;
 }
Esempio n. 4
0
    public static Event childTantrum(Character c)
    {
        voidFunction[] a =
        {
            () => {
                c.setMood(-1);
                if (c.isSitting())
                {
                    BusManager.instance.getSeat(BusManager.instance.getSeat(c.id)).Stand(c.gameObject);
                }
                c.desired = new Vector2(-4f, 0f); c.moving = true; c.location = -1;
            }
        };
        boolFunction[] t =
        {
            () => { return(consoleChild); }
        };

        float s = 10f;

        Outcome[] o = new Outcome[2] {
            new Outcome(new voidFunction[1] {
                new voidFunction(() => {
                    c.moveSeat(7);
                    PlayerInteraction.instance.chars["Child"].moveSeat(8);
                    c.setMood(0);
                    PlayerInteraction.instance.chars["Child"].setMood(0);
                })
            },
                        new boolFunction[1] {
                c.isSitting
            },
                        40f,
                        true),


            new Outcome(new voidFunction[1] {
                new voidFunction(() => {
                    c.setMood(-1);
                    Homeless.stopStealing(PlayerInteraction.instance.chars["Homeless"]);
                    c.moveSeat(7);
                    PlayerInteraction.instance.chars["Child"].moveSeat(8);
                    //PlayerInteraction.instance.chars["Child"].setMood(0);
                })
            },
                        new boolFunction[1] {
                new boolFunction(() => { return(c.lastTalked == PlayerInteraction.instance.chars["Player"] && Mathf.Abs(EventManager.instance.gameTime - c.timeTalked) < 5.0f); })
            },
                        20f,
                        true)
        };

        return(new Event(a, t, s, o));     //return this event
    }
        public async Task <ActionResult> Create(Homeless element)
        {
            if (element.Id == 0)
            {
                var lsit = await _service.GetAll();

                var maxId = lsit.ToList().Max(x => x.Id);
                element.Id = maxId + 1;
            }
            _service.AddElement(element);
            return(RedirectToAction("Index"));
        }
Esempio n. 6
0
        public async Task <int> Add(Homeless homeless)
        {
            try
            {
                var request = await _dbContext.Homeless.AddAsync(homeless);

                await _dbContext.SaveChangesAsync();

                return(request.Entity.Id);
            }
            catch (Exception e)
            {
                throw;
            }
        }
Esempio n. 7
0
        private async void OnSettlingItemClick(object sender, RoutedEventArgs e)
        {
            Homeless       current = _homelessListView.SelectedItem as Homeless;
            SettlingDialog dialog  = new SettlingDialog(current);
            await dialog.ShowAsync();

            if (dialog.Status == -1)
            {
                await new ContentDialog
                {
                    Title             = "Ошибка",
                    Content           = "Нарушены нормы проживания",
                    PrimaryButtonText = "Ок"
                }.ShowAsync();
                return;
            }
            await new ContentDialog
            {
                Title             = "Успех",
                Content           = "Житель заселен",
                PrimaryButtonText = "Ок"
            }.ShowAsync();
            _homelesses.Remove(current);
        }
Esempio n. 8
0
 public void AddHomeless(Homeless homeless)
 {
     _homelessCollection.Add(homeless);
 }
 public ActionResult Edit(int id, Homeless element)
 {
     _service.PutElement(id, element);
     return(RedirectToAction("Index"));
 }
Esempio n. 10
0
 public void Add(Homeless homeless)
 {
     HomelessList.Add(homeless);
 }
Esempio n. 11
0
 public SettlingDialog(Homeless homeless)
 {
     this.InitializeComponent();
     _homeless = homeless;
 }