public bool GenerateRackLocations(Domain domain, string sectionLabel, int startingBay, int numberOfBays, int numberOfShelves) { // Append to an existing section if it exists. Section section = AreaRepository.GetSectionByLabel(domain.Session, sectionLabel); // If section doesnt exist then create it if (section == null) { section = domain.CreateSection(sectionLabel); } if (!new RackLocationGenerationValidator(domain, section, numberOfBays, numberOfShelves, startingBay).Validated()) { return(false); } for (int i = startingBay; i < startingBay + numberOfBays; i++) { Bay bay = section.CreateBay(i); for (int j = 1; j <= numberOfShelves; j++) { bay.CreateShelf(j); } } return(true); }
protected override void Seed(FairviewMall.Framework.DAL.MallContext context) { // Seeding means we populate the database with data. // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. char bayNumber = 'A'; for (int count = 0; count < 15; count++) { string id = "Bay-" + (char)(bayNumber + count); var bay = new Bay { // this is an Initializer List BayID = id, FloorSpace = 800 }; if (count == 3 || count == 12) { bay.ReservedUse = "Bathrooms"; } // Add this to our database context.Bays.AddOrUpdate(bay); } }
public void DeallocateBay(Bay bay) { bay.carStatus = Bay.CarStatus.EMPTY; bay.currentCar.CarLeave(); bay.currentCar.thisBay = null; bay.currentCar = null; }
public int DeleteBay(Bay objBay) { int result = 0; using (IDbConnection connection = OpenConnection(dataConnection)) { string sql = @" Update Bay Set isActive=0 WHERE BayId=@BayId"; try { var id = connection.Execute(sql, objBay); objBay.BayId = id; result = 0; InsertLoginHistory(dataConnection, objBay.CreatedBy, "Delete", "Bay", objBay.BayId.ToString(), "0"); } catch (SqlException ex) { int err = ex.Errors.Count; if (ex.Errors.Count > 0) // Assume the interesting stuff is in the first error { switch (ex.Errors[0].Number) { case 547: // Foreign Key violation result = 1; break; default: result = 2; break; } } } return(result); } }
public void setCurrQueue() { var queuedShiments = from x in db.Shipments where x.ShipmentStatusID == 2 orderby x.BayID group x by x.BayID into grp select new { BayID = grp.Select(y => y.BayID).Distinct().FirstOrDefault().Value, count = grp.Count() }; var queueCount = (from b in db.Bays select new { ID = b.BayID, Queue = 0 }).AsEnumerable().Select(x => new Bay { BayID = x.ID, CurrQueue = x.Queue }).ToList(); foreach (var ship in queuedShiments) { queueCount.Where(x => x.BayID == ship.BayID).FirstOrDefault().CurrQueue = ship.count; } foreach (var bayNo in queueCount) { Bay bay = db.Bays.Where(x => x.BayID == bayNo.BayID).FirstOrDefault <Bay>(); bay.ModifiedDate = DateTime.Now; bay.CurrQueue = bayNo.CurrQueue; db.Bays.Attach(bay); db.Entry(bay).Property(x => x.ModifiedDate).IsModified = true; db.Entry(bay).Property(x => x.CurrQueue).IsModified = true; } db.SaveChanges(); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Bay bay) { if (id != bay.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bay); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BayExists(bay.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(bay)); }
//list all Tools in selected Bay public IActionResult Details(int id) { Bay bay = db.Bays.Include(x => x.Tool).ThenInclude(x => x.Certification).ThenInclude(x => x.OperatorCertifications).ThenInclude(x => x.Oper).FirstOrDefault(x => x.BayId == id); BayDetailVM VM = new BayDetailVM(bay); return(View(VM)); }
public Bay InsertBay(Bay objBay) { using (IDbConnection connection = OpenConnection(dataConnection)) { var result = new Bay(); IDbTransaction trn = connection.BeginTransaction(); string sql = @"INSERT INTO Bay (BayRefNo,BayName,BayType,CreatedBy,CreatedDate,OrganizationId,IsService) VALUES(@BayRefNo,@BayName,@BayType,@CreatedBy,@CreatedDate,@OrganizationId,@IsService); SELECT CAST(SCOPE_IDENTITY() as int)"; try { int internalid = DatabaseCommonRepository.GetInternalIDFromDatabase(connection, trn, typeof(Bay).Name, "0", 1); objBay.BayRefNo = "B/" + internalid; int id = connection.Query <int>(sql, objBay, trn).Single(); objBay.BayId = id; //connection.Dispose(); InsertLoginHistory(dataConnection, objBay.CreatedBy, "Create", "Bay", internalid.ToString(), "0"); trn.Commit(); } catch (Exception ex) { trn.Rollback(); objBay.BayId = 0; objBay.BayRefNo = null; } return(objBay); } }
public void BayAvailableFalseTest() { Bay b1 = new Bay("B00001"); b1.Vehicle = "V00001"; Assert.AreEqual(false, b1.Available); }
public ActionResult Edit(Bay model) { model.OrganizationId = OrganizationId; model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); var repo = new BayRepository(); bool isexists = repo.IsFieldExists(repo.ConnectionString(), "Bay", "BayName", model.BayName, "BayId", model.BayId); if (!isexists) { var result = new BayRepository().UpdateBay(model); if (result.BayId > 0) { TempData["Success"] = "Updated Successfully!"; TempData["BayRefNo"] = result.BayRefNo; return(RedirectToAction("Create")); } else { FillBayType(); TempData["error"] = "Oops!!..Something Went Wrong!!"; TempData["BayRefNo"] = null; return(View("Create", model)); } } else { FillBayType(); TempData["error"] = "This Name Alredy Exists!!"; TempData["BayRefNo"] = null; return(View("Create", model)); } }
private void ConnectBedsidesToDB(ref Bay currentBay) { int BayNumber = currentBay.BayNumber; label1.Text = $"Bay {currentBay.BayNumber}"; bedsideInfoControl1.AssignPatient(currentBay.GetBedside(1).patient); bedsideInfoControl1.PatientPageCall = delegate { PatientPageCall(BayNumber, 1); }; bedsideInfoControl2.AssignPatient(currentBay.GetBedside(2).patient); bedsideInfoControl2.PatientPageCall = delegate { PatientPageCall(BayNumber, 2); }; bedsideInfoControl3.AssignPatient(currentBay.GetBedside(3).patient); bedsideInfoControl3.PatientPageCall = delegate { PatientPageCall(BayNumber, 3); }; bedsideInfoControl4.AssignPatient(currentBay.GetBedside(4).patient); bedsideInfoControl4.PatientPageCall = delegate { PatientPageCall(BayNumber, 4); }; bedsideInfoControl5.AssignPatient(currentBay.GetBedside(5).patient); bedsideInfoControl5.PatientPageCall = delegate { PatientPageCall(BayNumber, 5); }; bedsideInfoControl6.AssignPatient(currentBay.GetBedside(6).patient); bedsideInfoControl6.PatientPageCall = delegate { PatientPageCall(BayNumber, 6); }; bedsideInfoControl7.AssignPatient(currentBay.GetBedside(7).patient); bedsideInfoControl7.PatientPageCall = delegate { PatientPageCall(BayNumber, 7); }; bedsideInfoControl8.AssignPatient(currentBay.GetBedside(8).patient); bedsideInfoControl8.PatientPageCall = delegate { PatientPageCall(BayNumber, 8); }; }
public void CommitButtonClick() { if (EditMode) { foreach (var multiBlock in temporaryPlacements) { if (!multiBlock.CanPlaceTemporary) { return; } } Bay bay = GameObject.FindWithTag("Bay").GetComponent <Bay>(); foreach (var multiBlock in temporaryPlacements) { multiBlock.commitTemporaryStructure(); bay.updateStructure(multiBlock); } CommitButton.gameObject.SetActive(false); EditMode = false; EditButton.GetComponentInChildren <Text>().text = "Edit"; } else { Debug.LogError("Committing while not in edit mode"); } }
public ActionResult Delete(Bay model) { int result = new BayRepository().DeleteBay(model); if (result == 0) { TempData["Success"] = "Deleted Successfully!"; TempData["BayRefNo"] = model.BayRefNo; return(RedirectToAction("Create")); } else { if (result == 1) { FillBayType(); TempData["error"] = "Sorry!! You Cannot Delete This Bay It Is Already In Use"; TempData["BayRefNo"] = null; } else { FillBayType(); TempData["error"] = "Oops!!..Something Went Wrong!!"; TempData["BayRefNo"] = null; } return(RedirectToAction("Create")); } }
public void NotifyBayExpired(Bay bay) { //notify GameController DeallocateBay(bay); GameController.gc.CarAngered(); GameController.gc.soundManager.Play("FailDing"); }
public IActionResult Create(string name, int targetTrained, int areaId) { Bay newBay = new Bay(name, targetTrained, areaId); db.Bays.Add(newBay); db.SaveChanges(); return(RedirectToAction("Index")); }
//Create new Bay public IActionResult Create() { Bay bay = new Bay(); List <Area> areas = db.Areas.ToList(); BayCreateVM VM = new BayCreateVM(bay, areas); return(View(VM)); }
public void TestRemoveBedsideMonitor() { IBay testBay = new Bay(2); testBay.RemoveBedsideMonitor(0); Assert.AreEqual(1, testBay.BedsideMonitors.Count); }
public void TestAddBedSideMonitor() { IBay testBay = new Bay(); testBay.AddBedSideMonitor(); Assert.IsNotNull(testBay.BedsideMonitors[0]); }
public void NotifyBayCleaned(Bay bay) { //notify GameController DeallocateBay(bay); GameController.gc.CarServed(); GameController.gc.NotifyAllEmpty(); GameController.gc.soundManager.Play("Ding"); }
public void NotifyBayEntered(Bay bay, CarInstance carInstance) { if (bay == null) { return; } bay.carStatus = Bay.CarStatus.FULL; }
public List <PathNode> getPathNodeList() { Bay bay = GameObject.FindWithTag("Bay").GetComponent <Bay>(); return(new List <PathNode> { bay.getPathNode((int)transform.position.x, (int)transform.position.y) }); }
public ActionResult DeleteConfirmed(int id) { Bay bay = db.Bays.Find(id); db.Bays.Remove(bay); db.SaveChanges(); return(RedirectToAction("Index")); }
public void SetBay(Bay selectedBay, Main.PageCall2 patientPageCall) { currentBay = selectedBay; SetProperties(ref selectedBay); PatientPageCall = patientPageCall; alarmCheck.Start(); }
public Main() { InitializeComponent(); bay1 = new Bay(1); bay2 = new Bay(2); bay1.StartRandomizingValues(); bay2.StartRandomizingValues(); }
public void AllocateBay(Bay bay, CarInstance carInstance) { bay.carStatus = Bay.CarStatus.WAITING; bay.currentCar = carInstance; bay.currentProgress = 1f; carInstance.SetAnimationBay(bay.bayNum); carInstance.thisBay = bay; }
public ActionResult Create() { FillBayType(); ViewBag.Title = "Create"; Bay Bay = new Bay(); Bay.BayRefNo = new BayRepository().GetRefNo(Bay); return(View(Bay)); }
public void bayFrequency(int bayId) { Bay bay = db.Bays.Where(x => x.BayID == bayId).FirstOrDefault <Bay>(); bay.Frequency = bay.Frequency + 1; db.Bays.Attach(bay); db.Entry(bay).Property(x => x.Frequency).IsModified = true; db.SaveChanges(); }
public static void ValidateBayRTC(Bay b, string RTCProt) { using (IQueryAdapter dbClient = Core.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE alimentadores SET rtc_prot = @rtc, rtc_prot_checked = 1 WHERE id = @id LIMIT 1;"); dbClient.AddParameter("rtc", RTCProt); dbClient.AddParameter("id", b.Id); dbClient.RunQuery(); } }
public async Task <IActionResult> Create([Bind("Id,Name")] Bay bay) { if (ModelState.IsValid) { _context.Add(bay); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bay)); }
public ActionResult Edit([Bind(Include = "BayID,SectionID,BayName,Height,Width,Depth,XLocation,YLocation,NumOfFix")] Bay bay) { if (ModelState.IsValid) { db.Entry(bay).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SectionID = new SelectList(db.Sections, "SectionID", "SectionName", bay.SectionID); return(View(bay)); }