Example #1
0
 private IEnumerable<SelectListItem> BuildOccupationList(Occupation occupation)
 {
     return
         Enum.GetValues(typeof(Occupation))
         .Cast<Occupation>()
         .Select(x => new SelectListItem() { Text = x.ToString(), Selected = x == occupation, Value = HomeModel.OccupationId(x) });
 }
	public void SetOccupation(Occupation occupation){
		if (((Adult)Age).Occupation is Businessman) {
			dbManager.BuildingDB.BusinessOffice.Workers.Remove(this);
		} else if (((Adult)Age).Occupation is Recruiter) {
			dbManager.BuildingDB.RecruitmentCenter.Workers.Remove(this);
		} else if (((Adult)Age).Occupation is Researcher) {
			dbManager.BuildingDB.ResearchFacility.Workers.Remove(this);
		} else if (((Adult)Age).Occupation is Teacher) {
			dbManager.BuildingDB.GradeSchool.Workers.Remove(this);
		} else if (((Adult)Age).Occupation is WorldDomination) {
			//can't take supervillain out of world domination
		}

		((Adult)Age).Occupation = occupation;

		if (occupation is Businessman) {
			dbManager.BuildingDB.BusinessOffice.Workers.Add(this);
		} else if (occupation is Recruiter) {
			dbManager.BuildingDB.RecruitmentCenter.Workers.Add(this);
		} else if (occupation is Researcher) {
			dbManager.BuildingDB.ResearchFacility.Workers.Add(this);
		} else if (occupation is Teacher) {
			dbManager.BuildingDB.GradeSchool.Workers.Add(this);
		} else if (occupation is WorldDomination) {
			dbManager.BuildingDB.World.Workers.Add(this);
		}
	}
Example #3
0
 public Node(Vector3 geoLocation)
 {
     this.geoLocation = geoLocation;
     neighbors = new List<Node> (3);
     roads = new List<Edge> (3);
     adjTiles = new List<Tile> (3);
     occupied = Occupation.none;
     owner = null;
     visual = null;
 }
Example #4
0
        protected bool IsCoworker(Occupation career, SimDescription me)
        {
            if (career == null) return false;

            if (career.Coworkers == null) return false;

            if (career.Coworkers.Contains(me)) return true;

            return (career.Boss == me);
        }
Example #5
0
 /// <summary>
 /// Creates a new person
 /// </summary>
 /// <param name="household">The household that this person belongs to, may not be null!</param>
 /// <param name="id">The identifyer for this person</param>
 /// <param name="age">The age of this person</param>
 /// <param name="employmentStatus">How this person is employed, if at all</param>
 /// <param name="studentStatus">If this person is a student, and if so what type of student</param>
 /// <param name="female">Is this person female</param>
 /// <param name="licence">Does this person have a driver's licence</param>
 public Person(ITashaHousehold household, int id, int age, Occupation occupation, TTSEmploymentStatus employmentStatus, StudentStatus studentStatus, bool license, bool female)
     : this()
 {
     Household = household;
     Id = id;
     Age = age;
     Occupation = occupation;
     EmploymentStatus = employmentStatus;
     StudentStatus = studentStatus;
     Licence = license;
     Female = female;
 }
Example #6
0
 /// <summary>
 /// Creates a new person
 /// </summary>
 /// <param name="household">The household that this person belongs to, may not be null!</param>
 /// <param name="id">The identifyer for this person</param>
 /// <param name="age">The age of this person</param>
 /// <param name="employmentStatus">How this person is employed, if at all</param>
 /// <param name="studentStatus">If this person is a student, and if so what type of student</param>
 /// <param name="female">Is this person female</param>
 /// <param name="licence">Does this person have a driver's licence</param>
 public Person(ITashaHousehold household, int id, int age, Occupation occupation, TTSEmploymentStatus employmentStatus, StudentStatus studentStatus, bool license, bool female)
     : this()
 {
     this.Household = household;
     this.Id = id;
     this.Age = age;
     this.Occupation = occupation;
     this.EmploymentStatus = employmentStatus;
     this.StudentStatus = studentStatus;
     this.Licence = license;
     this.Female = female;
 }
Example #7
0
 public Person(string currZone)
 {
     ZoneID = currZone;
     Age = Age.EighteenToTwentyFive;
     Sex = Sex.Male;
     EducationLevel = EducationLevel.primary;
     household = new Household();
     Occupation = Occupation.TradesProfessional;
     PublicTransitPass = PublicTransitPass.MetroPass;
     EmploymentStatus = EmploymentStatus.PartTime;
     DrivingLicense = DrivingLicense.No;
     Type = AgentType.Person;
     myID = idCounter++;
 }
Example #8
0
 private Person(Person original)
 {
     Type = AgentType.Person;
     //copy the values
     ZoneID = original.ZoneID;
     Age = original.Age;
     Sex = original.Sex;
     EducationLevel = original.EducationLevel;
     Occupation = original.Occupation;
     PublicTransitPass = original.PublicTransitPass;
     EmploymentStatus = original.EmploymentStatus;
     DrivingLicense = original.DrivingLicense;
     household = original.household;
     myID = idCounter++;
 }
        public ActionResult Edit(int id, int OccupationType)
        {
            var Occupation = new Occupation();

            TryUpdateModel(Occupation);
            var constituentId =  Convert.ToInt32(Session["constituentId"]);
            Occupation.Type = new OccupationType {Id = OccupationType};
            Occupation.Address = new Address() {Id = 1};
            Occupation.Constituent = new Constituent {Id = constituentId};
            mapper = new AutoDataContractMapper();
            var OccupationData = new OccupationData();
            mapper.Map(Occupation, OccupationData);

            HttpHelper.Put(string.Format(serviceBaseUri+"/Occupations/{0}",id), OccupationData);
            return PartialView(new GridModel(GetOccupations()));
        }
Example #10
0
        public SafeStore(SimDescription sim, Flag flags)
        {
            mSim = sim;

            mNeverSelectable = mSim.IsNeverSelectable;
            mSim.IsNeverSelectable = false;

            mFlags = flags;

            if ((mFlags & Flag.StoreOpportunities) == Flag.StoreOpportunities)
            {
                mOpportunities = new OpportunityStore(mSim, false);
            }

            mRole = mSim.AssignedRole;

            if ((flags & Flag.OnlyAcademic) == Flag.OnlyAcademic)
            {
                if (!GameUtils.IsUniversityWorld())
                {
                    // Bypass for a removal during OnBecameSelectable()
                    mCareer = mSim.OccupationAsAcademicCareer;
                }
            }
            else
            {
                mCareer = mSim.Occupation;
            }

            if (mCareer != null)
            {
                mSim.CareerManager.mJob = null;
            }

            if ((mSim.CareerManager != null) && ((flags & Flag.School) == Flag.School))
            {
                mSchool = mSim.CareerManager.School;
                if (mSchool != null)
                {
                    mSim.CareerManager.mSchool = null;
                }
            }

            mSim.AssignedRole = null;
        }
 private void SaveWorkerData(IZone[] zones, Occupation occupation, TTSEmploymentStatus empStat, float[] workers)
 {
     using (StreamWriter writer = new StreamWriter(BuildFileName(occupation, empStat, WorkerForceDirectory)))
     {
         writer.WriteLine("Zone,Persons");
         for(int i = 0; i < workers.Length; i++)
         {
             if(workers[i] > 0)
             {
                 writer.Write(zones[i].ZoneNumber);
                 writer.Write(',');
                 writer.WriteLine(workers[i]);
             }
         }
     }
 }
 private void SaveWorkerCategoryData(IZone[] zones, Occupation occupation, TTSEmploymentStatus empStat, float[][] workers)
 {
     using (StreamWriter writer = new StreamWriter(BuildFileName(occupation, empStat, WorkerCategoryDirectory)))
     {
         writer.WriteLine("Zone,WorkerCategory,Persons");
         for(int i = 0; i < workers.Length; i++)
         {
             var factor = 1.0f / workers[i].Sum();
             if(float.IsNaN(factor))
             {
                 continue;
             }
             for(int cat = 0; cat < workers[i].Length; cat++)
             {
                 workers[i][cat] *= factor;
             }
             for(int cat = 0; cat < workers[i].Length; cat++)
             {
                 if(workers[i][cat] > 0)
                 {
                     writer.Write(zones[i].ZoneNumber);
                     writer.Write(',');
                     writer.Write(cat + 1);
                     writer.Write(',');
                     writer.WriteLine(workers[i][cat]);
                 }
             }
         }
     }
 }
 private string BuildFileName(Occupation occ, TTSEmploymentStatus empStat, FileLocation fileLocation)
 {
     var dirPath = fileLocation.GetFilePath();
     var info = new DirectoryInfo(dirPath);
     if(!info.Exists)
     {
         info.Create();
     }
     StringBuilder buildFileName = new StringBuilder();
     switch(occ)
     {
         case Occupation.Professional:
             buildFileName.Append("P");
             break;
         case Occupation.Office:
             buildFileName.Append("G");
             break;
         case Occupation.Retail:
             buildFileName.Append("S");
             break;
         case Occupation.Manufacturing:
             buildFileName.Append("M");
             break;
     }
     switch(empStat)
     {
         case TTSEmploymentStatus.FullTime:
             buildFileName.Append("F.csv");
             break;
         case TTSEmploymentStatus.PartTime:
             buildFileName.Append("P.csv");
             break;
     }
     return Path.Combine(dirPath, buildFileName.ToString());
 }
 public void SetOccupation(Occupation occupation)
 {
     //set Occupation in supervillain object and in building where supervillain works
     supervillain.SetOccupation(occupation);
 }
Example #15
0
 public void SetOccupation(Occupation eOccu)
 {
     Occupation = eOccu;
 }
        public static void EnsureVacationDays(Occupation ths, float hours)
        {
            int count = (int)hours / 24;

            bool flag = false;
            while ((ths.HoursUntilWork <= hours) && (count >= 0))
            {
                ths.mUnpaidDaysOff++;
                ths.SetHoursUntilWork();
                flag = true;

                count--;
            }

            if (flag)
            {
                Sim ownerSim = ths.OwnerSim;
                if (ownerSim != null)
                {
                    EventTracker.SendEvent(EventTypeId.kOccupationTookUnpaidTimeOff, ownerSim);
                }
            }
        }
	public Adult(Occupation occupation){
		this.occupation = occupation;
	}
Example #18
0
        // From Career
        public static int CalculateBoostedStartingLevel(Occupation career)
        {
            int result = -1;
            int careerLevelBonusFromDegree = -1;
            if (career.OwnerDescription.CareerManager.DegreeManager != null)
            {
                AcademicDegree degreeForOccupation = career.OwnerDescription.CareerManager.DegreeManager.GetDegreeForOccupation(career.Guid);
                if ((degreeForOccupation != null) && degreeForOccupation.IsDegreeCompleted)
                {
                    switch (degreeForOccupation.CurrentGpaAsLetterGrade)
                    {
                        case AcademicsUtility.AcademicGrade.D:
                            careerLevelBonusFromDegree = Career.kCareerBonusesForDegreeWithGradeOfD.kCareerLevelBonusFromDegree;
                            break;

                        case AcademicsUtility.AcademicGrade.C:
                            careerLevelBonusFromDegree = Career.kCareerBonusesForDegreeWithGradeOfC.kCareerLevelBonusFromDegree;
                            break;

                        case AcademicsUtility.AcademicGrade.B:
                            careerLevelBonusFromDegree = Career.kCareerBonusesForDegreeWithGradeOfB.kCareerLevelBonusFromDegree;
                            break;

                        case AcademicsUtility.AcademicGrade.A:
                            careerLevelBonusFromDegree = Career.kCareerBonusesForDegreeWithGradeOfA.kCareerLevelBonusFromDegree;
                            break;
                    }
                }
            }

            result = Math.Max(careerLevelBonusFromDegree, result);
            SocialNetworkingSkill element = career.OwnerDescription.SkillManager.GetElement(SkillNames.SocialNetworking) as SocialNetworkingSkill;
            if (element != null)
            {
                careerLevelBonusFromDegree = element.GetCurrentCareerBoost();
            }

            return Math.Max(careerLevelBonusFromDegree, result);
        }
Example #19
0
 public void PrintAllPeopleByOccupation(IList<Person> people, Occupation occupation)
 {
     //Implement a method which will print the first and last name of all people with a particular occupation to the console.
     //Bonus #1: Use Linq!
     //Bonus #2: Reimagine this method as an extension method on an IList of people.
 }
Example #20
0
partial         void Occupations_Updating(Occupation entity)
        {
            entity.UpdateDate = DateTime.Now;
            entity.UpdateUser = Application.User.Name;
        }
Example #21
0
        public static void FixCareer(Occupation job, bool allowDrop, Logger log)
        {
            if (job == null) return;

            if (job.Coworkers != null)
            {
                for (int i = job.Coworkers.Count - 1; i >= 0; i--)
                {
                    SimDescription coworker = job.Coworkers[i];

                    if ((!IsValidCoworker(coworker, job is School)) || (coworker == job.OwnerDescription))
                    {
                        job.Coworkers.RemoveAt(i);

                        if (coworker == null)
                        {
                            if (log != null)
                            {
                                log(" Bad Coworker " + job.CareerName + " - <Invalid>");
                            }
                        }
                        else
                        {
                            if (log != null)
                            {
                                log(" Bad Coworker " + job.CareerName + " - " + coworker.FullName);
                            }
                        }
                    }
                }
            }

            if ((allowDrop) && (job is Career))
            {
                bool replace = false;

                if (job.CareerLoc == null)
                {
                    if (log != null)
                    {
                        log(" Bad Location " + job.CareerName + " - " + job.GetType().ToString());
                    }
                    replace = true;
                }
                else
                {
                    RabbitHole hole = job.CareerLoc.Owner;
                    if (hole == null)
                    {
                        if (log != null)
                        {
                            log(" Missing Rabbithole " + job.CareerName + " - " + job.GetType().ToString());
                        }
                        replace = true;
                    }
                    else
                    {
                        RabbitHole proxy = hole.RabbitHoleProxy;
                        if (proxy == null)
                        {
                            if (log != null)
                            {
                                log(" Missing Proxy " + job.CareerName + " - " + job.GetType().ToString());
                            }
                            replace = true;
                        }
                        else
                        {
                            if ((proxy.EnterSlots == null) || (proxy.EnterSlots.Count == 0) ||
                                (proxy.ExitSlots == null) || (proxy.ExitSlots.Count == 0))
                            {
                                if (log != null)
                                {
                                    log(" Missing Slots " + job.CareerName + " - " + job.GetType().ToString());
                                }
                                replace = true;
                            }
                        }
                    }
                }

                if (replace)
                {
                    SimDescription me = job.OwnerDescription;

                    Occupation retiredJob = me.CareerManager.mRetiredCareer;

                    try
                    {
                        CareerLocation location = Sims3.Gameplay.Careers.Career.FindClosestCareerLocation(me, job.Guid);
                        if (location != null)
                        {
                            if (log != null)
                            {
                                log(" Location Replaced " + me.FullName);
                            }

                            if (job.CareerLoc != null)
                            {
                                job.CareerLoc.Workers.Remove(me);
                            }

                            job.CareerLoc = location;

                            location.Workers.Add(me);
                        }
                        else
                        {
                            if (log != null)
                            {
                                log(" Career Dropped " + me.FullName);
                            }

                            job.LeaveJobNow(Career.LeaveJobReason.kJobBecameInvalid);
                        }
                    }
                    finally
                    {
                        me.CareerManager.mRetiredCareer = retiredJob;
                    }
                }
            }
        }
Example #22
0
 internal bool AddIfEquals(int ageCat, Occupation occ, TTSEmploymentStatus empStat, bool dlic, bool female, float expFac)
 {
     if (
             this.AgeCat == ageCat
         & this.Female == female
         & this.Occupation == occ
         & this.EmploymentStatus == empStat
         & this.DriversLicense == dlic
             )
     {
         lock ( this )
         {
             this.ExpansionFactor += expFac;
         }
         return true;
     }
     return false;
 }
Example #23
0
        public static void RemoveInvalidCoworkers(Occupation ths)
        {
            if (ths.Coworkers != null)
            {
                // Custom
                for (int i = ths.Coworkers.Count - 1; i >= 0; i--)
                {
                    if ((ths.Coworkers[i] == null) || (ths.Coworkers[i] == ths.OwnerDescription))
                    {
                        ths.Coworkers.RemoveAt(i);
                    }
                }

                List<SimDescription> list = new List<SimDescription>(ths.Coworkers);
                foreach (SimDescription description in list)
                {
                    if ((!description.IsValidDescription || ((description.DeathStyle != SimDescription.DeathType.None) && !description.IsPlayableGhost)) || !description.IsHuman)
                    {
                        ths.RemoveCoworker(description);
                    }
                }
            }
        }
Example #24
0
        // From ManagerCareer in SP. Seems fitting here...
        public static bool IsCoworkerOrBoss(Occupation career, SimDescription sim)
        {
            if (career == null) return false;

            if (career.Boss == sim) return true;

            if (career.Coworkers != null)
            {
                if (career.Coworkers.Contains(sim)) return true;
            }

            return false;
        }
Example #25
0
 public UserSettings setOccupation(Occupation occupation)
 {
     switch(occupation) {
         case Occupation.OTHER:
         {
             #if UNITY_ANDROID && !UNITY_EDITOR || UNITY_IPHONE && !UNITY_EDITOR
             getInstance().setOccupation(1);
             #endif
             return this;
         }
         case Occupation.WORK:
         {
             #if UNITY_ANDROID && !UNITY_EDITOR || UNITY_IPHONE && !UNITY_EDITOR
             getInstance().setOccupation(2);
             #endif
             return this;
         }
         case Occupation.SCHOOL:
         {
             #if UNITY_ANDROID && !UNITY_EDITOR || UNITY_IPHONE && !UNITY_EDITOR
             getInstance().setOccupation(3);
             #endif
             return this;
         }
         case Occupation.UNIVERSITY:
         {
             #if UNITY_ANDROID && !UNITY_EDITOR || UNITY_IPHONE && !UNITY_EDITOR
             getInstance().setOccupation(4);
             #endif
             return this;;
         }
     }
     return null;
 }
Example #26
0
 public CareerItem(Occupation career, CareerLocation location)
 {
     mCareer = career;
     mLocation = location;
 }
        protected static string GetText(Occupation occupation)
        {
            if (occupation is Retired) return null;

            Career career = occupation as Career;
            if (career != null)
            {
                if (career.CurLevel == null) return null;

                if (occupation.CareerLoc == null) return null;

                if (occupation.CareerLoc.Owner == null) return null;

                DaysOfTheWeek nextWorkDay = career.CurLevel.GetNextWorkDay(SimClock.CurrentDayOfWeek);
                string entryKey = (occupation is School) ? "Gameplay/Careers/Career:FirstSchoolDayDetails" : "Gameplay/Careers/Career:FirstDayDetails";

                string text = Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, entryKey, new object[] { occupation.OwnerDescription, occupation.CareerLoc.Owner.CatalogName, SimClockUtils.GetText(career.CurLevel.StartTime), SimClockUtils.GetDayAsText(nextWorkDay) });
                if (occupation.Boss != null)
                {
                    text += Common.NewLine + Common.NewLine + Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, "Gameplay/Careers:MetBoss", new object[] { occupation.OwnerDescription, occupation.Boss });
                }

                return text;
            }
            else
            {
                XpBasedCareer xpCareer = occupation as XpBasedCareer;
                if (xpCareer != null)
                {
                    return PromotedScenario.GenerateXPBasedLevelUp(xpCareer);
                }
            }

            return null;
        }
Example #28
0
 public static string OccupationId(Occupation x)
 {
     return ((int)x).ToString();
 }