protected override bool Allow(SimDescription sim)
        {
            if ((!sim.Child) && (!sim.Teen))
            {
                IncStat("Wrong Age");
                return(false);
            }
            else if (sim.CreatedSim == null)
            {
                IncStat("Hibernating");
                return(false);
            }
            else if (sim.CareerManager == null)
            {
                IncStat("No Manager");
                return(false);
            }
            else if (!Careers.Allow(this, sim))
            {
                IncStat("Careers Denied");
                return(false);
            }
            else if (!GetValue <AllowFindJobOption, bool>(sim))
            {
                IncStat("Find Job Denied");
                return(false);
            }
            else if (HasActivity(sim))
            {
                IncStat("Has Activity");
                return(false);
            }

            return(base.Allow(sim));
        }
        protected override bool Allow()
        {
            if (!GetValue <Option, bool>())
            {
                return(false);
            }

            if (Household.ActiveHousehold == null)
            {
                IncStat("No Active");
                return(false);
            }
            else if (Household.ActiveHousehold.LotHome == null)
            {
                IncStat("No Active Lot");
                return(false);
            }
            else if (GameUtils.IsUniversityWorld())
            {
                IncStat("University World");
                return(false);
            }
            else if (!Careers.AllowHomeworldUniversity(null))
            {
                IncStat("Homeworld University Fail");
                return(false);
            }

            return(base.Allow());
        }
Exemple #3
0
        protected override bool Allow(SimDescription sim)
        {
            if (sim.CareerManager == null)
            {
                IncStat("No Manager");
                return(false);
            }
            else if (sim.LotHome == null)
            {
                IncStat("Homeless");
                return(false);
            }
            else if (!HasMetric(sim))
            {
                IncStat("No Metric");
                return(false);
            }
            else if (!Careers.Allow(this, sim))
            {
                IncStat("Careers Denied");
                return(false);
            }

            return(base.Allow(sim));
        }
        public bool CreateOrUpdate(CareerDTO career)
        {
            try
            {
                using (var ctx = new Utn_SysContext())
                {
                    var oCareer = ctx.Careers.AsNoTracking()
                                  .Where(c => c.Id == career.Id)
                                  .FirstOrDefault();

                    if (oCareer == null)
                    {
                        oCareer = new Careers();
                        ctx.Careers.Add(oCareer);
                    }
                    else
                    {
                        ctx.Careers.Attach(oCareer);
                    }
                    oCareer.Name    = career.Name;
                    oCareer.Deleted = false;

                    ctx.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        public async Task <ActionResult <Careers> > PostCareers(Careers careers)
        {
            _context.Careers.Add(careers);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCareers", new { id = careers.CareerId }, careers));
        }
Exemple #6
0
        public ActionResult SendCareersForm(Careers careers)
        {
            if (ModelState.IsValid)
            {
                string filePath = "";

                if (careers.ResumeFile.FileName != "")
                {
                    filePath = Path.GetFileName(careers.ResumeFile.FileName);
                    string path1 = Path.Combine(Server.MapPath("~/Resume"), filePath);
                    careers.ResumeFile.SaveAs(path1);
                }


                careers.Resume    = filePath;
                careers.DateAdded = DateTime.Now;
                careers.Ipaddress = GetIpaddress();

                db.Careers.Add(careers);
                db.SaveChanges();
                SendEmail(careers);
                ModelState.Clear();
                ViewBag.Message = "Your request has been sent successfully.";
                return(View("Index"));
            }

            return(View("Index"));
        }
        public bool Update(long Id, CareersBE Be)
        {
            try
            {
                if (Be == null)
                {
                    throw new ApiBusinessException(007, "La entidad no está completa.", System.Net.HttpStatusCode.NotFound, "Http");
                }

                Careers entity = _unitOfWork.CareersRepository.GetAllByFilters(t => t.name.ToLower() == Be.name.ToLower(), null).FirstOrDefault();
                if (entity != null && entity.idcareers != Id)
                {
                    throw new ApiBusinessException(005, "Ya existe una carrera con ese nombre, por favor elija otro nombre.", System.Net.HttpStatusCode.BadRequest, "Http");
                }

                Mapper.Initialize(cfg =>
                {
                    cfg.CreateMap <CareersBE, Careers>();
                });
                Careers myentity = Mapper.Map <CareersBE, Careers>(Be);
                _unitOfWork.CareersRepository.Update(myentity, new List <String> {
                    "name", "state"
                });
                _unitOfWork.Commit();
                return(true);
            }


            catch (Exception ex)
            {
                throw HandlerExceptions.GetInstance().RunCustomExceptions(ex);
            }
        }
Exemple #8
0
        protected override bool TargetAllow(SimDescription sim)
        {
            if (sim.CreatedSim == null)
            {
                IncStat("Hibernating");
                return(false);
            }
            else if (mInstigator == sim)
            {
                IncStat("Instigator");
                return(false);
            }
            else if (!Careers.Allow(this, sim))
            {
                IncStat("User Denied");
                return(false);
            }
            else if (ManagerFriendship.AreEnemies(sim, Sim))
            {
                IncStat("Enemy");
                return(false);
            }

            return(base.Allow(sim));
        }
        public CareersBE GetById(long Id)
        {
            try
            {
                Expression <Func <Careers, Boolean> > predicate = u => u.idcareers == Id;
                Careers entity = _unitOfWork.CareersRepository.GetOneByFilters(predicate, null);

                if (entity == null)
                {
                    throw new ApiBusinessException(006, "No existe la carrera.", System.Net.HttpStatusCode.NotFound, "Http");
                }

                Mapper.Initialize(cfg => {
                    cfg.CreateMap <Careers, CareersBE>();
                });
                CareersBE be = Mapper.Map <Careers, CareersBE>(entity);
                return(be);
            }


            catch (Exception ex)
            {
                throw HandlerExceptions.GetInstance().RunCustomExceptions(ex);
            }
        }
        protected override bool Allow(SimDescription sim)
        {
            if (!Careers.Allow(this, sim))
            {
                IncStat("User Denied");
                return(false);
            }
            else if (sim.Occupation == null)
            {
                IncStat("No Job");
                return(false);
            }
            else if (sim.Occupation is Retired)
            {
                IncStat("Retired");
                return(false);
            }
            else if (sim.Occupation.CareerLevel < 5)
            {
                IncStat("Too Low");
                return(false);
            }
            else if (sim.LifetimeWish != (uint)LifetimeWant.JackOfAllTrades)
            {
                IncStat("Wrong LTW");
                return(false);
            }

            return(base.Allow(sim));
        }
        public async Task <IActionResult> PutCareers(int id, Careers careers)
        {
            if (id != careers.CareerId)
            {
                return(BadRequest());
            }

            _context.Entry(careers).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CareersExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #12
0
        protected override bool Allow(SimDescription sim)
        {
            if (sim.ChildOrBelow)
            {
                IncStat("Too Young");
                return false;
            }
            else if (sim.CreatedSim == null)
            {
                IncStat("Hibernating");
                return false;
            }
            else if (sim.LotHome == null)
            {
                IncStat("Homeless");
                return false;
            }
            else if (sim.SkillManager == null)
            {
                IncStat("No Manager");
                return false;
            }
            else if (!Skills.Allow(this, sim))
            {
                IncStat("Skill Denied");
                return false;
            }
            else if (!Careers.Allow(this, sim))
            {
                IncStat("Careers Denied");
                return false;
            }

            return base.Allow(sim);
        }
        public Alien(Careers career, Team team)
        {
            Career    = career;
            this.team = team;
            Points    = (new Func <decimal>(() => {
                switch (career)
                {
                case Careers.Doctor:
                    return(100);

                case Careers.Accountant:
                    return(120);

                case Careers.Senator:
                    return(120);

                case Careers.Builder:
                    return(120);

                case Careers.Programmer:
                    return(120);

                case Careers.Reporter:
                    return(100);

                default:
                    return(0);
                }
            }))();
        }
Exemple #14
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            Careers.VerifyTone(Sim);
            return(mNewCoworkers.Count > 0);
        }
Exemple #15
0
        protected override bool Allow(SimDescription sim)
        {
            if (!ManagerCareer.ValidCareer(sim.Occupation))
            {
                IncStat("No Job");
                return(false);
            }
            else if (sim.Household == null)
            {
                IncStat("Homeless");
                return(false);
            }
            else if (SimTypes.IsSpecial(sim))
            {
                IncStat("Special");
                return(false);
            }
            else if (!Careers.Allow(this, sim))
            {
                IncStat("Careers Denied");
                return(false);
            }

            return(base.Allow(sim));
        }
Exemple #16
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Lang,IsShow,Type,Description")] Careers careers)
        {
            if (id != careers.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    careers.Description = Convert(careers.Description);
                    _context.Update(careers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CareerExists(careers.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(careers));
        }
Exemple #17
0
        public ActionResult DeleteConfirmed(int id)
        {
            Careers careers = db.Careers.Find(id);

            db.Careers.Remove(careers);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #18
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Sim sim = Sim.CreatedSim;

            if (sim == null)
            {
                Sims.Instantiate(Sim, null, false);

                sim = Sim.CreatedSim;
            }

            if (sim == null)
            {
                IncStat("Hibernating");
                return(false);
            }

            Career job = Occupation as Career;

            Careers.VerifyTone(job);

            if (!ManagerCareer.ValidCareer(job))
            {
                IncStat("Career Invalidated");
                return(false);
            }

            InteractionInstance instance = GetWorkInteraction(job);

            if (instance == null)
            {
                IncStat("No Interaction");
                return(false);
            }
            else if (!Test(sim, instance.InteractionDefinition))
            {
                return(false);
            }
            else
            {
                if (sim.InteractionQueue.Add(instance))
                {
                    if (GetValue <AllowGoHomePushOption, bool>(Sim))
                    {
                        Manager.AddAlarm(new GoHomePushScenario(Sim));
                    }
                }
                else
                {
                    IncStat("Failure");
                }

                mReport = PostSlackerWarning();
                return(true);
            }
        }
Exemple #19
0
 public ActionResult Edit([Bind(Include = "Id,Name,Email,Phone,Message,Resume,Ipaddress,DateAdded")] Careers careers)
 {
     if (ModelState.IsValid)
     {
         db.Entry(careers).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(careers));
 }
Exemple #20
0
        public ActionResult Career()
        {
            ViewData["AdditionHeader"] = "我的设置";
            CareerModel model = new CareerModel();

            model.CurUser       = CurrentUser;
            model.CurUserConfig = CurrentUserConfig;
            model.Careers       = Careers.GetCareersByUID(model.CurUser.ID);
            return(View(model));
        }
Exemple #21
0
        public async Task <IActionResult> Create(Careers career)
        {
            var careerId = Guid.NewGuid();

            career.Id = careerId.ToString().Replace("-", "");
            _context.Careers.Add(career);
            await _context.SaveChangesAsync();

            return(Ok());
        }
Exemple #22
0
        static void Main(string[] args)
        {
            var darkTheme = new DarkTheme();

            var about   = new About(darkTheme);
            var careers = new Careers(darkTheme);

            Console.WriteLine(about.GetContent());
            Console.WriteLine(careers.GetContent());
            Console.ReadLine();
        }
Exemple #23
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            AcademicCareer career = Sim.OccupationAsAcademicCareer;

            if (Careers.Allow(this, Sim))
            {
                PayProfessor(career);
            }

            return(true);
        }
Exemple #24
0
        protected override Scenario Handle(Event e, ref ListenerAction result)
        {
            WentToWorkScenario scenario = base.Handle(e, ref result) as WentToWorkScenario;

            if (scenario != null)
            {
                // Do this now, rather than waiting the 10 sim-minute Scenario manager delay
                Careers.VerifyTone(scenario.Sim);
            }

            return(scenario);
        }
Exemple #25
0
        public async Task <IActionResult> Create([Bind("Id,Title,Lang,IsShow,Type,Description")] Careers careers)
        {
            if (ModelState.IsValid)
            {
                careers.Description = Convert(careers.Description);
                _context.Add(careers);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(careers));
        }
Exemple #26
0
        // GET: Careers/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Careers careers = db.Careers.Find(id);

            if (careers == null)
            {
                return(HttpNotFound());
            }
            return(View(careers));
        }
        private void PerformAging()
        {
            var roll = dice.roll(2) - Careers.Select(c => c.TermsServed).Sum();

            if (roll <= 0)
            {
                switch (roll)
                {
                case 0:
                    ReduceOnePhysicalCharacteristic(1);
                    break;

                case -1:
                    ReduceOnePhysicalCharacteristic(1);
                    ReduceOnePhysicalCharacteristic(1);
                    break;

                case -2:
                    ReduceOnePhysicalCharacteristic(1);
                    ReduceOnePhysicalCharacteristic(1);
                    ReduceOnePhysicalCharacteristic(1);
                    break;

                case -3:
                    ReduceOnePhysicalCharacteristic(2);
                    ReduceOnePhysicalCharacteristic(1);
                    ReduceOnePhysicalCharacteristic(1);
                    break;

                case -4:
                    ReduceOnePhysicalCharacteristic(2);
                    ReduceOnePhysicalCharacteristic(2);
                    ReduceOnePhysicalCharacteristic(1);
                    break;

                case -5:
                    ReduceOnePhysicalCharacteristic(2);
                    ReduceOnePhysicalCharacteristic(2);
                    ReduceOnePhysicalCharacteristic(2);
                    break;

                case -6:
                    ReduceOnePhysicalCharacteristic(2);
                    ReduceOnePhysicalCharacteristic(2);
                    ReduceOnePhysicalCharacteristic(2);
                    ReduceOneMentalCharacteristic(1);
                    break;
                }
            }
        }
Exemple #28
0
        protected override bool TargetAllow(SimDescription sim)
        {
            if (!Careers.Allow(this, sim))
            {
                IncStat("Careers Denied");
                return(false);
            }
            else if (ManagerFriendship.AreEnemies(Sim, sim))
            {
                IncStat("Enemy");
                return(false);
            }

            return(base.TargetAllow(sim));
        }
Exemple #29
0
        protected override bool Allow(SimDescription sim)
        {
            if (!Careers.Allow(this, sim))
            {
                IncStat("User Denied");
                return(false);
            }
            else if (!ManagerCareer.ValidCareer(sim.Occupation))
            {
                IncStat("No Career");
                return(false);
            }

            return(base.Allow(sim));
        }
Exemple #30
0
        protected override bool Allow(SimDescription sim)
        {
            if (!Careers.Allow(this, sim))
            {
                IncStat("User Denied");
                return(false);
            }
            else if (sim.CareerManager == null)
            {
                IncStat("No Manager");
                return(false);
            }

            return(base.Allow(sim));
        }