public House(ZoneCharacter pOwner, HouseType pType, ushort pItemID = 0, string pName = "") { this.Owner = pOwner; this.Type = pType; this.ItemID = pItemID; this.Name = pName; }
public House(Game1 game1) : base(game1) { // TODO: Construct any child components here type = HouseType.Mormorshus; destroyed = false; game = game1; pos = new Vector2(game.rnd.Next(game.MAXX), game.rnd.Next(game.MAXY)); }
private static void WriteHousetypeFunction(StreamWriter sw, HouseType ht, int idx) { sw.WriteLine(""); sw.WriteLine("[Fact]"); sw.WriteLine("[Trait(UnitTestCategories.Category, UnitTestCategories.HousetypeTests)]"); sw.WriteLine("public void TestHousetype" + idx + ht.HouseTypeCode + "(){"); sw.WriteLine(" const string htguid = \"" + ht.Guid.StrVal + "\";"); sw.WriteLine(" HouseJobTestHelper.RunSingleHouse((sim) =>"); sw.WriteLine(" HouseJobCalcPreparer.PrepareNewHouseForHousetypeTesting(sim, htguid)"); sw.WriteLine(" , (x) => {});"); sw.WriteLine("}"); sw.WriteLine(""); }
public string GetRandomAnswerHouseType(bool vague, HouseType answerType) { List <string> answersList; if (vague) { answersList = answers.houseTypeAnswers.houseAnswersVague.Find(item => item.houseAnswer == answerType).answers; } else { answersList = answers.houseTypeAnswers.houseAnswers.Find(item => item.houseAnswer == answerType).answers; } return(answersList.ElementAt(Random.Range(0, answersList.Count))); }
public static string GetHouse(this HouseType houseType) { switch (houseType) { case HouseType.HOUSE: return("houses"); case HouseType.GUILD_HALLS: return("guildhalls"); default: throw new ArgumentOutOfRangeException(nameof(houseType), houseType, "Couldnt find the house string value"); } }
// GET: /HouseType/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HouseType housetype = db.HouseTypes.Find(id); if (housetype == null) { return(HttpNotFound()); } return(View(housetype)); }
private CalcAirConditioningDto MakeAirConditioning([NotNull] TemperatureProfile temperatureProfile, [NotNull] HouseType houseType, [NotNull] HouseholdKey householdKey, [CanBeNull] out CalcLocationDto airConditioningLocation) { var coolingParameter = MakeCoolingParameters(temperatureProfile, houseType); if (coolingParameter == null) { airConditioningLocation = null; return(null); } var degreeHourDict = new List <CalcDegreeHourDto>(); foreach (var degreeHour in coolingParameter.DegreeHours) { var cdd = new CalcDegreeHourDto(degreeHour.Date.Year, degreeHour.Date.Month, degreeHour.Date.Day, degreeHour.Date.Hour, degreeHour.CoolingAmount); degreeHourDict.Add(cdd); } CalcLoadTypeDto lt = _ltDict.GetLoadtypeDtoByLoadType(coolingParameter.CoolingLoadType); var cdl = new CalcDeviceLoadDto(coolingParameter.CoolingLoadType.Name, -1, lt.Name, lt.Guid, coolingParameter.YearlyConsumption, 0, Guid.NewGuid().ToStrGuid(), 1); var cdls = new List <CalcDeviceLoadDto> { cdl }; airConditioningLocation = new CalcLocationDto("Air Conditioning", -100, Guid.NewGuid().ToStrGuid()); var csh = new CalcAirConditioningDto("Air Conditioning", -1, cdls, degreeHourDict, householdKey, airConditioningLocation.Name, airConditioningLocation.Guid, Guid.NewGuid().ToStrGuid()); return(csh); }
private static void CheckTrafos([NotNull] HouseType ht) { List <Variable> usedVariables = new List <Variable>(); foreach (var trafo in ht.HouseTransformationDevices) { if (trafo.TransformationDevice != null) { foreach (var condition in trafo.TransformationDevice.Conditions) { usedVariables.Add(condition.Variable); } } if (trafo.TransformationDevice == null) { throw new DataIntegrityException("Messed up Transformation device in " + ht, ht); } if (trafo.TransformationDevice.LoadTypeIn == null) { throw new DataIntegrityException("No input load type set on " + trafo.TransformationDevice, trafo.TransformationDevice); } if (trafo.TransformationDevice.LoadTypesOut.Count == 0) { throw new DataIntegrityException("Messed up "); } } var offeredVariables = new List <Variable>(); foreach (var storage in ht.HouseEnergyStorages) { if (storage.EnergyStorage == null) { throw new DataIntegrityException("Messed up energy storage in " + ht.Name, ht); } foreach (var signal in storage.EnergyStorage.Signals) { offeredVariables.Add(signal.Variable); } } foreach (var variable in usedVariables) { if (!offeredVariables.Contains(variable)) { throw new DataIntegrityException("The variable " + variable.Name + " is used as condition in a transformation device in the house type " + ht.Name + " but no energy storage sets that variable.", ht); } } }
private static WinStat GetHouseWinStat(HouseType type, List <Game> games) { var houseGames = games.Where(x => x.Houses.Any(h => h.HouseType == type)).ToList(); var wins = houseGames.Where(x => x.Houses.Single(h => h.PlayerName == x.Winner).HouseType == type).ToList(); return(new WinStat { GamesCount = houseGames.Count, WinsCount = wins.Count, WinsPercent = houseGames.Count == 0 ? 0 : wins.Count * 100 / (double)houseGames.Count, WinsScoreCount = wins.Count(x => x.WinType == WinType.Seven), WinsSevenCount = wins.Count(x => x.WinType == WinType.Score) }); }
private static House MakeHouse([NotNull] Simulator sim, [NotNull] HouseData hd) { //house creation House house = sim.Houses.CreateNewItem(sim.ConnectionString); house.Name = hd.Name ?? hd.HouseGuid?.ToString() ?? ""; house.Description = DescriptionText + hd.HouseGuid; house.SaveToDB(); var housetypecode = hd.HouseTypeCode; if (housetypecode == null) { throw new LPGException("No house type was set"); } if (housetypecode == null) { throw new LPGException("Could not find house type " + hd.HouseTypeCode); } //house type adjustment var potentialHts = sim.HouseTypes.It.Where(x => x.Name.StartsWith(housetypecode, StringComparison.Ordinal)).ToList(); if (potentialHts.Count == 0) { throw new LPGException("No house type found for " + housetypecode); } if (potentialHts.Count > 1) { throw new LPGException("Too many house types found for " + housetypecode + ". Try adding a couple of more letters to make it unique. It searches by start of the name."); } HouseType newHouseType = (HouseType)HouseType.ImportFromItem(potentialHts[0], sim); newHouseType.Name = newHouseType.Name + "(" + hd.Name + ")"; if (hd.TargetHeatDemand != null) { newHouseType.HeatingYearlyTotal = hd.TargetHeatDemand.Value; } if (hd.TargetCoolingDemand != null) { newHouseType.CoolingYearlyTotal = hd.TargetCoolingDemand.Value; } newHouseType.AdjustYearlyEnergy = false; newHouseType.AdjustYearlyCooling = false; newHouseType.SaveToDB(); house.HouseType = newHouseType; return(house); }
public IHouse GetHouse(HouseType type) { if (_houses.ContainsKey(type)) { return(_houses[type]); } switch (type) { case HouseType.Panel: _houses[type] = new PanelHouse(); break; case HouseType.Brick: _houses[type] = new BrickHouse(); break; } return(_houses[type]); }
/// <summary> /// 查询入库类型 /// </summary> /// <returns></returns> public static List <HouseType> IntoHouseType() { Database db = DatabaseFactory.CreateDatabase("Constr"); string sql = "select * from HouseType"; DataSet ds = db.ExecuteDataSet(CommandType.Text, sql); List <HouseType> list = new List <HouseType>(); foreach (DataRow item in ds.Tables[0].Rows) { HouseType ht = new HouseType(); ht.TypeID = int.Parse(item["TypeID"].ToString()); ht.TypeName = item["TypeName"].ToString(); list.Add(ht); } return(list); }
/// <summary> /// Возвращает спрайт дома /// </summary> private Sprite GetSprite(HouseType house) { switch (house) { case HouseType.Poor: return(PoorHouseSprite); case HouseType.Common: return(CommonHouseSprite); case HouseType.Expensive: return(ExpensiveHouseSprite); default: throw new ArgumentException(); } }
private static void AddSingleBuildingType(Queue <string> args) { Building.Type type; switch (args.Dequeue()) { case "HOUSE": type = Building.Type.House; break; case "MINE": type = Building.Type.Mine; break; case "FACTORY": type = Building.Type.Factory; break; default: throw new Exception("Incorrect BuildingType Init"); } switch (type) { case Building.Type.House: BuildingTypes.Add( HouseType.Create(args, ReadNecessaryResourses(args)) ); break; case Building.Type.Mine: BuildingTypes.Add( MineType.Create(args, ReadNecessaryResourses(args)) ); break; case Building.Type.Factory: BuildingTypes.Add( FactoryType.Create(args, ReadNecessaryResourses(args)) ); break; default: throw new Exception("Incorrect BuildingType Init"); } }
internal void AddNewHouseForRent() { //int MANV = 1; int MALOAI = (int)SelectedHouse.LOAINHA.MALOAI; int SLPO = (int)SelectedHouse.SOLUONGPHONGO; string Duong = SelectedHouse.DUONG; string Quan = SelectedHouse.QUAN; string KhuVuc = SelectedHouse.KHUVUC; string ThanhPho = SelectedHouse.THANHPHO; string TinhTrang = HouseType.ToString(); int GiaThue = (int)SelectedHouseForRent.GIATHUE; using (QUANLYNHADATEntities db = new QUANLYNHADATEntities()) { db.USP_AddHouseForRent(MACN, MACNHA, 1, MALOAI, SLPO, null, null, Duong, Quan, KhuVuc, ThanhPho, TinhTrang, null, GiaThue); } }
private List <CalcTransformationDeviceDto> MakeAllTransformationDevices([NotNull] HouseType houseType, [NotNull] HouseholdKey householdKey) //List<CalcDeviceTaggingSet> taggingSets, { if (houseType == null) { throw new LPGException("Housetype was null"); } var transformationDevices = new List <TransformationDevice>(); foreach (var housetransformationDevice in houseType.HouseTransformationDevices) { transformationDevices.Add(housetransformationDevice.TransformationDevice); } return(MakeTransformationDeviceDtos(transformationDevices, householdKey)); }
public async Task <IActionResult> UpdateStudent(Guid id, StudentModel model) { Object meta; try { if (id != model.ID) { return(BadRequest()); } if (!Enumeration.ExistName <HouseType>(model.Casa)) { meta = new { Error = new { Description = "Error en los datos del estudiante", Data = "La casa seleccionada no es valida" } }; return(BadRequest(new { Meta = meta })); } var student = await Repository.SelectById <Student>(id); if (student == null) { return(NotFound()); } student.Nombre = model.Nombre; student.Apellido = model.Apellido; student.Identificacion = model.Identificacion; student.Edad = model.Edad; student.Casa = HouseType.FromName <HouseType>(model.Casa).Value; await Repository.UpdateAsync <Student>(student); return(NoContent()); } catch (Exception exception) { Logger.Fatal(exception.Message); Logger.Fatal(exception.StackTrace); meta = new { Error = new { Description = "Error Interno Del Servidor." } }; return(StatusCode(500, new { Meta = meta })); } }
// GET: /HouseType/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HouseType housetype = db.HouseTypes.Find(id); if (housetype == null) { return(HttpNotFound()); } Session["CreatedBy"] = housetype.CreatedBy; Session["CreatedAt"] = housetype.CreatedAt; Session["Logo"] = housetype.Logo; return(View(housetype)); }
private static string GetHouseName([NotNull] string basis, ref int offset, [NotNull] Simulator sim, [ItemNotNull][NotNull] List <ICalcObject> households, [CanBeNull] HouseType ht) { var houselist = string.Empty; var housetype = ht?.Name ?? ""; if (ht != null && ht.Name.Contains(" ")) { housetype = ht.Name.Substring(0, ht.Name.IndexOf(" ", StringComparison.Ordinal)); } var builder = new StringBuilder(); builder.Append(houselist); foreach (var calcObject in households) { var name = calcObject.Name; if (name.ToUpperInvariant().StartsWith("X ", StringComparison.Ordinal)) { name = name.Substring(2); } if (name.Contains(" ")) { name = name.Substring(0, name.IndexOf(" ", StringComparison.Ordinal)); } builder.Append(name).Append(", "); } houselist = builder.ToString(); if (houselist.Length > 2) { houselist = houselist.Substring(0, houselist.Length - 2); } string GetName(int i) => basis + " " + i.ToString("D2", CultureInfo.CurrentCulture) + " " + housetype + " with " + houselist; while (sim.Houses.IsNameTaken(GetName(offset))) { offset++; } return(GetName(offset)); }
public ActionResult Edit([Bind(Exclude = "CreatedBy, CreatedAt, UpdatedAt")] HouseType housetype, HttpPostedFileBase imgHouseTypeLogo) { if (ModelState.IsValid) { GetLogoName(housetype, imgHouseTypeLogo, (string)Session["Logo"]); housetype.UpdatedAt = DateTime.Now; housetype.CreatedBy = (string)Session["CreatedBy"]; Session.Remove("CreatedBy"); housetype.CreatedAt = (DateTime)Session["CreatedAt"]; Session.Remove("CreatedAt"); Session.Remove("Logo"); db.Entry(housetype).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.CreatedBy = new SelectList(db.IdentityUsers, "Id", "UserName", housetype.CreatedBy); return(View(housetype)); }
public static FloorType[,] CreateHouse(HouseType type, Direction dir) { int mapW = 50; int mapH = 50; BlueprintNode blueprint = GetRoomLink(type); FloorType[,] blocks = new FloorType[mapW, mapH]; Room livingRoom = CreateMinRoom(ref blocks, blueprint, new VecInt2(mapW / 2, mapH / 2), dir); while (livingRoom.GetCurrentSize() < livingRoom.targetSize) { bool bExtendOk = Extend(ref blocks, livingRoom); if (!bExtendOk) { break; } } livingRoom.children = CreateChildren(ref blocks, livingRoom, blueprint); return(blocks); }
public static HouseBuilder CreateBuilder(Point origin, StructureMap structures) { List <Rectangle> list = CreateRooms(origin); if (list.Count == 0 || !AreRoomLocationsValid(list)) { return(HouseBuilder.Invalid); } HouseType houseType = GetHouseType(list); if (!AreRoomsValid(list, structures, houseType)) { return(HouseBuilder.Invalid); } switch (houseType) { case HouseType.Wood: return(new WoodHouseBuilder(list)); case HouseType.Desert: return(new DesertHouseBuilder(list)); case HouseType.Granite: return(new GraniteHouseBuilder(list)); case HouseType.Ice: return(new IceHouseBuilder(list)); case HouseType.Jungle: return(new JungleHouseBuilder(list)); case HouseType.Marble: return(new MarbleHouseBuilder(list)); case HouseType.Mushroom: return(new MushroomHouseBuilder(list)); default: return(new WoodHouseBuilder(list)); } }
public static HouseBuilder CreateBuilder(Point origin, StructureMap structures) { List <Microsoft.Xna.Framework.Rectangle> rooms = HouseUtils.CreateRooms(origin); if (rooms.Count == 0 || !HouseUtils.AreRoomLocationsValid((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms)) { return(HouseBuilder.Invalid); } HouseType houseType = HouseUtils.GetHouseType((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms); if (!HouseUtils.AreRoomsValid((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms, structures, houseType)) { return(HouseBuilder.Invalid); } switch (houseType) { case HouseType.Wood: return((HouseBuilder) new WoodHouseBuilder((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms)); case HouseType.Ice: return((HouseBuilder) new IceHouseBuilder((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms)); case HouseType.Desert: return((HouseBuilder) new DesertHouseBuilder((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms)); case HouseType.Jungle: return((HouseBuilder) new JungleHouseBuilder((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms)); case HouseType.Mushroom: return((HouseBuilder) new MushroomHouseBuilder((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms)); case HouseType.Granite: return((HouseBuilder) new GraniteHouseBuilder((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms)); case HouseType.Marble: return((HouseBuilder) new MarbleHouseBuilder((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms)); default: return((HouseBuilder) new WoodHouseBuilder((IEnumerable <Microsoft.Xna.Framework.Rectangle>)rooms)); } }
public async Task <bool> AddHouse(HouseAnnounceModel announce) { try { HouseType houseType = await _dbContext.HouseTypes.FindAsync(announce.HouseTypeId); DateTime addedDate = DateTime.Now; House unicodeAnnounce = await _dbContext.Houses.FindAsync(_dbContext.Houses.Max(c => c.Id)); string unicode = (Int32.Parse(unicodeAnnounce.AnnounceUniqueCode) + 1).ToString(); House house = new House(houseType, announce.HouseLocation) { AnnounceAddedDate = addedDate, AnnounceTypeId = announce.AnnounceTypeId, Price = announce.Price, CityId = announce.CityId, Description = announce.Description, PersonTypeId = announce.PersonTypeId, Email = announce.Email, PhoneNumber = announce.PhoneNumber, AnnounceUniqueCode = unicode, RSAnnounceTypeId = announce.HouseRSAnnounceTypeId, }; await _dbContext.Houses.AddAsync(house); //car files upload start AddDataPhoto(announce.Paths, house.Id, "lib/images/realestate/house", FindTable.House); //car files upload end await _dbContext.SaveChangesAsync(); } catch (Exception exp) { throw exp; } return(true); }
public static House Create ( HouseType t, int ind ) { return(new House( t.HealRate, t.OccupyingSpace, new UnitHolder( "UnitHolder", t.MaxUnitsOccupyingSpace, 0, new List <Unit>() ), $"House " + ind.ToString("D3"), Buildable.State.Destroyed, t.TimeToBuildSec, t.TimeToDestroySec, t.NecessaryResourses )); }
public Advert( int userId, AdvertType advertType, string title, string description, string address, int countryId, int cityId, int districtId, HouseType houseType) { this.UserId = userId; this.IsPublic = false; this.IsActice = false; this.AdvertType = advertType; House = new House(title, description, address, countryId, cityId, districtId, houseType); _memberInteresteds = new List <MemberInterested>(); this.HouseId = House.Id; }
public ActionResult Create([Bind(Exclude = "ActiveStatus, CreatedBy, CreatedAt, UpdatedAt")] HouseType housetype, HttpPostedFileBase imgHouseTypeLogo) { if (ModelState.IsValid) { GetLogoName(housetype, imgHouseTypeLogo, "Image Not Found"); string currentUser = User.Identity.GetUserId(); housetype.ActiveStatus = true; housetype.CreatedAt = DateTime.Now; housetype.UpdatedAt = DateTime.Now; housetype.CreatedBy = currentUser; db.HouseTypes.Add(housetype); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(housetype)); }
public static void Main(string[] args) { //while () { try { HouseType hType = 0; Console.Write(@"Enter the type of house you want to purchase 0 - Default 1 - Single Family 2 - Townhouse 3 - lifestyle block your Choice: "); hType = Validate((HouseType)int.Parse(Console.ReadLine())); Console.WriteLine("\nGreat, you choice was: {0}", hType); } catch (System.ArgumentException) { Console.WriteLine("Invaild input, has to be between 0 - 3"); } //Garage GarageType gType = 0; Console.Write(@"Enter type of Garage you want to purchase 0 - Default 1 - Single 2 - Double 3 - 3 Car + 4 - Carport 5 - Not essential your Choice: "); gType = Validate((GarageType)int.Parse(Console.ReadLine())); Console.WriteLine("\nGreat, you choice was: {0}", gType); Console.Read(); } }
private bool IsThereNotFillable(HouseType houseType, int t) { for (int i = 0; i < 9; i++) { isCurrentHouseFull = true; for (int j = 0; j < 9; j++) { if (houseType == HouseType.ROW ? IsThereNotOccupiedCell(t, i, j) : IsThereNotOccupiedCell(t, j, i)) break; } isThereFullHouseAmongAll |= isCurrentHouseFull; if (isThereFullHouseAmongAll) return true; } return false; }
private void buttonOK_Click(object sender, EventArgs e) { isValid = true; city_Validating(); street_Validating(); housingNumber_Validation(); index_Validating(); if (isValid) { ParentForm.addressInfo_Button.ForeColor = blackColor; string city = cityTextBox.Text; string street = streetTextBox.Text; HouseType houseType = houseRadioButton.Checked ? HouseType.house : HouseType.flat; string housingNumber = houseRadioButton.Checked ? houseTextBox.Text : flatTextBox.Text; string index = houseIndexTextBox.Text; studentAddress = new Address(city, street, houseType, housingNumber, index); } else { ParentForm.addressInfo_Button.ForeColor = warningColor; } }
private List <HouseType> GetItemsBySql(string safeSql) { List <HouseType> list = new List <HouseType>(); DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.ConnectionString, CommandType.Text, safeSql); if (ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; foreach (DataRow row in dt.Rows) { HouseType item = new HouseType(); item.Id = (int)row["Id"]; item.Name = (string)row["Name"]; list.Add(item); } } return(list); }
public async Task <IEnumerable <RealEstateAgent> > GetTopAgents(HouseType type, int depth = 10) { var client = new HttpClient(); int page = 0; Dictionary <int, RealEstateAgent> _dictionary = new Dictionary <int, RealEstateAgent>(); List <RealEstate> realEstates = new List <RealEstate>(); while (true) { page++; var result = type == HouseType.HasGarden ? await _fundaClient.GetHausesWithGardenForSale(page) : await _fundaClient.GetHausesForSale(page); realEstates.AddRange(result.Objects.Select(item => _realEstateMapper.Map(item))); if (string.IsNullOrWhiteSpace(result.Paging.VolgendeUrl)) { break; } } return(realEstates.GroupByAgent().OrderByDescending(item => item.Listings.Count).Take(depth)); }
public void OnAddBuildingToPlanetColony(Colony c, BuildingType bt) { if (c == null || bt == null) { return; } switch (bt.Type) { case Building.Type.House: HouseType ht = (HouseType)bt; c.Add( House.Create(ht, c.Buildings.Sum(x => x.BuildingType == Building.Type.House ? 1 : 0)) ); break; case Building.Type.Mine: MineType mt = (MineType)bt; c.Add( Mine.Create(mt, c.Buildings.Sum(x => x.BuildingType == Building.Type.Mine ? 1 : 0)) ); break; case Building.Type.Factory: FactoryType ft = (FactoryType)bt; c.Add( Factory.Create(ft, c.Buildings.Sum(x => x.BuildingType == Building.Type.Factory ? 1 : 0)) ); break; } }
protected void AddAffiliation(HouseType affiliation) { affiliations.Add(affiliation); }