public IHttpActionResult GetDispensary(int id) { Dispensary dispensary = db.Dispensaries.Find(id); if (dispensary == null) { return(NotFound()); } return(Ok(new { dispensary.DispensaryId, dispensary.CompanyName, dispensary.WeedMapMenu, dispensary.Street, dispensary.UnitNo, dispensary.City, dispensary.State, dispensary.ZipCode, dispensary.Email, dispensary.Phone, dispensary.Zone, dispensary.StatePermit, dispensary.PermitExpirationDate })); }
public void AddStartJar() { List <StoreObjectReference> containerObjects = db.GetProducts(StoreObjectReference.productType.container); GameObject jar = Instantiate(containerObjects[1].gameObject_); ProductGO productGO = jar.GetComponent <ProductGO>(); productGO.objectID = containerObjects[1].objectID; StorageJar storageJar = new StorageJar(containerObjects[1], jar); storageJar.uniqueID = Dispensary.GetUniqueProductID(); storageJar.objectID = containerObjects[1].objectID; productGO.product = storageJar; productGO.canHighlight = true; jar.GetComponent <Jar>().product = storageJar; List <Bud> toAdd = new List <Bud>(); Strain toUse = db.GetRandomStrain(); for (int i = 0; i < 28; i++) { GameObject bud = new GameObject("Bud"); Bud newBud = bud.AddComponent <Bud>(); newBud.strain = toUse; newBud.weight = UnityEngine.Random.Range(.65f, 1.35f); newBud.weight = Mathf.Round(newBud.weight * 100f) / 100f; // Round to 2 decimal places jar.GetComponent <Jar>().AddBud(bud); bud.transform.position = Vector3.zero; toAdd.Add(newBud); } storageJar.AddBud(toAdd); ShelfPosition jarPosition = dm.dispensary.Storage_cs[0].GetRandomStorageLocation(storageJar); jar.transform.position = jarPosition.transform.position; jar.transform.parent = jarPosition.transform; jarPosition.shelf.parentShelf.AddProduct(storageJar); }
public IHttpActionResult GetDispensaryInventory(int dispensaryId) { Dispensary dispensary = db.Dispensaries.Find(dispensaryId); if (dispensary == null) { return(NotFound()); } return(Ok(new { Inventory = dispensary.Inventories.Select(i => new { i.InventoryId, i.DispensaryId, i.Mobile, i.Inv_Gram, i.Inv_TwoGrams, i.Inv_Eigth, i.Inv_Quarter, i.Inv_HalfOnce, i.Inv_Ounce, i.Inv_Each }) })); }
public Product CreateProduct(StoreObjectReference container, Box.PackagedBud bud) { // Create a container and put packaged bud into it GameObject newContainer = Instantiate(container.gameObject_); newContainer.transform.position = bud.parentBox.transform.position; ProductGO productGO = newContainer.GetComponent <ProductGO>(); if (container.proType == StoreObjectReference.productType.jar) { StorageJar storageJar = new StorageJar(container, newContainer); storageJar.uniqueID = Dispensary.GetUniqueProductID(); productGO.product = storageJar; float incrementValue = 1; List <Bud> newBuds = new List <Bud>(); while (bud.weight > 0) { if (bud.weight - 1 < 0) { incrementValue = bud.weight; } GameObject budGO = new GameObject(bud.strain.name + " Nug"); budGO.transform.SetParent(newContainer.transform); budGO.transform.localPosition = Vector3.zero; Bud newBud = budGO.AddComponent <Bud>(); newBud.strain = bud.strain; newBud.weight = incrementValue; newBuds.Add(newBud); bud.weight -= incrementValue; } print("Adding buds"); storageJar.AddBud(newBuds); return(storageJar); } return(null); }
public IHttpActionResult PutDispensary(int id, Dispensary dispensary) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dispensary.DispensaryId) { return(BadRequest()); } db.Entry(dispensary).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DispensaryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void OnSpawn(bool enterStore) { // If spawning outside the store if (dm == null) { Start(); } if (enterStore) { enteringStore = true; dispensary = GameObject.Find("Dispensary").GetComponent <Dispensary>(); StoreObjectFunction_Doorway target = dispensary.Main_c.GetRandomEntryDoor(); pathfinding.currentAction = CustomerPathfinding.CustomerAction.enteringStore; pathfinding.GetOutdoorPath(target.transform.position, OnEnterStore); } else { enteringStore = false; int rand = UnityEngine.Random.Range(0, 6); Vector3 targetPos = dm.gameObject.GetComponent <CustomerManager>().customerSpawnLocations[rand].transform.position; pathfinding.currentAction = CustomerPathfinding.CustomerAction.bypassingStore; pathfinding.GetOutdoorPath(targetPos); } pathfinding.speed = UnityEngine.Random.Range(4.20f, 7f); SetupDesired(); pathfinding.outside = true; }
private int AddDispensary(DispensaryModel dispensary, Dispensary entity) { foreach (string zip in dispensary.ApprovalZipCodes.Split(',')) { string trimmedZip = zip.Trim(); if (!String.IsNullOrEmpty(trimmedZip)) { entity.ApprovalZipCodes.Add(HGContext.ZipCodes.Add(new ZipCode() { Code = trimmedZip })); } } foreach (string zip in dispensary.DeliveryZipCodes.Split(',')) { string trimmedZip = zip.Trim(); if (!String.IsNullOrEmpty(trimmedZip)) { entity.DeliveryZipCodes.Add(HGContext.ZipCodes.Add(new ZipCode() { Code = trimmedZip })); } } HGContext.Dispensaries.Add(entity); var id = HGContext.SaveChanges(); return(id); }
public async Task RegisterDispensary([FromBody] Dispensary dispensary) { string s = JsonConvert.SerializeObject(dispensary); Console.WriteLine(s); await _dispensaryService.AddDispensaryAsync(dispensary); }
public IHttpActionResult GetDispensaryCustomers(int dispensaryId) { Dispensary dispensary = db.Dispensaries.Find(dispensaryId); if (dispensary == null) { return(NotFound()); } return(Ok(new { Customers = dispensary.Customers.Select(c => new { c.CustomerId, c.DispensaryId, c.FirstName, c.LastName, c.Street, c.UnitNo, c.City, c.State, c.ZipCode, c.Email, c.Phone, c.Gender, c.DateOfBirth, c.Age, c.MedicalReason, c.DriversLicense, c.MmicId, c.MmicExpiration, c.DoctorLetter }), })); }
public IHttpActionResult GetOrder(int dispensaryId) { Dispensary dispensary = db.Dispensaries.Find(dispensaryId); if (dispensary == null) { return(NotFound()); } return(Ok(new { Order = dispensary.Orders.OrderByDescending(o => o.OrderDate).Select(o => new { o.OrderId, o.DispensaryOrderNo, o.DispensaryId, o.DriverId, DriverInfo = new { o.DriverId, o.Driver.FirstName, o.Driver.LastName }, o.CustomerId, o.CustomerAddressId, CustomerInfo = new { o.Customer.FirstName, o.Customer.LastName, o.Customer.Email, o.Customer.Phone }, ProductOrders = o.ProductOrders.Select(p => new { p.ProductOrderId, p.MenuCategoryId, p.CategoryName, p.ProductId, p.ProductName, p.OrderQty, p.Price, p.Units, p.Discount, p.TotalSale }), o.OrderDate, o.DeliveryNotes, o.PickUp, o.Street, o.UnitNo, o.City, o.State, o.ZipCode, o.itemQuantity, o.TotalOrderSale, o.OrderStatus }) })); }
public async Task AddDispensaryAsync(Dispensary dispensary) { string dispensaryAsJson = JsonConvert.SerializeObject(dispensary); HttpContent content = new StringContent(dispensaryAsJson, Encoding.UTF8, "application/json"); await client.PutAsync(uri + "/Dispensary", content); }
public DispensarySchedule(Dispensary dispensary_) { dispensary = dispensary_; openingHour = 6; openingMinute = 0; openingAM = true; closingHour = 6; closingMinute = 0; closingAM = false; }
public void saveDispensary(Dispensary dispensary, string saveName) { //need to add check for if there already exists a save game (in other script) BinaryFormatter bf = new BinaryFormatter(); using (FileStream fs = new FileStream(("Saves" + @"\" + saveName), FileMode.OpenOrCreate)) { bf.Serialize(fs, dispensary); } }
public ActionResult SearchCity(string city) { Dictionary <string, object> model = new Dictionary <string, object> { }; List <Dispensary> allDispensaries = Dispensary.FindByCity(city); model.Add("dispensaries", allDispensaries); model.Add("city", city); return(View(model)); }
public ActionResult Show(int id) { List <Comment> foundComments = Comment.GetCommentsByLicense(id); Dispensary foundDispensary = Dispensary.FindByLicense(id); Dictionary <string, object> model = new Dictionary <string, object> { }; model.Add("dispensary", foundDispensary); model.Add("comments", foundComments); return(View(model)); }
public IHttpActionResult GetDispensary(int id) { Dispensary dispensary = db.Dispensaries.Find(id); if (dispensary == null) { return(NotFound()); } return(Ok(new { dispensary.DispensaryId, dispensary.CompanyName, TotalCustomers = dispensary.Customers.Count(), TotalExpirations = customerRepository.GetNumberOfExpiredCustomersForDispensary(id), DriversWorking = driverRepository.GetNumberOfDriversWorkingForDispensary(id), DriversOff = driverRepository.GetNumberOfDriversOffForDispensary(id), OrdersDelivered = orderRepository.GetNumberOfOrdersDeliveredForDispensary(id), OrdersPendingDelivery = orderRepository.GetNumberOfPendingDeliveryOrdersForDispensary(id), CurrentDaySales = orderRepository.GetCurrentDaySalesForDispensary(id), CurrentMonthSales = orderRepository.GetCurrentMonthSalesForDispensary(id), StackBarGraph = new { Title = "Sales Summary", Ranges = new { TW = "This Week", LW = "Last Week", W2 = "2 Weeks Ago" }, MainChart = new object[] { new { Key = "Daily Sales", Values = new { TW = graphDataRepository.GetChartDataForThisWeekSalesForDispensary(id), LW = graphDataRepository.GetChartDataForLastWeekSalesForDispensary(id), W2 = graphDataRepository.GetChartDataForLastTwoWeeksSalesForDispensary(id) } }, new { Key = "Daily Orders", Values = new { TW = graphDataRepository.GetChartDataForThisWeekOrdersForDispensary(id), LW = graphDataRepository.GetChartDataForLastWeekOrdersForDispensary(id), W2 = graphDataRepository.GetChartDataForLastTwoWeeksOrdersForDispensary(id) } } } } })); }
public IHttpActionResult PostDispensary(Dispensary dispensary) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Dispensaries.Add(dispensary); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = dispensary.DispensaryId }, dispensary)); }
public ActionResult Index() { string cityName = "Seattle"; Dictionary <string, object> model = new Dictionary <string, object> { }; List <Dispensary> allDispensaries = Dispensary.GetAll(); List <Dispensary> allAddresses = Dispensary.GetAddresses(cityName); model.Add("dispensaries", allDispensaries); model.Add("addresses", allAddresses); return(View(model)); }
public void Delete([FromUri] int id) { Dispensary dispensary = HGContext.Dispensaries.Include(d => d.DispensaryProducts).FirstOrDefault(d => d.Id == id); foreach (DispensaryProduct product in dispensary.DispensaryProducts) { product.IsDeleted = true; } dispensary.IsDeleted = true; HGContext.SaveChanges(); }
public List <AvailableComponent> GetAvailableComponents() { DispensaryManager dm = GameObject.Find("DispensaryManager").GetComponent <DispensaryManager>(); Dispensary dispensary = dm.dispensary; List <AvailableComponent> availableComponents = new List <AvailableComponent>(); int storageCount = dispensary.GetStorageCount(); if ((storageCount + 1) < dispensary.maxStorageCount) { storageCount++; availableComponents.Add(new AvailableComponent("Storage", (storageCount == 0) ? 6500 : (storageCount == 1) ? 14000 : 25000)); // Price for components where the number is limited but greater than 1 will increase with each purchase } int growCount = dispensary.GetGrowroomCount(); if ((growCount + 1) < dispensary.maxGrowroomCount) { growCount++; availableComponents.Add(new AvailableComponent("Growroom", (growCount == 0) ? 25000 : (growCount == 1) ? 60000 : 125000)); // Price for components where the number is limited but greater than 1 will increase with each purchase } int processingCount = dispensary.GetProcessingCount(); if ((processingCount + 1) < dispensary.maxProcessingCount) { processingCount++; availableComponents.Add(new AvailableComponent("Processing", (processingCount == 0) ? 25000 : (processingCount == 1) ? 60000 : 125000)); // Price for components where the number is limited but greater than 1 will increase with each purchase } int hallwayCount = dispensary.GetHallwayCount(); if ((hallwayCount + 1) < dispensary.maxHallwayCount) { hallwayCount++; availableComponents.Add(new AvailableComponent("Hallway", (hallwayCount == 0) ? 5000 : (hallwayCount == 1) ? 6000 : (hallwayCount == 2) ? 7500 : (hallwayCount == 3) ? 10000 : (hallwayCount == 4) ? 15000 : 22500)); // Price for components where the number is limited but greater than 1 will increase with each purchase } foreach (string comp in dispensary.absentComponents) { switch (comp) { case "GlassShop": availableComponents.Add(new AvailableComponent("GlassShop", 30000)); break; case "SmokeLounge": availableComponents.Add(new AvailableComponent("SmokeLounge", 10000)); break; case "Workshop": availableComponents.Add(new AvailableComponent("Workshop", 30000)); break; } } return(availableComponents); }
public void AddStartBox() { List <StoreObjectReference> boxModels = db.GetProducts(StoreObjectReference.productType.box); GameObject box = Instantiate(boxModels[1].gameObject_); ProductGO productGO = box.GetComponent <ProductGO>(); productGO.objectID = boxModels[1].objectID; StorageBox storageBox = new StorageBox(boxModels[1], box); storageBox.uniqueID = Dispensary.GetUniqueProductID(); storageBox.objectID = boxModels[1].objectID; productGO.product = storageBox; productGO.canHighlight = true; box.GetComponent <Box>().product = storageBox; List <Product> toAdd = new List <Product>(); List <StoreObjectReference> bongs = db.GetProducts(StoreObjectReference.productType.glassBong); // Add bongs to box /*for (int i = 0; i < 4; i++) * { * GameObject bongGO = Instantiate(bongs[0].gameObject_); * bongGO.GetComponent<Glass>().height = 16f; * ProductGO productGO_ = bongGO.GetComponent<ProductGO>(); * productGO_.objectID = bongs[0].objectID; * Bong newBong = new Bong(bongGO); * newBong.parentProduct = storageBox; * newBong.objectID = bongs[0].objectID; * productGO_.product = newBong; * productGO_.canHighlight = false; * bongGO.gameObject.SetActive(false); * toAdd.Add(newBong); * box.GetComponent<Box>().AddProduct(newBong); * } * storageBox.AddProducts(toAdd);*/ Box parentBox = box.GetComponent <Box>(); Box.PackagedProduct newPackagedProduct = new Box.PackagedProduct(parentBox, bongs[4], 8); parentBox.AddProduct(newPackagedProduct); Strain toUse = db.GetStrain("Trainwreck"); // Temp add bud to starting box. eventually will contain pipes, bowls, and rolling papers to start Box.PackagedBud newBud = new Box.PackagedBud(parentBox, toUse, 88); parentBox.AddBud(newBud); ShelfPosition boxPosition = dm.dispensary.Storage_cs[0].GetRandomStorageLocation(storageBox); box.transform.position = boxPosition.transform.position; box.transform.parent = boxPosition.transform; boxPosition.shelf.parentShelf.AddProduct(storageBox); }
public ActionResult Show(int license) { List <Comment> foundComments = Comment.GetCommentsByLicense(license); Dispensary foundDispensary = Dispensary.FindByLicense(license); string name = foundDispensary.GetName(); Scraper foundScraper = Scraper.FindByName(name); Dictionary <string, object> model = new Dictionary <string, object> { }; model.Add("dispensary", foundDispensary); model.Add("comments", foundComments); model.Add("scraper", foundScraper); return(View(model)); }
public ActionResult CreateComment(int license, string review, int rating) { Comment newComment = new Comment(review, rating, license); newComment.Save(); List <Comment> foundComments = Comment.GetCommentsByLicense(license); Dispensary foundDispensary = Dispensary.FindByLicense(license); Dictionary <string, object> model = new Dictionary <string, object> { }; model.Add("dispensary", foundDispensary); model.Add("comments", foundComments); return(View("Show", model)); }
public void SortStack(Vector3 pos, bool activate, bool removePlaceholder) { if (uniqueID == -1) { uniqueID = Dispensary.GetUniqueProductID(); } List <Box> noDuplicates = boxList.Distinct(new BoxComparer()).ToList(); boxList = noDuplicates; if (activate) { ShowStack(); } else { HideStack(); } if (removePlaceholder) { Destroy(placeholderStack.gameObject); } boxList.Sort(SortBoxes); int counter = 0; foreach (Box box in boxList) { box.transform.SetParent(transform); if (counter == 0) { if (handTruck != null) { SetStackOrigin(true); transform.position = pos; box.transform.localPosition = new Vector3(0, 0, 0); } else { SetStackOrigin(false); transform.position = pos; box.transform.localPosition = new Vector3(0, 0, 0); } } else { box.transform.position = boxList[counter - 1].stackAttachPoint.transform.position; } counter++; } }
public void SingleDispensaryRequestTest() { //ARRANGE var dispensary = new Dispensary(); //ACT dispensary = DispensaryController.GetDispensary("ca", "san-francisco", "grass-roots"); //ASSERT Assert.IsNotNull(dispensary); Assert.IsTrue(dispensary.IsValid()); Assert.IsTrue(dispensary.Name == "Grass Roots"); //OUTPUT Console.WriteLine("Dispensary: " + dispensary.Name); }
bool carriedOutAction = false; // if the current action is changed and onthink detects it, it will call the necessary pathfinding // method then set the boolean to true, until changed again IEnumerator OnThink() { while (true) { //print("Thinking: " + currentAction); if (!carriedOutAction) { switch (currentAction) { case StaffAction.awaitingJobAction: DetermineJobAction(); carriedOutAction = true; break; case StaffAction.performingJobAction: // do nothing, this shouldnt land here ever anyways print("Performing job action"); break; case StaffAction.finishedJobAction: DetermineFinishedJobAction(); //print("Calling finished action"); carriedOutAction = true; break; case StaffAction.enteringStore: Dispensary dispensary = GameObject.Find("Dispensary").GetComponent <Dispensary>(); StoreObjectFunction_Doorway target = dispensary.Main_c.GetRandomEntryDoor(); GetOutdoorPath(target.transform.position); carriedOutAction = true; break; case StaffAction.leavingStore: GeneratePathToExitDoorway(); carriedOutAction = true; break; case StaffAction.waiting: print(staff.parentStaff.staffName + " has no job"); carriedOutAction = true; break; } } yield return(new WaitForSeconds(.2f)); // thinks 5 times per second } }
public void AddStoreObject(StoreObject newStoreObject) { try { if (!CheckAgainstList(newStoreObject) || newStoreObject.uniqueID == -1) { storeObjects.Add(newStoreObject); newStoreObject.uniqueID = Dispensary.GetUniqueStoreObjectID(); } newStoreObject.gameObject.transform.parent = storeObjectsParent.transform; } catch (NullReferenceException) { storeObjects = new List <StoreObject>(); AddStoreObject(newStoreObject); } }
public List <CompatibleObject> GetComponentObjects() { DispensaryManager dm = GameObject.Find("DispensaryManager").GetComponent <DispensaryManager>(); Dispensary dispensary = dm.dispensary; string component = dispensary.GetSelected(); if (component == string.Empty) { } List <CompatibleObject> objects = new List <CompatibleObject>(); foreach (StoreObjectReference obj in dm.database.GetComponentObjects(dispensary.GetSelected())) { objects.Add(new CompatibleObject(obj.productName, obj.gameObject_, obj.objectID, 100)); } return(objects); }
public Box CreateBox(int orderWeight) { StoreObjectReference currentBoxReference = GetBox(orderWeight); GameObject newProductBox = Instantiate(currentBoxReference.gameObject_); ProductGO productGO = newProductBox.GetComponent <ProductGO>(); productGO.objectID = currentBoxReference.objectID; StorageBox storageBox = new StorageBox(currentBoxReference, newProductBox); storageBox.objectID = currentBoxReference.objectID; storageBox.uniqueID = Dispensary.GetUniqueProductID(); productGO.product = storageBox; productGO.canHighlight = true; newProductBox.GetComponent <Box>().product = storageBox; newProductBox.GetComponent <Box>().currentWeight = 0; newProductBox.GetComponent <Box>().maxWeight = currentBoxReference.boxWeight; return(newProductBox.GetComponent <Box>()); }
public Dispensary_s CreateNewDispensary(string dispensaryName) { GameObject temp = new GameObject("TempDispensary"); Dispensary disp = temp.AddComponent <Dispensary>(); dispensaryCount++; int buildingNumber = buildingCount; disp.SetupDispensary(dispensaryName, buildingNumber, true); //GameObject.Find("Manager").GetComponent<MainMenuManager>().PrintObject(dispensaryCount); Dispensary_s disp_s = disp.MakeSerializable(); disp_s.dispensaryNumber = dispensaryCount; dispensaries.Add(disp_s); GameObject.Find("Manager").GetComponent <MainMenuManager>().DestroyObject(temp); disp_s.parentCompanyName = companyName; return(disp_s); }