public static List <CareerLevel> AllLevels(Sims3.Gameplay.Careers.Career job) { List <CareerLevel> list = new List <CareerLevel>(); if (job != null) { CareerLevel level1 = job.Level1; if (level1 != null) { list.Add(level1); int index = 0; while (index < list.Count) { CareerLevel level = list[index]; index++; foreach (CareerLevel next in level.NextLevels) { list.Add(next); } } } } return(list); }
public List <CareerLevel> GetCareerLevel() { List <CareerLevel> careerLevelList = new List <CareerLevel>(); using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(connectionString); command.CommandType = CommandType.StoredProcedure; command.CommandText = "GetCareerLevel"; command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); // Call Read before accessing data. while (reader.Read()) { CareerLevel careerLevel = new CareerLevel(); careerLevel.CLID = reader["CLID"] != null?Convert.ToInt32(reader["CLID"]) : 0; careerLevel.CareerLev = Convert.ToString(reader["CL"]); careerLevelList.Add(careerLevel); } // Call Close when done reading. reader.Close(); } return(careerLevelList); }
/// <summary> /// Delete User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> DeleteCareerLevel(int CareerLevelId) { #region Declare a return type with initial value. bool isCareerLevelDeleted = default(bool); #endregion try { if (CareerLevelId > default(int)) { #region Vars CareerLevel CareerLevel = null; #endregion #region Get CareerLevel by id CareerLevel = await UnitOfWork.CareerLevelRepository.GetById((byte)CareerLevelId); #endregion #region check if object is not null if (CareerLevel != null) { CareerLevel.IsDeleted = (byte)DeleteStatusEnum.Deleted; #region Apply the changes to the database UnitOfWork.CareerLevelRepository.Update(CareerLevel); isCareerLevelDeleted = await UnitOfWork.Commit() > default(int); #endregion } #endregion } } catch (Exception exception) { } return(isCareerLevelDeleted); }
public static List <CareerLevel> LevelsBetween(CareerLevel lowLevel, CareerLevel highLevel, bool reverse) { List <CareerLevel> order = new List <CareerLevel>(); if ((lowLevel != null) && (highLevel != null)) { order.Add(highLevel); CareerLevel curLevel = highLevel.LastLevel; while (curLevel != null) { if (reverse) { order.Add(curLevel); } else { order.Insert(0, curLevel); } if (curLevel == lowLevel) { return(order); } curLevel = curLevel.LastLevel; } } order.Clear(); return(order); }
public override void RunEvent(Career c) { Career newCareer = NewCareer as Career; if (newCareer == null) { return; } int newCareerLevel = this.GetNewCareerLevel(c); CareerLevel level = null; foreach (Dictionary <int, CareerLevel> dictionary in newCareer.CareerLevels.Values) { if (dictionary.TryGetValue(newCareerLevel, out level)) { ObjectGuid simObjectId = new ObjectGuid(); if (c.OwnerDescription.CreatedSim != null) { simObjectId = c.OwnerDescription.CreatedSim.ObjectId; } if (Display(LocalizeString(c.OwnerDescription.IsFemale, mStringKey, new object[] { c.OwnerDescription, level.GetLocalizedName(c.OwnerDescription), level.Level, c.CurLevel.GetLocalizedName(c.OwnerDescription), c.CareerLevel }), simObjectId, c.OwnerDescription.IsFemale, c)) { DoTransfer(c, newCareerLevel); } break; } } }
/// <summary> /// Mapping User Activity Log DTO to Action /// </summary> /// <param name=></param> /// <param name=></param> /// <returns></returns> public CareerLevel MappingCareerLevelupdateDTOToCareerLevel(CareerLevel careerLevel, CareerLevelUpdateDTO CareerLevelUpdateDTO) { #region Declare Return Var with Intial Value CareerLevel CareerLevel = careerLevel; #endregion try { if (CareerLevelUpdateDTO.CareerLevelId > default(int)) { CareerLevel.CareerLevelId = CareerLevelUpdateDTO.CareerLevelId; CareerLevel.CareerLevelName = CareerLevelUpdateDTO.CareerLevelName; } } catch (Exception exception) { } return(CareerLevel); }
public static void Promote(Sims3.Gameplay.Careers.Career job, CareerLevel newLevel) { CareerLevel curLevel = job.CurLevel; int bonusAmount = job.GivePromotionBonus(); job.GivePromotionRewardObjectsIfShould(newLevel); job.SetLevel(newLevel); job.OnPromoteDemote(curLevel, newLevel); if (job.OwnerDescription.CreatedSim != null) { job.SetTones(job.OwnerDescription.CreatedSim.CurrentInteraction); } job.ShowOccupationTNS(job.GeneratePromotionText(bonusAmount)); }
public static List <CareerLevel> AllBranches(CareerLevel level) { List <CareerLevel> branches = new List <CareerLevel>(); while (level != null) { if (level.NextLevels.Count > 1) { branches.Add(level); } level = level.LastLevel; } return(branches); }
/// <summary> /// Mapping user Action Actitvity Log /// </summary> /// <param name=></ param > /// <returns>Task<CareerLevel></returns> public CareerLevel MappingCareerLevelAddDTOToCareerLevel(CareerLevelAddDTO CareerLevelAddDTO) { #region Declare a return type with initial value. CareerLevel CareerLevel = null; #endregion try { CareerLevel = new CareerLevel { CareerLevelName = CareerLevelAddDTO.CareerLevelName, CreationDate = DateTime.Now, IsDeleted = (byte)DeleteStatusEnum.NotDeleted }; } catch (Exception exception) { } return(CareerLevel); }
public void UpdateName(string name) { if (name == null) { return; } mName = name; if (mOriginalLevelData != null) { mCurLevel = new CareerLevel(mOriginalLevelData, name, SharedData.ProductVersion); } if (OwnerDescription.CareerManager != null) { OwnerDescription.CareerManager.UpdateCareerUI(); } }
public CareerLevelReturnDTO MappingCareerLevelToCareerLevelReturnDTO(CareerLevel CareerLevel) { #region Declare a return type with initial value. CareerLevelReturnDTO CareerLevelReturnDTO = null; #endregion try { if (CareerLevel != null) { CareerLevelReturnDTO = new CareerLevelReturnDTO { CareerLevelId = CareerLevel.CareerLevelId, CareerLevelName = CareerLevel.CareerLevelName }; } } catch (Exception exception) { } return(CareerLevelReturnDTO); }
/// <summary> /// Get user Action Activity Log By Id /// </summary> /// <returns>List<CareerLevelReturnDTO></returns> public async Task <CareerLevelReturnDTO> GetCareerLevelById(int CareerLevelId) { #region Declare a return type with initial value. CareerLevelReturnDTO CareerLevel = new CareerLevelReturnDTO(); #endregion try { CareerLevel careerLevel = await UnitOfWork.CareerLevelRepository.GetById((byte)CareerLevelId); if (careerLevel != null) { if (careerLevel.IsDeleted != (byte)DeleteStatusEnum.Deleted) { CareerLevel = CareerLevelMapping.MappingCareerLevelToCareerLevelReturnDTO(careerLevel); } } } catch (Exception exception) { } return(CareerLevel); }
/// <summary> /// Create User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> AddCareerLevel(CareerLevelAddDTO CareerLevelAddDTO) { #region Declare a return type with initial value. bool isCareerLevelCreated = default(bool); #endregion try { #region Vars CareerLevel CareerLevel = null; #endregion CareerLevel = CareerLevelMapping.MappingCareerLevelAddDTOToCareerLevel(CareerLevelAddDTO); if (CareerLevel != null) { await UnitOfWork.CareerLevelRepository.Insert(CareerLevel); isCareerLevelCreated = await UnitOfWork.Commit() > default(int); } } catch (Exception exception) { } return(isCareerLevelCreated); }
/// <summary> /// Update User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> UpdateCareerLevel(CareerLevelUpdateDTO CareerLevelUpdateDTO) { #region Declare a return type with initial value. bool isCareerLevelUpdated = default(bool); #endregion try { if (CareerLevelUpdateDTO != null) { #region Vars CareerLevel CareerLevel = null; #endregion #region Get Activity By Id CareerLevel = await UnitOfWork.CareerLevelRepository.GetById((byte)CareerLevelUpdateDTO.CareerLevelId); #endregion if (CareerLevel != null) { #region Mapping CareerLevel = CareerLevelMapping.MappingCareerLevelupdateDTOToCareerLevel(CareerLevel, CareerLevelUpdateDTO); #endregion if (CareerLevel != null) { #region Update Entity UnitOfWork.CareerLevelRepository.Update(CareerLevel); isCareerLevelUpdated = await UnitOfWork.Commit() > default(int); #endregion } } } } catch (Exception exception) { } return(isCareerLevelUpdated); }
protected override bool PrivateUpdate(ScenarioFrame frame) { LifetimeWant lifetimeWant = (LifetimeWant)Sim.LifetimeWish; bool prompt = (GetValue <PromptOption, bool>()) && (Careers.MatchesAlertLevel(Sim)); DreamNodeInstance instance = null; DreamsAndPromisesManager.sMajorWishes.TryGetValue(Sim.LifetimeWish, out instance); if (instance == null) { if (!prompt) { IncStat("No LTW"); return(false); } } else if (instance.InputSubject == null) { IncStat("No InputSubject"); return(false); } Career career = Sim.Occupation as Career; CareerLevel prior = career.CurLevel.LastLevel; if (prior == null) { IncStat("No Prior"); return(false); } if (prior.NextLevels.Count != 2) { IncStat("Not Branch"); return(false); } CareerLevel newLevel = null; if (prompt) { bool flag = TwoButtonDialog.Show( ManagerSim.GetPersonalInfo(Sim, Common.LocalizeEAString(Sim.IsFemale, career.SharedData.Text_BranchOffer, new object[] { Sim })), Common.LocalizeEAString(Sim.IsFemale, career.SharedData.Text_Branch1, new object[0]), Common.LocalizeEAString(Sim.IsFemale, career.SharedData.Text_Branch2, new object[0]) ); if (flag) { if (prior.NextLevels[0] == career.CurLevel) { return(false); } newLevel = prior.NextLevels[0]; } else { if (prior.NextLevels[1] == career.CurLevel) { return(false); } newLevel = prior.NextLevels[1]; } } else if (instance.InputSubject != null) { if (instance.InputSubject.mType != DreamNodePrimitive.InputSubjectType.Career) { IncStat("Not Career LTW"); return(false); } switch (career.Guid) { case OccupationNames.Music: if (lifetimeWant == LifetimeWant.RockStar) { if (career.CurLevelBranchName == "ElectricRock") { IncStat("ElectricRock"); return(false); } } else { if (career.CurLevelBranchName != "ElectricRock") { IncStat("Not ElectricRock"); return(false); } } break; case OccupationNames.Criminal: if (lifetimeWant == LifetimeWant.TheEmperorOfEvil) { if (career.CurLevelBranchName == "Evil") { IncStat("Evil"); return(false); } } else { if (career.CurLevelBranchName != "Evil") { IncStat("Not Evil"); return(false); } } break; case OccupationNames.LawEnforcement: if (lifetimeWant == LifetimeWant.ForensicSpecialistDynamicDNAProfiler) { if (career.CurLevelBranchName == "ForensicAnalyst") { IncStat("Forensic"); return(false); } } else { if (career.CurLevelBranchName != "ForensicAnalyst") { IncStat("Not Forensic"); return(false); } } break; case OccupationNames.Film: if (lifetimeWant == LifetimeWant.FileActor) { if (career.CurLevelBranchName == "Acting") { IncStat("Acting"); return(false); } } else { if (career.CurLevelBranchName != "Acting") { IncStat("Not Acting"); return(false); } } break; default: return(false); } foreach (CareerLevel level in prior.NextLevels) { if (career.CurLevel == level) { continue; } newLevel = level; break; } } if (newLevel == null) { return(false); } CareerLevel curLevel = career.CurLevel.LastLevel; career.GivePromotionRewardObjectsIfShould(newLevel); career.SetLevel(newLevel); try { PromotedScenario.AddSuppressed(Sim); career.OnPromoteDemote(curLevel, newLevel); } finally { PromotedScenario.RemoveSuppressed(Sim); } if (Sim.CreatedSim != null) { career.SetTones(Sim.CreatedSim.CurrentInteraction); } return(true); }
public static void OnAccepted(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { try { OccupationNames careerName = actor.Occupation.Guid; bool success = false; if (target.Occupation == null) { Career career = CareerManager.GetStaticCareer(careerName); if (career == null) { return; } string branch = actor.Occupation.CurLevelBranchName; CareerLocation location = Career.FindClosestCareerLocation(target.SimDescription, careerName); if (location == null) { return; } if (target.SimDescription.AcquireOccupation(new AcquireOccupationParameters(location, false, false))) { success = true; } } else { int level = 1; if (target.Occupation.Guid == actor.Occupation.Guid) { Career actorCareer = actor.Occupation as Career; CareerLevel curLevel = actorCareer.CurLevel; while (curLevel.LastLevel != null) { curLevel = curLevel.LastLevel; if (curLevel.NextLevels.Count > 1) { break; } } if (curLevel != null) { level = curLevel.Level; } } Career staticCareer = CareerManager.GetStaticCareer(careerName); if ((target.Occupation != null) && (careerName != OccupationNames.Undefined) && (actor.Occupation.CurLevelBranchName != null) && (staticCareer != null)) { target.Occupation.LeaveJob(Career.LeaveJobReason.kTransfered); CareerLocation location = Career.FindClosestCareerLocation(target.SimDescription, staticCareer.Guid); if (location != null) { CareerLevel careerLevel = null; if (actor.Occupation.CurLevelBranchName != null) { Dictionary <int, CareerLevel> dictionary = null; if (staticCareer.CareerLevels.TryGetValue(actor.Occupation.CurLevelBranchName, out dictionary)) { dictionary.TryGetValue(level, out careerLevel); } } if (careerLevel == null) { foreach (Dictionary <int, CareerLevel> dictionary2 in staticCareer.CareerLevels.Values) { if (dictionary2.TryGetValue(level, out careerLevel)) { break; } } } if (careerLevel != null) { Occupation staticOccupation = CareerManager.GetStaticOccupation(actor.Occupation.Guid); if (staticOccupation != null) { staticOccupation.DoTransferOfOccupation(target.SimDescription, careerLevel.BranchName, careerLevel.Level); success = true; } } } } } if (success) { OmniCareer job = actor.Occupation as OmniCareer; if (job != null) { job.AddToRecruits(); } } } catch (Exception e) { Common.Exception(actor, target, e); } }
public Item(SimDescription sim, CareerLevel level) : base(level.GetLocalizedName(sim), level.Level) { mLevel = level; }
public EmployeeSearchResult[] FindPotentialEmployeesForCustomer(int customerId, Skill[] skills, CareerLevel[] level, DateTime from, DateTime though) { return new[] { new EmployeeSearchResult { Distance = 10.1F, EmployeeName = "Dummy, CrashTest", Skills = new[] { Skill.SqlServer, Skill.CSharp } } }; }
public static List<CareerLevel> LevelsBetween(CareerLevel lowLevel, CareerLevel highLevel, bool reverse) { List<CareerLevel> order = new List<CareerLevel>(); if ((lowLevel != null) && (highLevel != null)) { order.Add(highLevel); CareerLevel curLevel = highLevel.LastLevel; while (curLevel != null) { if (reverse) { order.Add(curLevel); } else { order.Insert(0, curLevel); } if (curLevel == lowLevel) { return order; } curLevel = curLevel.LastLevel; } } order.Clear(); return order; }
public static List<CareerLevel> AllBranches(CareerLevel level) { List<CareerLevel> branches = new List<CareerLevel>(); while (level != null) { if (level.NextLevels.Count > 1) { branches.Add(level); } level = level.LastLevel; } return branches; }
protected override bool Run(SimDescription me, bool singleSelection) { Sims3.Gameplay.Careers.Career career = me.Occupation as Sims3.Gameplay.Careers.Career; if (career != null) { List <CareerLevel> levels = AllLevels(career); if ((levels == null) || (levels.Count == 0)) { return(false); } List <Item> allOptions = new List <Item>(); foreach (CareerLevel level in levels) { allOptions.Add(new Item(me, level)); } Item choice = new CommonSelection <Item>(Name, me.FullName, allOptions).SelectSingle(); if (choice == null) { return(false); } List <CareerLevel> order = null; if (choice.mLevel.Level < me.Occupation.CareerLevel) { order = LevelsBetween(choice.mLevel, career.CurLevel, true); } else { order = LevelsBetween(career.CurLevel, choice.mLevel, false); } if (order.Count == 0) { List <CareerLevel> oldBranches = AllBranches(career.CurLevel); List <CareerLevel> newBranches = AllBranches(choice.mLevel); CareerLevel common = null; foreach (CareerLevel branch in newBranches) { if (oldBranches.Contains(branch)) { common = branch; break; } } if (common != null) { order.AddRange(LevelsBetween(common, career.CurLevel, true)); order.AddRange(LevelsBetween(common, choice.mLevel, false)); } } foreach (CareerLevel level in order) { if (career.CurLevel == level) { continue; } if (career.CurLevel.LastLevel == level) { career.DemoteSim(); } else { Promote(career, level); } } return(true); } else { XpBasedCareer xpCareer = me.Occupation as XpBasedCareer; if (xpCareer != null) { List <Item> allOptions = new List <Item>(); for (int level = 1; level <= xpCareer.HighestLevel; level++) { allOptions.Add(new Item(xpCareer.LevelJobTitle(level), level)); } Item choice = new CommonSelection <Item>(Name, me.FullName, allOptions).SelectSingle(); if (choice == null) { return(false); } if (choice.mXPLevel < me.Occupation.CareerLevel) { xpCareer.mLevel = choice.mXPLevel; xpCareer.mXp = 0; } else { Dictionary <DelegateListener, ProcessEventDelegate> retain = new Dictionary <DelegateListener, ProcessEventDelegate>(); Dictionary <ulong, List <EventListener> > dictionary; EventTracker.Instance.mListeners.TryGetValue((ulong)EventTypeId.kActiveCareerAdvanceLevel, out dictionary); // Required to stop a hang when an inactive firefighter is promoted to level 10 if (me.Household != Household.ActiveHousehold) { foreach (List <EventListener> list in dictionary.Values) { foreach (EventListener listener in list) { DelegateListener delListener = listener as DelegateListener; if (delListener != null) { RewardsManager.OccupationRewardInfo target = delListener.mProcessEvent.Target as RewardsManager.OccupationRewardInfo; if (target != null) { retain.Add(delListener, delListener.mProcessEvent); delListener.mProcessEvent = OnStub; } } } } } xpCareer.ForcePromoteToLevel(choice.mXPLevel); if (me.Household != Household.ActiveHousehold) { foreach (List <EventListener> list in dictionary.Values) { foreach (EventListener listener in list) { DelegateListener delListener = listener as DelegateListener; if (delListener != null) { RewardsManager.OccupationRewardInfo target = delListener.mProcessEvent.Target as RewardsManager.OccupationRewardInfo; if (target != null) { delListener.mProcessEvent = retain[delListener]; } } } } } } return(true); } } return(false); }