public ActionResult OnGet(MajorType major, bool isPartial = false) { IsPartial = isPartial; Hero = GetHeroFromCookies(major); Traits = _traitService.GetForHero(Hero); return(IsValid() ? Page() : CustomRedirect(SitePages.MajorHeroGenIndex)); }
public ActionResult OnGet(MajorType major, bool isPartial = false) { Hero = GetHeroFromCookies(major); IsPartial = isPartial; Branches = _branchService.GetAllWithPerks(major); return(IsValid() ? Page() : CustomRedirect(SitePages.MajorHeroGenIndex)); }
private void Prepare(MajorType major, int?id) { Input = _branchService.GetForEdit(id); var bonuses = _bonusService.GetAll(major, (int)BonusType.Branch); Bonuses = _coreLogic.ToSelectableList(bonuses); }
protected HeroModel GetHeroFromCookies(MajorType major) { var cookie = HttpContext.GetCookie(CookieType.Hero); var hero = CoreLogic.DecodeHero(cookie, major); return(hero ?? (User.IsInRole(UserRole.Master.ToString()) ? null : CreateHero(major))); }
private void Prepare(MajorType major, int?id) { Input = _perkService.GetForEdit(id); var branches = _branchService.GetAll(major); Branches = _coreLogic.ToSelectableList(branches); }
public UserViewModel() { User = new User(); Major = new MajorType(); Majors = new List <MajorType>(); RoleOptions = UserManager.GetRoleTypeOptions(); MajorOptions = UserManager.GetMajorTypeOptions(); }
public ActionResult OnPostReset(MajorType major) { IsPartial = true; OnGet(major, true); Hero = _traitService.ResetTraitsForHero(Hero).Object; SaveHeroToCookies(Hero); Traits = _traitService.GetForHero(Hero); return(Page()); }
public ActionResult OnPost(MajorType major, string name) { Hero = GetHeroFromCookies(major); Hero.Name = name; SaveHeroToCookies(Hero); var result = CoreLogic.EncodeHero(Hero, major); return(CustomRedirect(SitePages.SharedMajorHeroSheet, new { cookie = true })); }
private void Prepare(MajorType major, int?id) { Input = _weaponService.GetForEdit(id); var skills = _skillService.SelectSkills(major, SkillType.Weapon); var bonuses = _bonusService.GetAll(major, (int)BonusType.Weapon); Skills = _coreLogic.ToSelectableList(skills, Input.SkillId.ToString()); Bonuses = _coreLogic.ToSelectableList(bonuses); }
private void Prepare(MajorType major, int?id) { Input = _raceService.GetForEdit(id); var abilities = _abilityService.GetAll <AbilityModel>(major); var bonuses = _bonusService.GetAll(major, (int)BonusType.Race); Abilities = _coreLogic.ToSelectableList(abilities); Bonuses = _coreLogic.ToSelectableList(bonuses); }
public virtual IQueryable <T> Select(MajorType major) { var query = base.Select(); if (major != MajorType.Common) { query = query.Where(x => x.MajorId == (int)major); } return(query); }
public IQueryable <SkillViewModel> SelectSkills(MajorType major, SkillType?type, int?branchId = null) { var skills = GetAll(major, (int?)type); if (branchId != null) { skills = skills.Where(x => x.BranchId == branchId); } return(skills); }
public HeroModel CreateHero(MajorType major) { var hero = new HeroModel(major); var abilities = _abilityService.GetAll<AbilityModel>(major); hero.Abilities.List = abilities.ToList(); var settings = _majorService.GetSettings((int)major); hero.Abilities.Setup(settings); hero.MaxStage = 0; return hero; }
public List <BranchViewModel> GetAllWithPerks(MajorType major) { var branches = _branchRepository.Select().ProjectTo <BranchViewModel>(MapperConfig).ToList(); foreach (var branch in branches) { branch.Perks = branch.Perks.SelectMany(x => _perkService.GetPerkRanks(x)).ToList(); } return(branches); }
private void Prepare(MajorType major, int?id) { Input = _skillService.GetForEdit(id); var branches = _branchService.GetAll(major); var abilities = _abilityService.GetAll <AbilityModel>(major); var skillTypes = new Enum[] { SkillType.None, SkillType.Weapon, SkillType.Magic }; Types = _coreLogic.ToSelectableList(skillTypes, Input.Type.ToString()); Branches = _coreLogic.ToSelectableList(branches, Input.BranchId.ToString(), true); Abilities = _coreLogic.ToSelectableList(abilities, Input.AbilityId.ToString(), true); }
public async Task <FileResult> OnGet(MajorType major) { Setup(major); Converter.Margins = new PageMargins { Top = 20, Bottom = 20 }; Converter.PageFooterHtml = "<div style='text-align: center'><b class='page'></b></div>"; return(await LoadPdf(Converter, SitePages.SharedMajorBook, FileType.Book, this)); }
public HeroModel(MajorType major) { Name = ""; Level = 1; Major = major; Charisma = 10; Abilities = new HeroAbilityGroup(); Skills = new HeroSkillGroup(this); Traits = new TraitGroup(); Branches = new BranchGroup(); }
public decimal GetTotalRate(MajorType major) { if (!Completed()) { return(0); } switch (major) { case MajorType.Electronic: return((((((EnglishPercent.Value * 2 + MathPercent.Value * 3 + CircutePercent.Value * 3 + ElectronicsPercent.Value * 4 + MachinePercent.Value * 1 + ControllPercent.Value * 1 + SignalPercent.Value * 2 + MagneticPercent.Value * 2) / (decimal)18) / (decimal)65.23) * (decimal)80) + RateAmount.Value) * 100); case MajorType.PowerSystems: return((((((EnglishPercent.Value * 2 + MathPercent.Value * 3 + CircutePercent.Value * 3 + ElectronicsPercent.Value * 1 + MachinePercent.Value * 4 + ControllPercent.Value * 2 + SignalPercent.Value * 1 + MagneticPercent.Value * 2) / (decimal)18) / (decimal)50) * (decimal)80) + RateAmount.Value) * 100); case MajorType.Machine: return((((((EnglishPercent.Value * 2 + MathPercent.Value * 3 + CircutePercent.Value * 3 + ElectronicsPercent.Value * 1 + MachinePercent.Value * 4 + ControllPercent.Value * 2 + SignalPercent.Value * 2 + MagneticPercent.Value * 1) / (decimal)18) / (decimal)57.5) * (decimal)80) + RateAmount.Value) * 100); case MajorType.FieldComunication: return((((((EnglishPercent.Value * 2 + MathPercent.Value * 3 + CircutePercent.Value * 3 + ElectronicsPercent.Value * 2 + MachinePercent.Value * 1 + ControllPercent.Value * 1 + SignalPercent.Value * 2 + MagneticPercent.Value * 4) / (decimal)18) / (decimal)63.9) * (decimal)80) + RateAmount.Value) * 100); case MajorType.SystemComunication: return((((((EnglishPercent.Value * 2 + MathPercent.Value * 3 + CircutePercent.Value * 3 + ElectronicsPercent.Value * 2 + MachinePercent.Value * 1 + ControllPercent.Value * 1 + SignalPercent.Value * 4 + MagneticPercent.Value * 2) / (decimal)18) / (decimal)63.9) * (decimal)80) + RateAmount.Value) * 100); case MajorType.Control: return((((((EnglishPercent.Value * 2 + MathPercent.Value * 3 + CircutePercent.Value * 3 + ElectronicsPercent.Value * 1 + MachinePercent.Value * 2 + ControllPercent.Value * 4 + SignalPercent.Value * 2 + MagneticPercent.Value * 1) / (decimal)18) / (decimal)59.52) * (decimal)80) + RateAmount.Value) * 100); case MajorType.MedicalEngineering: return((((((EnglishPercent.Value * 2 + MathPercent.Value * 3 + CircutePercent.Value * 3 + ElectronicsPercent.Value * 3 + MachinePercent.Value * 1 + ControllPercent.Value * 4 + SignalPercent.Value * 4 + MagneticPercent.Value * 1) / (decimal)21) / (decimal)59.5) * (decimal)80) + RateAmount.Value) * 100); case MajorType.Mecatronic: return((((((EnglishPercent.Value * 2 + MathPercent.Value * 3 + CircutePercent.Value * 3 + ElectronicsPercent.Value * 4 + MachinePercent.Value * 4 + ControllPercent.Value * 4 + SignalPercent.Value * 1 + MagneticPercent.Value * 1) / (decimal)22) / (decimal)45.2) * (decimal)80) + RateAmount.Value) * 100); default: return(0); } }
public UserViewModel(User user) { User = user; Major = new MajorType(); Majors = new List <MajorType>(); var userMajors = UserManager.GetMajorsByStudentId(user.Id); foreach (var major in userMajors) { Majors.Add(major.Name); } RoleOptions = UserManager.GetRoleTypeOptions(); MajorOptions = UserManager.GetMajorTypeOptions(); }
public IActionResult OnPost(MajorType major) { if (ModelState.IsValid) { Input.MajorId = major; var newId = _branchService.Save(Input); if (Input.Id != newId) { return(CustomRedirect(SitePages.MajorEditorBranchesEdit, new { id = newId })); } } Prepare(major, Input.Id); return(Page()); }
public ActionResult OnPost(MajorType major, int id) { Hero = GetHeroFromCookies(major); var response = _branchService.Assign(Hero, id, 0); if (!response.Successful()) { IsPartial = true; Status = new StatusResult(response.Errors); return(Page()); } Hero = response.Object; return(GoNext()); }
public ActionResult OnPost(MajorType major, AbilityType abilityType, int value) { IsPartial = true; Hero = GetHeroFromCookies(major); var result = _abilityService.UpgradeAbility(Hero, abilityType, value); if (result.Successful()) { Hero = result.Object; SaveHeroToCookies(Hero); return(Page()); } Status = new StatusResult(result.Errors); return(Page()); }
private static MajorType CreateMajorType() { MajorType m = new MajorType(); m.DegreeConcentration = new List <string>(); m.DegreeConcentration.Add("DegreeConcentration"); m.Name = new List <string>(); m.Name.Add("MajorTypeName"); m.ProgramId = new List <EntityIdType>(); EntityIdType id = CreateEntityIdType(); m.ProgramId.Add(id); return(m); }
private static SchoolOrInstitutionTypeDegree CreateSchoolOrInstitutionTypeDegree() { SchoolOrInstitutionTypeDegree s = new SchoolOrInstitutionTypeDegree(); s.Comments = "Commentaar"; s.DatesOfAttendance = new List <DatesOfAttendanceType>(); DatesOfAttendanceType d = CreateDatesOfAttendanceType(); s.DatesOfAttendance.Add(d); s.DegreeClassification = new List <ClassificationType>(); ClassificationType c = CreateClassificationType(); s.DegreeClassification.Add(c); s.DegreeDate = CreateFlexibleDatesType(); s.DegreeMajor = new List <MajorType>(); MajorType ma = CreateMajorType(); s.DegreeMajor.Add(ma); s.DegreeMeasure = CreateEducationalMeasureType(); s.DegreeMinor = new List <MinorType>(); MinorType mi = CreateMinorType(); s.DegreeMinor.Add(mi); s.DegreeName = CreateEduDegreeTypeDegreeName(); s.degreeType = "DegreeType"; s.examPassed = false; s.examPassedSpecified = true; s.graduatingDegree = GraduatingDegreeType.graduating; s.graduatingDegreeSpecified = true; s.OtherHonors = new List <EduDegreeTypeOtherHonors>(); EduDegreeTypeOtherHonors eo = CreateEduDegreeTypeOtherHonors(); s.OtherHonors.Add(eo); return(s); }
public string GetPredictedRank(MajorType major) { var rate = GetTotalRate(major); if (rate == 0) { return(""); } var ranks = Configure.Container.Resolve <IMongoDatabase>().GetCollection <DecisionData>("RateRankMapping"); var rank2 = ranks.AsQueryable().Where(it => it.Balance > rate && it.MajorType == major).OrderBy(it => it.Balance).FirstOrDefault(); //var rank = DecisionTable.GetRateRankMapping().FirstOrDefault(it => it.FromRate <= rate && it.ToRate >= rate && it.MajorType== major); if (rank2 == null) { return(""); } return($"رتبه {rank2.Rank}"); }
private void Setup(MajorType major) { var url = HttpContext.Request.GetDisplayUrl(); IsLocal = url.Contains("localhost"); RootPath = url.Remove(url.IndexOf("shared")); Abilities = _abilityService.GetAll <AbilityDescriptionModel>(major).ToList(); Races = _raceService.GetAll(major).ToList(); Branches = _branchService.GetAllWithPerks(major); Traits = _traitService.GetAll(major).ToList(); Skills = _skillService.GetAll(major).ToList(); if (major != MajorType.Fantasy) { return; } MagicSchools = _magicService.GetAllSchools().ToList(); Alchemy = _alchemyService.GetSummary(); }
public ActionResult OnPost(MajorType major, int id) { IsPartial = true; Hero = GetHeroFromCookies(major); var response = _traitService.AssignTraitToHero(Hero, id); if (!response.Successful()) { IsPartial = true; Status = new StatusResult(response.Errors); Traits = _traitService.GetForHero(Hero); return(Page()); } Hero = response.Object; SaveHeroToCookies(Hero); Traits = _traitService.GetForHero(Hero); return(Page()); }
/// <summary> /// Turns the _AMMediaType into a string representation /// </summary> public static string Dump(_AMMediaType mt) { string ret = "\r\nMedia Type\r\n"; ret += string.Format("\tbFixedSizeSamples : {0}\r\n", mt.bFixedSizeSamples); ret += string.Format("\tbTemporalCompression : {0}\r\n", mt.bTemporalCompression); ret += string.Format("\tcbFormat : {0}\r\n", mt.cbFormat); ret += string.Format("\tformattype : {0}\r\n", FormatType.GuidToString(mt.formattype)); ret += string.Format("\tlSampleSize : {0}\r\n", mt.lSampleSize); ret += string.Format("\tmajortype : {0}\r\n", MajorType.GuidToString(mt.majortype)); ret += string.Format("\tpbFormat : {0}\r\n", ((int)mt.pbFormat)); ret += string.Format("\tsubtype : {0}", SubType.GuidToString(mt.subtype)); object formatBlock = FormatType.MarshalData(mt); if (formatBlock != null) { ret += FormatType.Dump(formatBlock); } return(ret); }
public async Task <FileResult> OnGet(MajorType major, bool getFromCookies = false) { var url = HttpContext.Request.GetDisplayUrl(); RootPath = url.Remove(url.IndexOf("shared")); Converter.Orientation = PageOrientation.Landscape; if (getFromCookies) { var encoded = HttpContext.GetCookie(CookieType.Hero); Hero = _coreLogic.DecodeHero(encoded, major); } if (Hero == null) { getFromCookies = false; Hero = _coreLogic.CreateHero(major); } var fileType = getFromCookies ? FileType.FilledHeroSheet : FileType.BaseHeroSheet; Hero.Skills = _skillService.GetHeroSkillGroup(Hero); return(await LoadPdf(Converter, SitePages.SharedMajorHeroSheet, fileType, this, getFromCookies)); }
public IQueryable <BonusViewModel> GetAll(MajorType major, int?filter = null) { var query = _bonusRepository.Select(major).ProjectTo <BonusViewModel>(MapperConfig); return(filter is null ? query : query.Where(x => (int)x.Type == filter)); }
internal static byte[] GetIndefiniteHeader(MajorType type) { return new byte[] { (byte)(((byte)type) << 5 | 31) }; }
// Below are used only for the Encoder and should not ever be used by a 3rd party internal ItemHeader(MajorType type, ulong value, List<ItemTag> tags = null) { this.majorType = type; this.value = value; this.tags = tags; }
public static bool ParseMajor(string major, ref MajorType major_type) { if (string.Compare (major, "s") == 0) major_type = MajorType.MajorSerial; else if (string.Compare (major, "c") == 0) major_type = MajorType.MajorConcurrent; else if (string.Compare (major, "cp") == 0) major_type = MajorType.MajorConcurrentPar; else return false; return true; }
public static List<double>[] RunMono(string mono, string[] args, string workingDirectory, MajorType major_type) { Process p = new Process (); p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = mono; p.StartInfo.WorkingDirectory = workingDirectory; p.StartInfo.Arguments = string.Join (" ", args.Select<string, string> (arg => "\"" + arg + "\"")); switch (major_type) { case MajorType.MajorSerial: AddMonoOption (p, "MONO_GC_PARAMS", "major=marksweep"); break; case MajorType.MajorConcurrent: AddMonoOption (p, "MONO_GC_PARAMS", "major=marksweep-conc"); break; case MajorType.MajorConcurrentPar: AddMonoOption (p, "MONO_GC_PARAMS", "major=marksweep-conc-par"); break; } AddMonoOption (p, "MONO_GC_DEBUG", "binary-protocol=" + binprotFile); Console.WriteLine ("Run {0}, Major Type {1}", mono, major_type); Thread.Sleep (1000); p.Start (); DateTime startTime = DateTime.Now.AddMilliseconds (deltaHack); List<double> timestamps = new List<double> (); List<double> memoryUsage = new List<double> (); while (!p.HasExited) { DateTime now = DateTime.Now; timestamps.Add (((double)(now - startTime).TotalMilliseconds) / 1000); memoryUsage.Add ((double)p.WorkingSet64 / 1000000); Thread.Sleep (1); } p.WaitForExit (); return new List<double>[] {timestamps, memoryUsage}; }