예제 #1
0
        public void CreateOrUpdate(TrashCollector trashCollector)
        {
            //TODO: ADD AUTOMAPPER AND COPY OBJECT
            TrashCollectorEntity existedTrashCollector = this.repository.FindByKey(trashCollector.Id);

            if (existedTrashCollector != null)
            {
                existedTrashCollector.StartTimeSpan  = trashCollector.StartTime;
                existedTrashCollector.EndTimeSpan    = trashCollector.EndTime;
                existedTrashCollector.WeekDays       = trashCollector.WeekDays;
                existedTrashCollector.ZipCodes       = trashCollector.ZipCodes;
                existedTrashCollector.MonthlyPayment = trashCollector.MonthlyPayment;
                existedTrashCollector.UserId         = trashCollector.UserId;
                this.repository.Update(existedTrashCollector);
                return;
            }

            var updateTrashCollector =
                new TrashCollectorEntity
            {
                Id             = trashCollector.Id,
                StartTimeSpan  = trashCollector.StartTime,
                EndTimeSpan    = trashCollector.EndTime,
                WeekDays       = trashCollector.WeekDays,
                ZipCodes       = trashCollector.ZipCodes,
                MonthlyPayment = trashCollector.MonthlyPayment,
                UserId         = trashCollector.UserId
            };

            this.repository.Insert(updateTrashCollector);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            TrashCollector trashCollector = db.TrashCollector.Find(id);

            db.TrashCollector.Remove(trashCollector);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: TrashCollectors/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TrashCollector trashCollector = db.TrashCollector.Find(id);

            if (trashCollector == null)
            {
                return(HttpNotFound());
            }
            return(View(trashCollector));
        }
 public ActionResult Create(TrashCollector trashCollector)
 {
     if (trashCollector.id == 0)
     {
         db.SaveChanges();
         db.TrashCollector.Add(trashCollector);
     }
     else
     {
         var trashCollecterInDB = db.TrashCollector.Single(m => m.id == trashCollector.id);
     }
     db.SaveChanges();
     return(View(trashCollector));
 }
예제 #5
0
    public void Start()
    {
        _tempPhotos = new List <Progress.Fish>();

        _rb             = GetComponent <Rigidbody2D>();
        _trashCollector = GetComponent <TrashCollector>();
        _playerMovement = GetComponent <PlayerMovement>();
        _oxygen         = GetComponent <Oxygen>();
        _playerPhotos   = GetComponentInChildren <PlayerPhotos>();

        updateAllLevels();

        resetTransform();
    }
        // GET: TrashCollectors/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TrashCollector trashCollector = db.TrashCollector.Find(id);

            if (trashCollector == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Customerid = new SelectList(db.Customers, "id", "Name", trashCollector.Customerid);
            return(View(trashCollector));
        }
예제 #7
0
    private void Start()
    {
        currentHealth  = healthPerStage;
        trashCollector = GameObject.Find("Coding_Trash").GetComponent <TrashCollector>();

        FindMovableChildren(transform);

        if (transform.Find("Stages"))
        {
            hasStages = true;
            foreach (Transform trans in transform.Find("Stages"))
            {
                stages.Add(trans.gameObject);
                trans.gameObject.SetActive(false);
            }

            stages[0].SetActive(true);
        }
    }
예제 #8
0
        public IEnumerable <Customer> GetCustomersByCollector(TrashCollector trashCollector)
        {
            if (trashCollector == null)
            {
                return(new List <Customer>());
            }

            string weekDay = DateTime.Now.DayOfWeek.ToString();
            var    trashCollectionEntities = this.repository.FindBy(customer => trashCollector.ZipCodes.Contains(customer.ZipCode.ToString()) &&
                                                                    trashCollector.WeekDays.Contains(weekDay) && customer.WeekDays.Contains(weekDay) &&
                                                                    (customer.NotCollectFrom == null && customer.NotCollectTo == null ? true : (customer.NotCollectFrom == null
                                                                                                                                                                        ? DbFunctions.TruncateTime(DateTime.Today) > DbFunctions.TruncateTime(customer.NotCollectTo)
                                                                                                                                                                        : customer.NotCollectTo == null
                                                                                                                                                                            ? DbFunctions.TruncateTime(DateTime.Today) < DbFunctions.TruncateTime(customer.NotCollectFrom)
                                                                                                                                                                            : DbFunctions.TruncateTime(customer.NotCollectFrom) > DbFunctions.TruncateTime(DateTime.Today) || DbFunctions.TruncateTime(customer.NotCollectTo) < DbFunctions.TruncateTime(DateTime.Today))))
                                             .Select(item => item.ToDomainObject());


            return(trashCollectionEntities);
        }
        public ActionResult Edit(TrashCollector trashCollector)
        {
            var trashCollectorInDB = db.TrashCollector.Single(m => m.id == trashCollector.id);

            return(RedirectToAction("Index", "Trash Collectors"));
        }
        // GET: TrashCollectors/Create
        public ActionResult Create()
        {
            TrashCollector trashCollector = new TrashCollector();

            return(View(trashCollector));
        }
예제 #11
0
 private void Start()
 {
     trashCollector = GameObject.Find("Coding_Trash").GetComponent <TrashCollector>();
 }
예제 #12
0
    public void Initialize()
    {
        Physics.IgnoreLayerCollision(9, 12);

        if (GameObject.Find("DataManager"))
        {
            DataManager dataManager = GameObject.Find("DataManager").GetComponent <DataManager>();
            health = Mathf.RoundToInt(health * dataManager.GetGameValue(EGame_Values_Keys.PLAYER_HEALTH_MODIFIER));
        }

        healthDefault = health;

        cannonballCounter = GameObject.Find("Cannonball_Counter").GetComponent <Text>();
        cannonballImage   = GameObject.Find("Cannonball_Image").GetComponent <RawImage>();

        trashCollector = GameObject.Find("Coding_Trash").GetComponent <TrashCollector>();
        gameManager    = GameObject.Find("GameManager").GetComponent <GameManager>();

        boxCol          = GetComponent <BoxCollider>();
        healthText      = GameObject.Find("health_text").GetComponent <Text>();
        healthText.text = "Health: " + health.ToString();

        audioSources = GetComponents <AudioSource>();
        animator     = GetComponent <Animator>();

        if (PlayerPrefs.HasKey("AutoShoot"))
        {
            if (PlayerPrefs.GetInt("Autoshoot") == 1)
            {
                autoshoot = true;
            }
        }

        if (PlayerPrefs.HasKey("AimAssist"))
        {
            if (PlayerPrefs.GetInt("AimAssist") == 1)
            {
                aimAssist.SetActive(true);
            }
            else
            {
                aimAssist.SetActive(false);
            }
        }

        if (PlayerPrefs.HasKey("Dash_Upgrade") == true)
        {
            if (PlayerPrefs.GetInt("Dash_Upgrade") == 1)
            {
                ableToDash = true;
            }
        }

        int count = 0;

        foreach (Player_Ammunition ammo in cannonballPrefabs)
        {
            if (PlayerPrefs.HasKey(ammo.amountPrefKey) == true)
            {
                if (PlayerPrefs.GetInt(ammo.amountPrefKey) > 0)
                {
                    cannonballIndex = count;
                    break;
                }
            }
            count++;
        }

        cannonballCounter.text = PlayerPrefs.GetInt(cannonballPrefabs[cannonballIndex].amountPrefKey).ToString();
    }