Inheritance: MonoBehaviour
        public IHttpActionResult PutLaundry(string id, Laundry laundry)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != laundry.LaundryOwner)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LaundryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public async Task <IHttpActionResult> Post(Laundry item)
        {
            db.Laundries.Add(item);
            await db.SaveChangesAsync();

            var ss = db.Laundries.Where(x => x.Id.Equals(item.Id));

            return(Ok(ss));
        }
示例#3
0
        public async Task HandleAsync(CreateLaundry command)
        {
            var laundry = new Laundry {
                Address = command.Address,
            };

            var entry = _context.Laundries.Add(laundry);
            await _context.SaveChangesAsync();

            command.Id = entry.Entity.Id;
        }
        public IHttpActionResult GetLaundry(string id)
        {
            Laundry laundry = db.Laundries.Find(id);

            if (laundry == null)
            {
                return(NotFound());
            }

            return(Ok(laundry));
        }
示例#5
0
 public void RemoveLaundry(Laundry laundry)
 {
     if (laundry == null)
     {
         return;
     }
     laundry = _context.Laundries
               .Single(x => x.Id == laundry.Id);
     _context.Laundries.Remove(laundry);
     _context.SaveChanges();
 }
        public async Task <IActionResult> Create([Bind("Id,Mode,Price")] Laundry laundry)
        {
            if (ModelState.IsValid)
            {
                laundry.Id = Guid.NewGuid();
                _context.Add(laundry);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(laundry));
        }
示例#7
0
        // PUT api/values/5
        public async Task <IHttpActionResult> Put(string id, Laundry item)
        {
            string sr  = id;//.ToString("00000");
            var    rr  = db.Laundries.Where(x => x.Id.Equals(sr));
            var    srr = rr.FirstOrDefault();

            srr.Active          = item.Active;
            db.Entry(srr).State = System.Data.Entity.EntityState.Modified;
            await db.SaveChangesAsync();

            return(Ok(srr));
        }
        public IHttpActionResult DeleteLaundry(string id)
        {
            Laundry laundry = db.Laundries.Find(id);

            if (laundry == null)
            {
                return(NotFound());
            }

            db.Laundries.Remove(laundry);
            db.SaveChanges();

            return(Ok(laundry));
        }
示例#9
0
    public static GameObject GetLaundryPrefabForLaundryType(LaundryType laundryType)
    {
        foreach (GameObject gameObject in GameManager._instance.laundryItems)
        {
            Laundry laundryObject = gameObject.GetComponent <Laundry>();

            if (laundryObject.type == laundryType)
            {
                return(gameObject);
            }
        }

        return(null);
    }
示例#10
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Laundry = await _context.Laundry.FirstOrDefaultAsync(m => m.ID == id);

            if (Laundry == null)
            {
                return(NotFound());
            }
            return(Page());
        }
示例#11
0
        public async Task <IActionResult> LaundryCreate([Bind("Id,Mode,Price")] Laundry laundry)
        {
            if (HttpContext.User.Identity.IsAuthenticated)
            {
                if (ModelState.IsValid)
                {
                    laundry.Id = Guid.NewGuid();
                    _context.Add(laundry);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(LaundryIndex)));
                }
                return(View(laundry));
            }
            return(RedirectToAction("Login"));
        }
示例#12
0
        private static ApplicationContext SeedLaundries(this ApplicationContext context)
        {
            if (!context.Laundries.Any())
            {
                var managers = new List <User>(new User[] {
                    FakeData.GenerateManager(),
                    FakeData.GenerateManager()
                });

                var clients = FakeData.GenerateClients();

                var faker = new Faker();

                var laundry = new Laundry()
                {
                    Address = faker.Address.FullAddress()
                };

                var services = FakeData.GetServices();
                context.Services.AddRange(services);
                context.SaveChanges();

                context.Laundries.Add(laundry);
                context.SaveChanges();

                var id = context.Laundries.FirstOrDefault().Id;

                var laundryServices = context.Services
                                      .Select(x => new LaundryService()
                {
                    ServiceId = x.Id, LaundryId = id
                });

                context.LaundryServices.AddRange(laundryServices);

                foreach (var manager in managers)
                {
                    manager.LaundryId = id;
                }

                context.Users.AddRange(managers);
                context.Users.AddRange(clients);
                context.SaveChanges();
            }

            return(context);
        }
示例#13
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Laundry = await _context.Laundry.FindAsync(id);

            if (Laundry != null)
            {
                _context.Laundry.Remove(Laundry);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
示例#14
0
        public Laundry AddLaundry(int dormitoryId, int position)
        {
            if (_context.Laundries.Any(x => x.DormitoryId == dormitoryId && x.Position == position))
            {
                return(null);
            }

            var laundry = new Laundry()
            {
                DormitoryId = dormitoryId,
                Position    = position,
                startTime   = new TimeSpan(15, 0, 0),
                shiftTime   = new TimeSpan(2, 0, 0),
                shiftCount  = 4
            };

            _context.Laundries.Add(laundry);
            _context.SaveChanges();
            return(laundry);
        }
示例#15
0
    public GameObject CreateInstance(Transform parent)
    {
        if (parent == null)
        {
            throw new ArgumentException("No parent supplied to create instance of LaundryItem");
        }

        GameObject prefab   = Laundry.GetLaundryPrefabForLaundryType(this.type);
        GameObject instance = Instantiate(prefab, parent.position, parent.rotation, parent);

        Laundry laundryObject = instance.GetComponent <Laundry>();

        laundryObject.color = this.colorEnum;

        SpriteRenderer spriteRenderer = instance.transform.Find("sprite").GetComponent <SpriteRenderer>();

        spriteRenderer.color = LaundryColorClass.GetInstanceFromEnum(this.colorEnum).color;

        return(instance);
    }
示例#16
0
 public static void AddLaundry(ApplicationContext database, Laundry laundry)
 {
     database.laundries.Add(laundry);
 }
示例#17
0
    void Start()
    {
        AmmoOpened = (PlayerPrefs.GetString("AmmoOpened") == "True");
        if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit" && !AmmoOpened)
        {
            AmmoOpened = true;
            PlayerPrefs.SetString("AmmoOpened", "True");

            int month = PlayerPrefs.GetInt("Month");
            int day   = PlayerPrefs.GetInt("Day");
            PlayerPrefs.SetInt("AmmoMonth", month);
            PlayerPrefs.SetInt("AmmoDay", day);
        }

        load();

        if (!isShown)
        {
            Invoke("visit", 3.0f);
        }

        if (!FriendList.Sleeping)
        {
            //default: 0,0,7
            Delta       = new TimeSpan(0, 0, 20);               // friends visit,back per 20 second
            Delta2      = new TimeSpan(0, 0, 20);               // save during 1 minute.
            SysTime     = System.DateTime.Now;
            UpdatedTime = SysTime;

            switch (myPos)
            {
            case ("bed1"):
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "crocodileVisit")
                {
                    ThisObject.transform.position = posCrocoBed;
                    crocobed.SetActive(true);
                    player.RoomBed.SetActive(false);
                }
                else
                {
                    //FriendImage.sprite = SeatImage [posNumber].sprite;
                    sprite();
                    ThisObject.transform.position = posBed1;
                }
                break;

            case ("floor1"):
                //FriendImage.sprite = SeatImage [posNumber].sprite;
                sprite();
                ThisObject.transform.position = posFloor1;
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                {
                    ThisObject.transform.position          = posAmmoFloor1;
                    cushion.GetComponent <Image>().enabled = true;
                }
                break;

            case ("floor2"):
                //FriendImage.sprite = SeatImage [posNumber].sprite;
                sprite();
                ThisObject.transform.position = posFloor2;
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                {
                    ThisObject.transform.position          = posAmmoFloor2;
                    cushion.GetComponent <Image>().enabled = true;
                }
                break;

            case ("desk"):
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "crocodileVisit")
                {
                    ThisObject.transform.position = posCrocoDesk;
                    if (PlayerPrefs.GetInt("hagendazBoughtNumber") == 0)
                    {
                        crocodesk.SetActive(true);
                    }
                    else
                    {
                        crocohagen.GetComponent <Image> ().enabled = true;
                    }
                }
                else
                {
                    //FriendImage.sprite = SeatImage [posNumber].sprite;
                    sprite();
                    ThisObject.transform.position = posDesk;
                }
                break;

            case ("laundry"):
                Laundry.SetActive(false);
                if (ShopLaundry.GetComponent <Item>().BoughtNumber > 0)
                {
                    LaundryFold.SetActive(true);
                }
                //FriendImage.sprite = SeatImage [posNumber].sprite;
                sprite();
                ThisObject.transform.position = posLaundry;
                break;
            }

            if (TimeCheck.TimeOver(Delta2))
            {
                if (FriendImage.GetComponent <Image> ().enabled == false && ItemCheck())
                {
                    visit();
                }
                else if (FriendImage.GetComponent <Image> ().enabled)
                {
                    back();
                }
            }
        }

        if (PlayerPrefs.HasKey(FriendNameVisit))
        {
            VisitCounter.text = PlayerPrefs.GetString(FriendNameVisit);
            VisitNumber       = IntParseFast(VisitCounter.text);
        }
    }
示例#18
0
 public LaundryDTO(Laundry laundry)
 {
     Id      = laundry.Id;
     Address = laundry.Address;
 }
示例#19
0
    void back()
    {
        if (UnityEngine.Random.Range(1, 100) <= BackProbability)
        {
            switch (myPos)
            {
            case ("bed1"):
                if (crocobed.activeSelf)
                {
                    crocobed.SetActive(false);
                    player.RoomBed.SetActive(true);
                }
                FriendList.bed1 = false;
                disableImage();
                break;

            case ("floor1"):
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                {
                    cushion.GetComponent <Image>().enabled = false;
                }
                FriendList.floor1 = false;
                disableImage();
                break;

            case ("floor2"):
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                {
                    cushion.GetComponent <Image>().enabled = false;
                }
                FriendList.floor2 = false;
                disableImage();
                break;

            case ("desk"):
                if (crocodesk.activeSelf)
                {
                    crocodesk.SetActive(false);
                }
                if (crocohagen.GetComponent <Image> ().enabled)
                {
                    crocohagen.GetComponent <Image> ().enabled = false;
                }
                FriendList.desk = false;
                disableImage();
                break;

            case ("laundry"):
                if (ShopLaundry.GetComponent <Item>().BoughtNumber > 0)
                {
                    Laundry.SetActive(true);
                    LaundryFold.SetActive(false);
                }
                FriendList.laundry = false;
                disableImage();
                break;

            case (""):
                //bug!!
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                {
                    cushion.GetComponent <Image> ().enabled = false;
                }
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "crocodileVisit")
                {
                    crocodesk.SetActive(false);
                    crocohagen.GetComponent <Image> ().enabled = false;
                }
                disableImage();
                break;
            }
        }

        save();
    }
示例#20
0
        public async Task <Laundry> CreateOrEdit(Laundry laundry)
        {
            try
            {
                bool newLaundry = laundry.LaundryId == 0;


                if (laundry.AddressId == 0)
                {
                    await _appDbContext.Addresses.AddAsync(laundry.Address);
                }
                else
                {
                    _appDbContext.Addresses.Update(laundry.Address);
                }

                if (laundry.BankDataId == 0)
                {
                    await _appDbContext.BankData.AddAsync(laundry.BankData);
                }
                else
                {
                    _appDbContext.BankData.Update(laundry.BankData);
                }

                if (laundry.LaundryId == 0)
                {
                    await _appDbContext.Laundries.AddAsync(laundry);
                }
                else
                {
                    _appDbContext.Laundries.Update(laundry);
                }

                await _appDbContext.SaveChangesAsync();

                laundry = await Find(laundry.LaundryId);

                //teste email
                if (newLaundry)
                {
                    var message = new EmailMessage();
                    message.Subject = "Bem vindo ao iClothes";
                    message.FromAddresses.Add(new EmailAddress()
                    {
                        Address = "*****@*****.**", Name = "Clothes"
                    });
                    message.ToAddresses.Add(new EmailAddress()
                    {
                        Address = laundry.Identity.Email, Name = laundry.NomeFantasia
                    });
                    var result = await _viewRenderService.RenderToStringAsync("EmailTemplate/BemVindoLaundry", laundry);

                    message.Content = result;
                    _emailService.Send(message);
                }
            }
            catch (Exception ex)
            {
                //delete identity
                //await _IdentityManager.Delete(new AppUser() { Id = laundry.IdentityId });
                throw ex;
            }
            return(laundry);
        }
示例#21
0
 public void UpdateLaundry(Laundry laundry)
 {
     _context.Laundries.Update(laundry);
     _context.SaveChanges();
 }
示例#22
0
        public static ApartmentMap Create()
        {
            const int width  = 8;
            const int height = 8;

            var map = new ApartmentMap();

            map.Add(new TileWalker(1, width, 1, height).Get(x => new ClickableTile("2/floor", x, false, 0)));

            map.Add(new TileWalker(0, 1, 1, height - 1).Get(x => new ClickableTile("2/wall147", x, true, 1)));
            map.Add(new TileWalker(width, 1, 1, height - 1).Get(x => new ClickableTile("2/wall369", x, true, 1)));
            map.Add(new TileWalker(1, width - 1, 0, 1).Get(x => new ClickableTile("2/wall123top", x, true, 1)));
            map.Add(new TileWalker(1, width - 1, 1, 1).Get(x => new ClickableTile("2/wall123bot", x, true, 1)));
            map.Add(new TileWalker(1, width - 1, height, 1).Get(x => new ClickableTile("2/wall789", x, true, 1)));
            map.Add(new ClickableTile("2/wall124", new TileLocation(0, 0), true, 1));
            map.Add(new ClickableTile("2/wall236", new TileLocation(width, 0), true, 1));
            map.Add(new ClickableTile("2/wall478", new TileLocation(0, height), true, 1));
            map.Add(new ClickableTile("2/wall689", new TileLocation(width, height), true, 1));

            map.Add(new ClickableTile("2/bed-top", new TileLocation(1, 2), true, () => World.Publish(new PreparingForBed()), 1));
            map.Add(new ClickableTile("2/bed-bot", new TileLocation(1, 3), true, () => World.Publish(new PreparingForBed()), 1));

            map.Add(new ClickableTile("2/laundry2", new TileLocation(2, 4), false, () => World.Publish(new HadAThought(Laundry.GetThought())), 1));

            map.Add(new ClickableTile("2/door-top", new TileLocation(width - 1, 0), false, () => World.Publish(new HadAThought(Outside.GetThought())), 2));
            map.Add(new ClickableTile("2/door-bot", new TileLocation(width - 1, 1), false, () => World.Publish(new HadAThought(Outside.GetThought())), 2));
            map.Add(new ClickableTile("2/security1", new TileLocation(width - 2, 1), false, 2));

            map.Add(new ClickableTile("2/boxofstims", new TileLocation(1, height - 2), true, () => World.Publish(new HadAThought(BottleBox.GetThought())), 2));

            map.Add(new ClickableTile("2/tv1", new TileLocation(1, 0), false, 2));

            map.Add(new ClickableTile("2/shower-top", new TileLocation(width - 1, 5), true, () => World.Publish(new HadAThought(Shower.GetThought())), 2));
            map.Add(new ClickableTile("2/shower-bot", new TileLocation(width - 1, 6), true, () => World.Publish(new HadAThought(Shower.GetThought())), 2));
            map.Add(new ClickableTile("2/sink-right", new TileLocation(width - 1, 7), true, 2));

            map.Add(new ClickableTile("2/poster1-top", new TileLocation(4, 0), false, 2));
            map.Add(new ClickableTile("2/poster1-bot", new TileLocation(4, 1), false, 2));

            map.Add(new ClickableTile("2/desk1-1", new TileLocation(width / 2 - 1, height - 3), true, () => World.Publish(new HadAThought(ComputerRig.GetThought())), 2));
            map.Add(new ClickableTile("2/desk1-2", new TileLocation(width / 2, height - 3), true, () => World.Publish(new HadAThought(ComputerRig.GetThought())), 2));
            map.Add(new ClickableTile("2/desk1-3", new TileLocation(width / 2 - 1, height - 2), true, () => World.Publish(new HadAThought(ComputerRig.GetThought())), 2));
            map.Add(new ClickableTile("2/desk1-4", new TileLocation(width / 2, height - 2), true, () => World.Publish(new HadAThought(ComputerRig.GetThought())), 2));

            var counter = new FoodCounter(new TileLocation(width - 1, 3));

            map.Add(counter.Tile);
            map.Add(counter.FoodTile);

            return(map);
        }
示例#23
0
    void visit()
    {
        if (snakeOK())
        {
            if (UnityEngine.Random.Range(1, 100) <= VisitProbability)
            {
                int i = UnityEngine.Random.Range(0, Seat.Length);
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "lionVisit" && IsPartyTime())
                {
                    i = 1;
                }
                else if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "lionVisit")
                {
                    i = 0;
                }

                switch (Seat[i])
                {
                case ("bed1"):
                    if (!FriendList.bed1)
                    {
                        // !bed2 option..
                        if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "crocodileVisit")
                        {
                            ThisObject.transform.position = posCrocoBed;
                            FriendList.bed1 = true;
                            myPos           = "bed1";
                            posNumber       = i;
                            EnableImage();
                            crocobed.SetActive(true);
                            player.RoomBed.SetActive(false);
                            player.playerPos();
                            isShown = true;
                        }
                        else
                        {
                            ThisObject.transform.position = posBed1;
                            FriendList.bed1    = true;
                            myPos              = "bed1";
                            FriendImage.sprite = SeatImage [i].sprite;
                            posNumber          = i;
                            EnableImage();
                            player.playerPos();
                            isShown = true;
                        }
                    }
                    break;

                case ("floor1"):
                    if (!FriendList.floor1)
                    {
                        FriendList.floor1             = true;
                        ThisObject.transform.position = posFloor1;
                        if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                        {
                            ThisObject.transform.position          = posAmmoFloor1;
                            cushion.GetComponent <Image>().enabled = true;
                        }
                        myPos = "floor1";
                        FriendImage.sprite = SeatImage [i].sprite;
                        posNumber          = i;
                        EnableImage();
                        player.playerPos();
                        isShown = true;
                    }
                    break;

                case ("floor2"):
                    if (!FriendList.floor2)
                    {
                        ThisObject.transform.position = posFloor2;
                        if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                        {
                            ThisObject.transform.position          = posAmmoFloor2;
                            cushion.GetComponent <Image>().enabled = true;
                        }
                        FriendList.floor2  = true;
                        myPos              = "floor2";
                        FriendImage.sprite = SeatImage [i].sprite;
                        posNumber          = i;
                        EnableImage();
                        player.playerPos();
                        isShown = true;
                    }
                    break;

                case ("desk"):
                    if (!FriendList.desk)
                    {
                        if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "crocodileVisit")
                        {
                            ThisObject.transform.position = posCrocoDesk;
                            FriendList.desk = true;
                            myPos           = "desk";
                            posNumber       = i;
                            EnableImage();
                            //crocodesk.SetActive (true);
                            if (hagendaz.GetComponent <Item> ().BoughtNumber == 0)
                            {
                                crocodesk.SetActive(true);
                            }
                            else
                            {
                                crocohagen.GetComponent <Image> ().enabled = true;
                            }
                            player.playerPos();
                            isShown = true;
                        }
                        else
                        {
                            ThisObject.transform.position = posDesk;
                            FriendList.desk    = true;
                            myPos              = "desk";
                            FriendImage.sprite = SeatImage [i].sprite;
                            posNumber          = i;
                            EnableImage();
                            player.playerPos();
                            isShown = true;
                        }
                    }
                    break;

                case ("laundry"):                                               // only lion!
                    if (!FriendList.laundry)
                    {
                        ThisObject.transform.position = posLaundry;
                        Laundry.SetActive(false);
                        if (ShopLaundry.GetComponent <Item>().BoughtNumber > 0)
                        {
                            LaundryFold.SetActive(true);
                        }
                        FriendList.laundry = true;
                        myPos = "laundry";
                        FriendImage.sprite = SeatImage [i].sprite;
                        posNumber          = i;
                        EnableImage();
                        player.playerPos();
                        isShown = true;
                    }
                    break;

                default:
//					Debug.Log ("NULL!");
                    break;
                }
            }
        }
        save();
    }