private void GenerateEmbryo() { currentCaste = (Caste)Random.Range(0, 5); casteText.text = "Caste : " + currentCaste.ToString(); citizenText.text = "Citizens Made : " + score; }
public string CasteNoun(bool owner = false) { if (Caste.ToLower() == "male") { if (owner) { return("his"); } else { return("he"); } } if (Caste.ToLower() == "female") { if (owner) { return("her"); } else { return("she"); } } if (owner) { return("it's"); } return("it"); }
public string GetRaceTitleString() { string hfraceString = ""; if (Ghost) { hfraceString += "ghostly "; } if (Skeleton) { hfraceString += "skeletal "; } if (Zombie) { hfraceString += "zombie "; } if (Caste.ToUpper() == "MALE") { hfraceString += "male "; } else if (Caste.ToUpper() == "FEMALE") { hfraceString += "female "; } hfraceString += GetRaceString(); return(Formatting.AddArticle(hfraceString)); }
/// <summary> /// Method to add Caste - SS /// </summary> /// <param name="name">name of Caste</param> /// <param name="instituteId">institute id</param> /// <returns>message</returns> public async Task <SharedLookUpResponse> AddCasteAsync(AddCasteManagementAc addCaste, int instituteId) { if (!await _iMSDbContext.Castes.AnyAsync(x => x.InstituteId == instituteId && x.Code.ToLowerInvariant() == addCaste.Code.ToLowerInvariant())) { var Caste = new Caste() { CreatedOn = DateTime.UtcNow, InstituteId = instituteId, Name = addCaste.Name, Code = addCaste.Code, Description = addCaste.Description, Status = true }; _iMSDbContext.Castes.Add(Caste); await _iMSDbContext.SaveChangesAsync(); return(new SharedLookUpResponse() { HasError = false, Message = "Caste added successfully" }); } else { return new SharedLookUpResponse() { HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Caste with the same code is already exist" } }; }
partial void Castes_Inserting(Caste entity) { entity.InsertDate = DateTime.Now; entity.InsertUser = Application.User.Name; entity.UpdateDate = DateTime.Now; entity.UpdateUser = Application.User.Name; }
// GET: /JobReceiveHeader/Create public ActionResult Create()//DocumentTypeId { Caste vm = new Caste(); vm.DocTypeId = Constants.DocumentTypeIdConstants.Caste; vm.IsActive = true; ViewBag.Mode = "Add"; return(View("Create", vm)); }
public string GetRaceTitleString() { string hfraceString = ""; if (Ghost) { hfraceString += "ghostly "; } if (Skeleton) { hfraceString += "skeletal "; } if (Zombie) { hfraceString += "zombie "; } if (Caste.ToUpper() == "MALE") { hfraceString += "male "; } else if (Caste.ToUpper() == "FEMALE") { hfraceString += "female "; } if (PreviousRace != "") { hfraceString += PreviousRace.ToLower() + " turned "; } hfraceString += Race.ToLower(); if (ActiveInteractions.Any(it => it.Contains("VAMPIRE"))) { return(hfraceString + " vampire"); } if (ActiveInteractions.Any(it => it.Contains("WEREBEAST"))) { return(hfraceString + " werebeast"); } if (ActiveInteractions.Any(it => it.Contains("SECRET") && !it.Contains("ANIMATE"))) { return(hfraceString + " necromancer"); } if (ActiveInteractions.Any(it => it.Contains("ANIMATE"))) { return(hfraceString + " animated corpse"); } return(hfraceString); }
// GET: /JobReceiveHeader/Edit/5 private ActionResult Edit(int id, string IndexType) { Caste pt = _CasteService.Find(id); if (pt == null) { return(HttpNotFound()); } ViewBag.Mode = "Edit"; return(View("Create", pt)); }
public string GetCasteName(int id) { Caste caste = _casteDalService.Get(id); if (caste is null) { return("-- не выбрано --"); } return(caste.Name); }
public IActionResult Create(Caste caste) { if (ModelState.IsValid) { _casteDalService.Add(caste); return(RedirectToAction("Get")); } return(View(caste)); }
public void Add(Caste caste) { int id = int.Parse(_database.Element("castes")?.Attribute("lastId").Value ?? string.Empty) + 1; caste.Id = id; XElement xCaste = new XElement("caste", new XElement("name", caste.Name), new XAttribute("id", id)); _database.Element("castes")?.Add(xCaste); _database.Element("castes").Attribute("lastId").Value = id.ToString(); _database.Save(_configuration.GetConnectionString("Database")); }
public ActionResult DeleteConfirmed(ReasonViewModel vm) { if (ModelState.IsValid) { //Commit the DB try { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); Caste temp = _CasteService.Find(vm.id); int DocTypeId = (int)temp.DocTypeId; LogList.Add(new LogTypeViewModel { ExObj = Mapper.Map <Caste>(temp), }); XElement Modifications = _modificationCheck.CheckChanges(LogList); _CasteService.Delete(vm.id); _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel { DocTypeId = DocTypeId, DocId = temp.CasteId, ActivityType = (int)ActivityTypeContants.Deleted, UserRemark = vm.Reason, DocNo = temp.CasteName, xEModifications = Modifications, DocDate = temp.CreatedDate, })); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; return(PartialView("_Reason", vm)); } return(Json(new { success = true })); } return(PartialView("_Reason", vm)); }
public Caste Get(int id) { XElement xCaste = _database.Element("castes") ?.Elements("caste") .FirstOrDefault(el => el.Attribute("id")?.Value == id.ToString()); if (xCaste == null) { return(null); } Caste caste = new Caste() { Name = xCaste?.Element("name")?.Value }; return(caste); }
public string GetRaceTitleString() { string hfraceString = ""; if (Race == "Night Creature" && PreviousRace != "") { return(PreviousRace.ToLower() + " turned night creature"); } if (Ghost) { hfraceString += "ghostly "; } if (Skeleton) { hfraceString += "skeletal "; } if (Zombie) { hfraceString += "zombie "; } if (Caste.ToUpper() == "MALE") { hfraceString += "male "; } else if (Caste.ToUpper() == "FEMALE") { hfraceString += "female "; } hfraceString += Race.ToLower(); if (ActiveInteractions.Any(it => it.Contains("VAMPIRE"))) { return(hfraceString + " vampire"); } if (ActiveInteractions.Any(it => it.Contains("WEREBEAST"))) { return(hfraceString + " werebeast"); } return(hfraceString); }
public Character() { name = "Char Name"; caste = Caste.Dawn; maxWillpower = 5; essence = 1; foreach (Attribute attr in Enum.GetValues(typeof(Attribute))) { attributes.Add(1); } foreach (Ability abil in Enum.GetValues(typeof(Ability))) { abilities.Add(0); } personalMotes = essence * 3 + 10; peripheralMotes = essence * 7 + 26; committedMotes = 0; InitializeHealth(healthLevels); }
public void Initialize(Caste caste, float startDelay) { gameManager = FindObjectOfType <GameManager>(); if ((int)caste > 2) { levelTime = .1f; } else { levelTime = 10f; } eggTransform.GetComponent <SpriteRenderer>().color = colors[(int)caste]; targetPercentage = (int)targets[(int)caste]; targetText.text = "" + targetPercentage; gameManager.StartCoroutine(Delay(startDelay)); }
public Task <int> PostCastes(Caste caste) { int results = 0; try { using (IDbConnection db = GetConnection()) { db.Open(); var p = new DynamicParameters(); p.Add("@CasteId", caste.CasteId, DbType.Int32, ParameterDirection.Input); p.Add("@CasteName", caste.CasteName, DbType.String, ParameterDirection.Input); p.Add("@CasteCreatedDate", caste.CasteCreatedDate, DbType.DateTime, ParameterDirection.Input); p.Add("@CasteCreatedBy", caste.CasteCreatedBy, DbType.Int64, ParameterDirection.Input); p.Add("@CasteModifiedDate", caste.CasteModifiedDate, DbType.DateTime, ParameterDirection.Input); p.Add("@CasteModifiedBy", caste.CasteModifiedBy, DbType.Int32, ParameterDirection.Input); p.Add("@CasteStatus", caste.CasteStatus, DbType.Int32, ParameterDirection.Input); if (caste.CasteId == 0) { p.Add("@ActionType", ActionType.Add.ToString(), DbType.String, ParameterDirection.Input); } else { p.Add("@ActionType", ActionType.Update.ToString(), DbType.String, ParameterDirection.Input); } p.Add("@OutputData", caste.CasteId, DbType.Int32, ParameterDirection.Input); results = db.Execute("usp_CRED_Caste", p, commandType: CommandType.StoredProcedure); } return(Task.FromResult(results)); } catch (Exception) { throw; } }
private ActionResult Remove(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Caste Caste = _CasteService.Find(id); if (Caste == null) { return(HttpNotFound()); } ReasonViewModel rvm = new ReasonViewModel() { id = id, }; return(PartialView("_Reason", rvm)); }
public ActionResult Delete(int id) { Caste header = _CasteService.Find(id); return(Remove(id)); }
public int Edit([FromBody] Caste caste) { return(_unitOfWork.Caste.UpdateCaste(caste)); }
public int Create([FromBody] Caste caste) { return(_unitOfWork.Caste.AddCaste(caste)); }
/// <summary> /// Writes a new state to the stream. /// </summary> /// <param name="state">New state</param> public void Write(SimulationState state) { serializer.Write(BlockType.FrameStart); int[] keys; #region Framestart // The first call creates the frame if (frame == null) { // Create new frame frame = new Frame(state); serializer.Write(BlockType.Frame, frame); } else { // Send frame-update FrameUpdate update = frame.GenerateUpdate(state); if (update != null) { serializer.Write(BlockType.FrameUpdate, update); } } #endregion #region Teams and ColonyStates #region ant-reset // reset alive-flag foreach (Ant ant in antList.Values) { ant.IsAlive = false; } #endregion #region marker-reset // reset alive-flag foreach (Marker marker in markerList.Values) { marker.IsAlive = false; } #endregion // Teams are static and need no update // enumerate all teams foreach (TeamState teamState in state.TeamStates) { // Check, if team is known if (teamList.ContainsKey(teamState.Id)) { // No Teamupdate needed } else { Team team = new Team(teamState); serializer.Write(BlockType.Team, team); teamList.Add(teamState.Id, team); } // ColonyStates are static and need no update // enumerate all colonies foreach (ColonyState colonyState in teamState.ColonyStates) { // Check, if colony is known if (colonyList.ContainsKey(colonyState.Id)) { // colony-update ColonyUpdate update = colonyList[colonyState.Id].GenerateUpdate(colonyState); if (update != null) { serializer.Write(BlockType.ColonyUpdate, update); } colonyList[colonyState.Id].Interpolate(); } else { // new colony Colony colony = new Colony(colonyState, teamState.Id); serializer.Write(BlockType.Colony, colony); colonyList.Add(colonyState.Id, colony); casteList.Add(colonyState.Id, new Dictionary <int, Caste>()); #region Castes // Casts are static and need no update Dictionary <int, Caste> castes = casteList[colonyState.Id]; // enumerate casts for (ushort i = 0; i < colonyState.CasteStates.Count; i++) { // Check, if caste is known if (!castes.ContainsKey(i)) { // add caste Caste caste = new Caste(colonyState.CasteStates[i]); serializer.Write(BlockType.Caste, caste); } } #endregion #region Anthills // Anthills are static and need no update // enumerate anthills foreach (AnthillState anthill in colonyState.AnthillStates) { if (!anthillList.ContainsKey(anthill.Id)) { Anthill hill = new Anthill(anthill); serializer.Write(BlockType.Anthill, hill); anthillList.Add(anthill.Id, hill); } } #endregion } #region Ants // enumerate ants foreach (AntState antState in colonyState.AntStates) { // Check, if ant is known if (antList.ContainsKey(antState.Id)) { // ant-update AntUpdate update = antList[antState.Id].GenerateUpdate(antState); if (update != null) { serializer.Write(BlockType.AntUpdate, update); } antList[antState.Id].Interpolate(); } else { // create ant Ant ant = new Ant(antState); serializer.Write(BlockType.Ant, ant); antList.Add(ant.Id, ant); } antList[antState.Id].IsAlive = true; } #endregion #region Marker // enumerate marker foreach (MarkerState markerState in colonyState.MarkerStates) { // Check, if marker is known if (markerList.ContainsKey(markerState.Id)) { // marker-update MarkerUpdate update = markerList[markerState.Id].GenerateUpdate(markerState); if (update != null) { serializer.Write(BlockType.MarkerUpdate, update); } markerList[markerState.Id].Interpolate(); } else { // create marker Marker marker = new Marker(markerState); serializer.Write(BlockType.Marker, marker); markerList.Add(markerState.Id, marker); } markerList[markerState.Id].IsAlive = true; } #endregion } } #region Ant-Cleanup // remove dead ants keys = new int[antList.Keys.Count]; antList.Keys.CopyTo(keys, 0); for (int i = 0; i < keys.Length; i++) { if (!antList[keys[i]].IsAlive) { serializer.Write(BlockType.AntLost, new Lost(keys[i])); antList.Remove(keys[i]); } } #endregion #region Marker-Cleanup // remove dead marker keys = new int[markerList.Keys.Count]; markerList.Keys.CopyTo(keys, 0); for (int i = 0; i < keys.Length; i++) { if (!markerList[keys[i]].IsAlive) { serializer.Write(BlockType.MarkerLost, new Lost(keys[i])); markerList.Remove(keys[i]); } } #endregion #endregion #region Fruit // reset alive-flag foreach (Fruit fruit in fruitList.Values) { fruit.IsAlive = false; } // enumerate fruit foreach (FruitState fruitState in state.FruitStates) { // Check, if fruit is known if (fruitList.ContainsKey(fruitState.Id)) { // fruit-update FruitUpdate update = fruitList[fruitState.Id].GenerateUpdate(fruitState); if (update != null) { serializer.Write(BlockType.FruitUpdate, update); } fruitList[fruitState.Id].Interpolate(); } else { // create fruit Fruit fruit = new Fruit(fruitState); serializer.Write(BlockType.Fruit, fruit); fruitList.Add(fruitState.Id, fruit); } fruitList[fruitState.Id].IsAlive = true; } // remove dead fruits keys = new int[fruitList.Keys.Count]; fruitList.Keys.CopyTo(keys, 0); for (int i = 0; i < keys.Length; i++) { if (!fruitList[keys[i]].IsAlive) { serializer.Write(BlockType.FruitLost, new Lost(keys[i])); fruitList.Remove(keys[i]); } } #endregion #region Sugar // reset alive-flag foreach (Sugar sugar in sugarList.Values) { sugar.IsAlive = false; } // enumerate sugar foreach (SugarState sugarState in state.SugarStates) { // Check, if sugar is known if (sugarList.ContainsKey(sugarState.Id)) { // sugar-update SugarUpdate update = sugarList[sugarState.Id].GenerateUpdate(sugarState); if (update != null) { serializer.Write(BlockType.SugarUpdate, update); } sugarList[sugarState.Id].Interpolate(); } else { // create sugar Sugar sugar = new Sugar(sugarState); serializer.Write(BlockType.Sugar, sugar); sugarList.Add(sugarState.Id, sugar); } sugarList[sugarState.Id].IsAlive = true; } // remove dead sugar keys = new int[sugarList.Keys.Count]; sugarList.Keys.CopyTo(keys, 0); for (int i = 0; i < keys.Length; i++) { if (!sugarList[keys[i]].IsAlive) { serializer.Write(BlockType.SugarLost, new Lost(keys[i])); sugarList.Remove(keys[i]); } } #endregion #region Bugs // reset alive-flag foreach (Bug bug in bugList.Values) { bug.IsAlive = false; } // enumerate bugs foreach (BugState bugState in state.BugStates) { // Check, if bug is known if (bugList.ContainsKey(bugState.Id)) { // bug-update BugUpdate update = bugList[bugState.Id].GenerateUpdate(bugState); if (update != null) { serializer.Write(BlockType.BugUpdate, update); } bugList[bugState.Id].Interpolate(); } else { // create bug Bug bug = new Bug(bugState); serializer.Write(BlockType.Bug, bug); bugList.Add(bugState.Id, bug); } bugList[bugState.Id].IsAlive = true; } // remove dead bugs keys = new int[bugList.Keys.Count]; bugList.Keys.CopyTo(keys, 0); for (int i = 0; i < keys.Length; i++) { if (!bugList[keys[i]].IsAlive) { serializer.Write(BlockType.BugLost, new Lost(keys[i])); bugList.Remove(keys[i]); } } #endregion serializer.Write(BlockType.FrameEnd); }
/// <summary> /// Reads the next block out of stream. /// </summary> /// <param name="block">the found block</param> /// <returns>type of found block</returns> public BlockType Read(out ISerializable block) { BlockType blockType = (BlockType)stream.ReadByte(); block = null; switch (blockType) { case BlockType.Ant: block = new Ant(this); break; case BlockType.Anthill: block = new Anthill(this); break; case BlockType.AnthillLost: throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType)); case BlockType.AnthillUpdate: throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType)); case BlockType.AntLost: block = new Lost(this); break; case BlockType.AntUpdate: block = new AntUpdate(this); break; case BlockType.Bug: block = new Bug(this); break; case BlockType.BugLost: block = new Lost(this); break; case BlockType.BugUpdate: block = new BugUpdate(this); break; case BlockType.Team: block = new Team(this); break; case BlockType.TeamLost: throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType)); case BlockType.TeamUpdate: throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType)); case BlockType.Colony: block = new Colony(this); break; case BlockType.ColonyLost: throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType)); case BlockType.ColonyUpdate: block = new ColonyUpdate(this); break; case BlockType.Frame: block = new Frame(this); break; case BlockType.StreamEnd: break; case BlockType.FrameLost: throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType)); case BlockType.FrameUpdate: block = new FrameUpdate(this); break; case BlockType.Fruit: block = new Fruit(this); break; case BlockType.FruitLost: block = new Lost(this); break; case BlockType.FruitUpdate: block = new FruitUpdate(this); break; case BlockType.Marker: block = new Marker(this); break; case BlockType.MarkerLost: block = new Lost(this); break; case BlockType.MarkerUpdate: block = new MarkerUpdate(this); break; case BlockType.Caste: block = new Caste(this); break; case BlockType.CasteLost: throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType)); case BlockType.CasteUpdate: throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType)); case BlockType.Sugar: block = new Sugar(this); break; case BlockType.SugarLost: block = new Lost(this); break; case BlockType.SugarUpdate: block = new SugarUpdate(this); break; case BlockType.FrameStart: break; case BlockType.FrameEnd: break; default: throw new InvalidOperationException(string.Format(Resource.AntvideoSerializerInvalidBlockType, blockType)); } return(blockType); }
public Armor(string name, int id, int stre, int dext, int inte, int cons, int luck, Caste usableBy, int armor, double price) : base(name, id, stre, dext, inte, cons, luck, usableBy, price) { this.armor = armor; }
public Monster(int level, string name, int armor, Caste caste) : base(name, armor, caste) { hpmodifier = 3.2; this.level = level; }
/* private readonly Type canBePlaced = new LegSlot().GetType(); */ //public override Type CanBePlaced { get; } = new LegSlot().GetType(); public Leg(string name, int id, int stre, int dext, int inte, int cons, int luck, Caste usableBy, int armor, double price) : base(name, id, stre, dext, inte, cons, luck, usableBy, armor, price) { }
/// <summary> /// Reads a new simulation-state out of stream. /// </summary> /// <returns>New simulation-state or null, if stream is over</returns> public SimulationState Read() { // if stream is at his end, return null if (complete) { return(null); } // first block have to be a frame-start ISerializable block; BlockType blockType = serializer.Read(out block); // detect stream-end if (blockType == BlockType.StreamEnd) { complete = true; return(null); } // unexpected block-type if (blockType != BlockType.FrameStart) { throw new InvalidOperationException( string.Format( CultureInfo.CurrentCulture, Resource.AntvideoReaderInvalidBlockType, blockType)); } // block-loop while (blockType != BlockType.FrameEnd) { blockType = serializer.Read(out block); switch (blockType) { case BlockType.Ant: Ant ant = (Ant)block; antList.Add(ant.Id, ant); break; case BlockType.Anthill: Anthill anthill = (Anthill)block; anthillList.Add(anthill.Id, anthill); break; case BlockType.AntLost: Lost antLost = (Lost)block; antList.Remove(antLost.Id); break; case BlockType.AntUpdate: AntUpdate antUpdate = (AntUpdate)block; antList[antUpdate.Id].Update(antUpdate); break; case BlockType.Bug: Bug bug = (Bug)block; bugList.Add(bug.Id, bug); break; case BlockType.BugLost: Lost bugLost = (Lost)block; bugList.Remove(bugLost.Id); break; case BlockType.BugUpdate: BugUpdate bugUpdate = (BugUpdate)block; bugList[bugUpdate.Id].Update(bugUpdate); break; case BlockType.Caste: Caste caste = (Caste)block; casteList[caste.ColonyId].Add(caste.Id, caste); break; case BlockType.Team: Team team = (Team)block; teamList.Add(team.Id, team); colonyList.Add(team.Id, new Dictionary <int, Colony>()); break; case BlockType.Colony: Colony colony = (Colony)block; colonyList[colony.TeamId].Add(colony.Id, colony); casteList.Add(colony.Id, new Dictionary <int, Caste>()); break; case BlockType.ColonyUpdate: ColonyUpdate colonyUpdate = (ColonyUpdate)block; colonyList[colonyUpdate.TeamId][colonyUpdate.Id].Update(colonyUpdate); break; case BlockType.Frame: frame = (Frame)block; break; case BlockType.FrameUpdate: FrameUpdate frameUpdate = (FrameUpdate)block; frame.Update(frameUpdate); break; case BlockType.Fruit: Fruit fruit = (Fruit)block; fruitList.Add(fruit.Id, fruit); break; case BlockType.FruitLost: Lost fruitLost = (Lost)block; fruitList.Remove(fruitLost.Id); break; case BlockType.FruitUpdate: FruitUpdate fruitUpdate = (FruitUpdate)block; fruitList[fruitUpdate.Id].Update(fruitUpdate); break; case BlockType.Marker: Marker marker = (Marker)block; markerList.Add(marker.Id, marker); break; case BlockType.MarkerLost: Lost markerLost = (Lost)block; markerList.Remove(markerLost.Id); break; case BlockType.MarkerUpdate: MarkerUpdate markerUpdate = (MarkerUpdate)block; markerList[markerUpdate.Id].Update(markerUpdate); break; case BlockType.Sugar: Sugar sugar = (Sugar)block; sugarList.Add(sugar.Id, sugar); break; case BlockType.SugarLost: Lost sugarLost = (Lost)block; sugarList.Remove(sugarLost.Id); break; case BlockType.SugarUpdate: SugarUpdate sugarUpdate = (SugarUpdate)block; sugarList[sugarUpdate.Id].Update(sugarUpdate); break; } } // Detect streamend if ((BlockType)serializer.Peek() == BlockType.StreamEnd) { complete = true; } // Interpolate all elements and buildup state frame.Interpolate(); SimulationState state = frame.GenerateState(); foreach (Bug bug in bugList.Values) { bug.Interpolate(); state.BugStates.Add(bug.GenerateState()); } foreach (Fruit fruit in fruitList.Values) { fruit.Interpolate(); state.FruitStates.Add(fruit.GenerateState()); } foreach (Sugar sugar in sugarList.Values) { sugar.Interpolate(); state.SugarStates.Add(sugar.GenerateState()); } foreach (Team team in teamList.Values) { TeamState teamState = team.GenerateState(); state.TeamStates.Add(teamState); foreach (Colony colony in colonyList[team.Id].Values) { colony.Interpolate(); ColonyState colonyState = colony.GenerateState(); teamState.ColonyStates.Add(colonyState); foreach (Caste caste in casteList[colony.Id].Values) { colonyState.CasteStates.Add(caste.GenerateState()); } foreach (Anthill anthill in anthillList.Values) { if (anthill.ColonyId == colony.Id) { colonyState.AnthillStates.Add(anthill.GenerateState()); } } foreach (Ant ant in antList.Values) { if (ant.ColonyId == colony.Id) { ant.Interpolate(); colonyState.AntStates.Add(ant.GenerateState()); } } foreach (Marker marker in markerList.Values) { if (marker.ColonyId == colony.Id) { marker.Interpolate(); colonyState.MarkerStates.Add(marker.GenerateState()); } } } } // deliver return(state); }
public ActionResult Post(Caste vm) { Caste pt = vm; if (ModelState.IsValid) { if (vm.CasteId <= 0) { pt.IsActive = true; pt.CreatedDate = DateTime.Now; pt.ModifiedDate = DateTime.Now; pt.CreatedBy = User.Identity.Name; pt.ModifiedBy = User.Identity.Name; pt.ObjectState = Model.ObjectState.Added; try { _CasteService.Create(pt); } catch (Exception ex) { ViewBag.Mode = "Add"; string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("Create", vm)); } _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel { DocTypeId = Constants.DocumentTypeIdConstants.Caste, DocId = pt.CasteId, ActivityType = (int)ActivityTypeContants.Added, })); return(RedirectToAction("Create").Success("Data saved successfully")); } else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); Caste temp = _CasteService.Find(pt.CasteId); Caste ExRec = Mapper.Map <Caste>(temp); temp.CasteName = pt.CasteName; temp.IsActive = pt.IsActive; temp.ModifiedDate = DateTime.Now; temp.ModifiedBy = User.Identity.Name; temp.ObjectState = Model.ObjectState.Modified; LogList.Add(new LogTypeViewModel { ExObj = ExRec, Obj = temp, }); XElement Modifications = _modificationCheck.CheckChanges(LogList); try { _CasteService.Update(temp); } catch (Exception ex) { ViewBag.Mode = "Edit"; string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("Create", pt)); } _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel { DocTypeId = Constants.DocumentTypeIdConstants.Caste, DocId = temp.CasteId, ActivityType = (int)ActivityTypeContants.Modified, xEModifications = Modifications, })); return(RedirectToAction("Index").Success("Data saved successfully")); } } return(View("Create", vm)); }
//public override Type CanBePlaced => throw new NotImplementedException(); public Weapon(int id, int stre, int dext, int inte, int cons, int luck, Caste usableBy, double dmg, string name, double price) : base(name, id, stre, dext, inte, cons, luck, usableBy, price) { this.dmg = dmg; }
public Task <int> PostCastes(Caste caste) { return(casteServiceobj.PostCastes(caste)); }
public Task <int> PostCastes(Caste caste) { return(casteRepositoryobj.PostCastes(caste)); }