Пример #1
0
        public ActionResult Edit(Agent_Job agent_Job)
        {
            var company = Guid.Parse(Request.RequestContext.HttpContext.Session["Company"].ToString());

            if (ModelState.IsValid)
            {
                int exists = db.Agent_Job.Where(t => t.IdCompany == company && t.Cargo == agent_Job.Cargo && t.idJob != agent_Job.idJob).Count();

                if (exists <= 0)
                {
                    agent_Job.IdCompany       = company;
                    db.Entry(agent_Job).State = EntityState.Modified;

                    if (agent_Job.string_status == "Inactive")
                    {
                        agent_Job.status = false;
                    }
                    else
                    {
                        agent_Job.status = true;
                    }

                    db.SaveChanges();
                    Success("Registro editado con exito");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    Warning("Cargo ya existe", string.Empty);
                }
            }
            return(View(agent_Job));
        }
    //this script will generate agents properties depending on the enums listed above, saying what role the agent is and what they need to be doing. as well
    //as loading/generating any other properties.
    void ConfigureAgent(Agent_Category cat, Agent_Role role, Agent_Job job, Agent_Credentials cred)
    {
        if (cat == Agent_Category.Civillian)
        {
            gameObject.AddComponent <CivillianScript>();

            if (role == Agent_Role.VIP)
            {
                //we either run the VIP commands or we give the agent a script with the VIP commands and rules.
                gameObject.AddComponent <VIPScript>();
            }
        }

        if (cat == Agent_Category.Guard)
        {
            //anything outside of the bodyguard scope is considered a regular guard, they should either hold ground or patrol an area.
            gameObject.AddComponent <GuardScript>();
            //do guard stuff.
            if (role == Agent_Role.BodyGuard)
            {
                //bodyguards must stay within close range of their VIP at all times. Since we can have more than one VIP at a time, we have the guards select a vip
                //Only if the VIP allows for guards.
                gameObject.AddComponent <BodyGuardScript>();
            }
        }
    }
Пример #3
0
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Agent_Job agent_Job = db.Agent_Job.Find(id);

            if (agent_Job == null)
            {
                return(HttpNotFound());
            }
            ViewBag.status = agent_Job.status;
            return(View(agent_Job));
        }
Пример #4
0
        public ActionResult Create(Agent_Job agent_Job)
        {
            if (ModelState.IsValid)
            {
                var company = Guid.Parse(Request.RequestContext.HttpContext.Session["Company"].ToString());

                agent_Job.idJob     = Guid.NewGuid();
                agent_Job.IdCompany = company;
                db.Agent_Job.Add(agent_Job);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(agent_Job));
        }