public async Task <ActionResult <Ward> > PostWard(Ward ward) { _context.Ward.Add(ward); await _context.SaveChangesAsync(); return(CreatedAtAction("GetWard", new { id = ward.WardID }, ward)); }
private Location LookupOrCreate( StatisticsDbContext context, Country country, Institution institution = null, LocalAuthority localAuthority = null, LocalAuthorityDistrict localAuthorityDistrict = null, LocalEnterprisePartnership localEnterprisePartnership = null, MayoralCombinedAuthority mayoralCombinedAuthority = null, Mat multiAcademyTrust = null, OpportunityArea opportunityArea = null, ParliamentaryConstituency parliamentaryConstituency = null, Region region = null, RscRegion rscRegion = null, Sponsor sponsor = null, Ward ward = null, PlanningArea planningArea = null) { var location = Lookup( context, country, institution, localAuthority, localAuthorityDistrict, localEnterprisePartnership, mayoralCombinedAuthority, multiAcademyTrust, opportunityArea, parliamentaryConstituency, region, rscRegion, sponsor, ward, planningArea); if (location == null) { var entityEntry = context.Location.Add(new Location { Id = _guidGenerator.NewGuid(), Country = country ?? Country.Empty(), Institution = institution ?? Institution.Empty(), LocalAuthority = localAuthority ?? LocalAuthority.Empty(), LocalAuthorityDistrict = localAuthorityDistrict ?? LocalAuthorityDistrict.Empty(), LocalEnterprisePartnership = localEnterprisePartnership ?? LocalEnterprisePartnership.Empty(), MayoralCombinedAuthority = mayoralCombinedAuthority ?? MayoralCombinedAuthority.Empty(), MultiAcademyTrust = multiAcademyTrust ?? Mat.Empty(), OpportunityArea = opportunityArea ?? OpportunityArea.Empty(), ParliamentaryConstituency = parliamentaryConstituency ?? ParliamentaryConstituency.Empty(), Region = region ?? Region.Empty(), RscRegion = rscRegion ?? RscRegion.Empty(), Sponsor = sponsor ?? Sponsor.Empty(), Ward = ward ?? Ward.Empty(), PlanningArea = planningArea ?? PlanningArea.Empty() }); return(entityEntry.Entity); } return(location); }
public async Task <IActionResult> PutWard(int id, Ward ward) { if (id != ward.WardID) { return(BadRequest()); } _context.Entry(ward).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WardExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Location Find( StatisticsDbContext context, Country country, Institution institution = null, LocalAuthority localAuthority = null, LocalAuthorityDistrict localAuthorityDistrict = null, LocalEnterprisePartnership localEnterprisePartnership = null, MayoralCombinedAuthority mayoralCombinedAuthority = null, Mat multiAcademyTrust = null, OpportunityArea opportunityArea = null, ParliamentaryConstituency parliamentaryConstituency = null, Region region = null, RscRegion rscRegion = null, Sponsor sponsor = null, Ward ward = null, PlanningArea planningArea = null) { var cacheKey = GetCacheKey(country, institution, localAuthority, localAuthorityDistrict, localEnterprisePartnership, mayoralCombinedAuthority, multiAcademyTrust, opportunityArea, parliamentaryConstituency, region, rscRegion, sponsor, ward, planningArea); if (GetCache().TryGetValue(cacheKey, out Location location)) { return(location); } location = LookupOrCreate(context, country, institution, localAuthority, localAuthorityDistrict, localEnterprisePartnership, mayoralCombinedAuthority, multiAcademyTrust, opportunityArea, parliamentaryConstituency, region, rscRegion, sponsor, ward, planningArea); GetCache().Set(cacheKey, location); return(location); }
private static string GetCacheKey(Country country, Institution institution, LocalAuthority localAuthority, LocalAuthorityDistrict localAuthorityDistrict, LocalEnterprisePartnership localEnterprisePartnership, MayoralCombinedAuthority mayoralCombinedAuthority, Mat multiAcademyTrust, OpportunityArea opportunityArea, ParliamentaryConstituency parliamentaryConstituency, Region region, RscRegion rscRegion, Sponsor sponsor, Ward ward, PlanningArea planningArea) { var observationalUnits = new IObservationalUnit[] { country, institution, localAuthority, localAuthorityDistrict, localEnterprisePartnership, mayoralCombinedAuthority, multiAcademyTrust, parliamentaryConstituency, opportunityArea, region, rscRegion, sponsor, ward, planningArea }; const string separator = "_"; return(string.Join(separator, observationalUnits .Where(unit => unit != null) .Select(unit => $"{unit.GetType()}:{(unit is LocalAuthority la ? la.GetCodeOrOldCodeIfEmpty() : unit.Code )}:{unit.Name}"))); }
//public int ward_ID { get; set; } //public string ward_dept { get; set; } //public int is_empty { get; set; } //public int capacity { get; set; } //public virtual department department { get; set; } //public virtual patient patient { get; set; } public int AddNew(string ward_ID, string ward_dept, int capacity) { using (MyContext ctx = new MyContext()) { var ward = ctx.Wards.SingleOrDefault(w => w.ward_ID == ward_ID); var dept = ctx.Departments.SingleOrDefault(d => d.dept_name == ward_dept); if (dept == null) { return(2); //表示输入部门科室不存在 } if (ward == null) { Ward s = new Ward(); s.ward_ID = ward_ID; s.ward_dept = ward_dept; s.capacity = capacity; s.is_full = 0; ctx.Wards.Add(s); ctx.SaveChanges(); return(1); //添加成功 } else { return(-1); } //添加的病房已经有了 } }
private void BedSetup2_Load(object sender, EventArgs e) { Floor defaultFloor = new Floor(); defaultFloor.FloorName = "--Select--"; defaultFloor.Id = -1; List <Floor> floors = new List <Floor>(); floors.Add(defaultFloor); floors.AddRange(aFloorManager.GetAllFloors()); floorComboBox.DisplayMember = "FloorName"; floorComboBox.ValueMember = "Id"; floorComboBox.DataSource = floors; Category defaultCategory = new Category(); defaultCategory.CategoryName = "--Select--"; defaultCategory.Id = -1; List <Category> categories = new List <Category>(); categories.Add(defaultCategory); categories.AddRange(aCategoryManager.GetAllCategories()); categoryComboBox.DisplayMember = "CategoryName"; categoryComboBox.ValueMember = "Id"; categoryComboBox.DataSource = categories; Ward defaultWard = new Ward(); defaultWard.WardName = "--Select--"; defaultWard.Id = -1; List <Ward> wards = new List <Ward>(); wards.Add(defaultWard); wards.AddRange(aWardManager.GetAllWards()); wardComboBox.DisplayMember = "WardName"; wardComboBox.ValueMember = "Id"; wardComboBox.DataSource = wards; Room defaultRoom = new Room(); defaultRoom.RoomName = "--Select--"; defaultRoom.Id = -1; List <Room> rooms = new List <Room>(); rooms.Add(defaultRoom); rooms.AddRange(aRoomManager.GetAllRooms()); roomComboBox.DisplayMember = "RoomName"; roomComboBox.ValueMember = "Id"; roomComboBox.DataSource = rooms; PopulateItemsListView(); editButton.Enabled = false; deleteButton.Enabled = false; }
public async Task <ICommandResult> Handle(WardUpdateCommand mesage) { try { Ward ward = new Ward(); ward.Init(mesage); await _locationService.UpdateWard(ward); ICommandResult result = new CommandResult() { Message = "", ObjectId = ward.Id, Status = CommandResult.StatusEnum.Sucess }; return(result); } catch (Exception e) { e.Data["Param"] = mesage; ICommandResult result = new CommandResult() { Message = e.Message, Status = CommandResult.StatusEnum.Fail }; return(result); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,MunicipilityId,WardNo,WardName")] Ward ward) { if (id != ward.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ward); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WardExists(ward.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MunicipilityId"] = new SelectList(_context.Municipility, "Id", "MName", ward.MunicipilityId); return(View(ward)); }
protected override void OnReadFields(IList <HousePrice> ks, string[] fields) { var localAuthorityDistrictCode = fields[0]; var localAuthorityDistrictName = fields[1]; var localAuthorityDistrict = new LocalAuthorityDistrict { Code = localAuthorityDistrictCode, Name = localAuthorityDistrictName, }; var wardCode = fields[2]; var wardName = fields[3]; var ward = new Ward { Code = wardCode, Name = wardName, }; var priceEndingSept2019 = fields[99]; if (priceEndingSept2019 == ":") { return; } var housePrice = new HousePrice { LocalAuthorityDistrict = localAuthorityDistrict, Ward = ward, AverageHousePrice = double.Parse(priceEndingSept2019.Replace(",", "")), }; ks.Add(housePrice); }
public double Angle(Ward ward) { return hero.FindRelativeAngle(ward.Position); }
private static void CheckBuffs(Ward ward) { if (ward.RemainingTimeDelegate == null) { // Get the correct buff name (seems like this one is used for all of them) const string buffName = "sharedwardbuff"; // Check for remaining time buff var buff = ward.Handle.Buffs.Find(o => o.Name == buffName); if (buff != null) { // Apply remaining time delegate ward.RemainingTimeDelegate = () => (int) Math.Ceiling(buff.EndTime - Game.Time); } } }
private static void OnCreate(GameObject sender, EventArgs args) { #region Ward Types var yTrinket = new Ward { location = sender.Position, wardID = "YellowTrinket", Name = "TrinketTotemLvl1", lifeSpan = TickCount + 60000, range = 1100, id = WardType.Green }; WardList.Add(yTrinket); var yTrinketUpgrade = new Ward { location = sender.Position, wardID = "YellowTrinketUpgrade", Name = "TrinketTotemLvl2", lifeSpan = TickCount + 120000, range = 1100, id = WardType.Green }; WardList.Add(yTrinketUpgrade); var yTrinketUpgrade2 = new Ward { location = sender.Position, wardID = "SightWard", Name = "TrinketTotemLvl3", lifeSpan = TickCount + 180000, range = 1100, id = WardType.Green }; WardList.Add(yTrinketUpgrade2); var sightWard = new Ward { location = sender.Position, wardID = "SightWard", Name = "SightWard", lifeSpan = TickCount + 180000, range = 1100, id = WardType.Green }; WardList.Add(sightWard); var ghostWard = new Ward { location = sender.Position, wardID = "SightWard", Name = "ItemGhostWard", lifeSpan = TickCount + 180000, range = 1100, id = WardType.Green }; WardList.Add(ghostWard); var wrigglelantern = new Ward { location = sender.Position, wardID = "SightWard", Name = "wrigglelantern", lifeSpan = TickCount + 180000, range = 1100, id = WardType.Green }; WardList.Add(wrigglelantern); var trinketPink = new Ward { location = sender.Position, wardID = "VisionWard", Name = "TrinketTotemLvl3B", lifeSpan = int.MaxValue, range = 1100, id = WardType.Pink }; WardList.Add(trinketPink); var VisionWard = new Ward { location = sender.Position, wardID = "VisionWard", Name = "VisionWard", lifeSpan = int.MaxValue, range = 1100, id = WardType.Pink }; WardList.Add(VisionWard); #endregion if (!sender.IsValid<Obj_AI_Base>()) return; if (sender.IsAlly) return; foreach (var wards in WardList) { var colors = wards.id == WardType.Green ? Color.Green : Color.Pink; if (wards.wardID == sender.Name) { Drawing.DrawCircle(wards.location, 100, colors); } } }
internal Ward[] toWardsByDdr(string[] response) { ArrayList lst = new ArrayList(); for (int i = 0; i < response.Length; i++) { string[] flds = response[i].Split(new char[] { '^' }); if (flds[3] != "1") { lst.Add(response[i]); } } if (lst.Count == 0) { return null; } Ward[] result = new Ward[lst.Count]; StringDictionary specialties = cxn.SystemFileHandler.getLookupTable(VistaConstants.PTF_SPECIALTIES); for (int i = 0; i < lst.Count; i++) { string[] flds = ((string)lst[i]).Split(new char[] { '^' }); result[i] = new Ward(); result[i].Id = flds[0]; result[i].WardName = flds[1]; if (specialties.ContainsKey(flds[2])) { result[i].Specialty = new KeyValuePair<string, string>(flds[2], specialties[flds[2]]); } if (flds[4] != "") { string[] hlFlds = StringUtils.split(flds[5], "^"); result[i].HospitalLocationName = hlFlds[0]; result[i].Abbr = hlFlds[1]; result[i].Phone = hlFlds.Length == 3 ? hlFlds[2] : ""; } } return result; }
/// <summary> /// Gets the wards close to another ward. /// </summary> /// <param name="w">The ward.</param> /// <returns></returns> private static List<Ward> GetWardsCloseTo(Ward w) { return WardTrackerVariables.detectedWards.Where( m => m.Position.Distance(w.Position, true) <= Math.Pow(w.WardTypeW.WardVisionRange, 2)).ToList(); }
public PlacedWard(Ward ward, Vector3 location, float deathTime) { BaseWard = ward; Location = location; DeathTime = deathTime; }