private void ComposeArea() { PointsOfInterest = Entrances .SelectMany(e => e.PointsOfInterest) .Where(p => p.BitFlagSet.Count > 0) .GroupBy(p => p.Coords, new SCCoordsEqualityComparer()) .Select(g => g.First()) .ToList(); Exits = PointsOfInterest.Where(p => p.Type == SCPointOfInterestType.Tele || p.Type == SCPointOfInterestType.Warp || p.Type == SCPointOfInterestType.Exit).Select(p => p.Teleport).ToList(); }
private void InitializeFields() { CurrentCustomer = Entrance.NewCustomer; CurrentWatch = Entrance.NewWatch; CurrentEntrance = Entrance.NewEntrance; Transactions = new List <Transaction>(); TransactionCharges = new List <Charge>(); serviceLabel.Text = DbService.GetValue(Query.GetServiceName(CurrentWatch.ServiceId)).ToString(); currentServiceId = CurrentWatch.ServiceId; UpdateServiceTextBox(); UpdateChargeTextBox(); }
public bool SetNumberOfEntries(uint n) { if (n <= 0 || n > Width || n > Entrances.Count) { return(false); } uint num = (uint)Entrances.Count - n; for (uint i = 0; i < num; ++i) { int index = Random.Range(0, Entrances.Count - 1); Entrances.RemoveAt(index); Exits.RemoveAt(index); } return(true); }
private void ComposeArea(SCEntrance entrance, HashSet <SCCoords> doneEntrances) { var poiDic = entrance.PointsOfInterest .Where(e => e.Type == SCPointOfInterestType.SmEntrance || e.Type == SCPointOfInterestType.OwEntrance) .Where(e => e.BitFlagSet.Count > 0) .Select(e => e.Coords) .Distinct(new SCCoordsEqualityComparer()) .ToDictionary(e => e, new SCCoordsEqualityComparer()); var entranceList = Entrances.Where(e => poiDic.ContainsKey(e.Coords)).ToList(); foreach (var e in entranceList) { if (!doneEntrances.Contains(e.Coords)) { doneEntrances.Add(e.Coords); } } var area = new SCArea(this, entranceList); Areas.Add(area); }
public JsonResult SaveEntry(string msg, int buildingId, int TenantId) { try { Entrances entry = new Entrances(); using (ApplicationDbContext context = new ApplicationDbContext()) { entry.Message = msg; entry.BuildingId = buildingId; entry.TenantId = TenantId; entry.Date = DateTime.Now.ToString("dd/MM/yyyy"); entry.Time = DateTime.Now.ToString("HH:mm"); context.Entrances.Add(entry); context.SaveChanges(); return(Json("Details Succesfuly Saved!")); }; } catch (Exception e) { return(Json(" There Was A Problem " + e.Message)); } }
private int CreateEntrance() { var customerId = CreateCustomer(); CreateWatch(customerId); var watchId = NewWatch.Id; try { if (customerId != 0) { var entranceId = DbService.GetNewId("Entrances"); var isSuccess = DbService.InsertData(Query.CreateEntrance(entranceId, watchId, entranceMethod.SelectedIndex + 1, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), customerId, Convert.ToInt32(hours.Text))); NewEntrance = new Entrances(entranceId, watchId, entranceMethod.SelectedIndex + 1, DateTime.Now, customerId, Convert.ToInt32(hours.Text)); if (isSuccess == 1) { CreateCharge(); return(isSuccess); } else { return(0); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } return(0); }
public override bool CanEnterFrom(Road road) { return(Entrances.Contains(road)); }