public ActionResult CreateBureaux(Bureau Bur, FormCollection collection)
        {
            if (Session["identifiant"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (ModelState.IsValid)
            {
                if (etat)
                {
                    db.CreateBureau(Bur);
                    db.SaveBureau();

                    return(RedirectToAction("GetBureuax"));
                }
                else
                {
                    return(RedirectToAction("Index", "Error"));
                }
            }
            else

            {
                //  ViewBag.msg = "Verifier l code postal";
                ViewData["batiments"] = new SelectList(BissInventaireEntities.Instance.Batiment.ToList(), "idBatiment", "description");
                ViewData["etages"]    = new SelectList(BissInventaireEntities.Instance.Etage.ToList(), "Id_etage", "Description");
                ViewData["direction"] = new SelectList(BissInventaireEntities.Instance.Direction.ToList(), "Id_direction", "Libelle");

                return(View());
            }
        }
Esempio n. 2
0
        public ActionResult EditBureaux(Bureau pers, FormCollection collection)
        {
            db.UpdateBureauDetached(pers);
            db.SaveBureau();

            return(RedirectToAction("GetBureaux"));
        }
        public ActionResult EditBureaux(Bureau etg)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    db.UpdateBureauDetached(etg);
                    db.SaveBureau();
                    return(RedirectToAction("GetBureuax"));
                }
                catch (Exception ex)
                {
                    LogThread.WriteLine(ex.Message);
                    return(RedirectToAction("Index", "Error"));
                }
            }
            else

            {
                ViewData["pays"]         = new SelectList(BissInventaireEntities.Instance.Pays.ToList(), "idPays", "libelle");
                ViewData["region"]       = new SelectList(BissInventaireEntities.Instance.Region.ToList(), "idRegion", "libelle");
                ViewData["gouvernorat"]  = new SelectList(BissInventaireEntities.Instance.Gouvernorat.ToList(), "idGouvernorat", "libelle");
                ViewData["organisation"] = new SelectList(BissInventaireEntities.Instance.Organisation.ToList(), "idOrganisation", "libelle");
                ViewData["delegation"]   = new SelectList(BissInventaireEntities.Instance.Delegation.ToList(), "idDelegation", "libelle");
                ViewData["batiment"]     = new SelectList(BissInventaireEntities.Instance.Batiment.ToList(), "idBatiment", "description");
                ViewData["etages"]       = new SelectList(BissInventaireEntities.Instance.Etage.ToList(), "Id_etage", "Description");
                return(View());
            }
        }
Esempio n. 4
0
 public SessionDataPackage()
 {
     Researches      = new Researches();
     ResourceStorage = new ResourceStorage();
     BranchBase      = new BranchBase(new Vector2Int(24, 39));
     Warehouse       = new Warehouse();
     Bureau          = new Bureau();
 }
        private BaseViewModel RetrieveModel(Bureau bureau)
        {
            var model = new BaseViewModel
            {
                BureauId   = bureau.BureauId,
                BureauName = bureau.Name,
            };

            return(model);
        }
Esempio n. 6
0
        private void removeChildren(Bureau bureau)
        {
            var units = _organizationService.GetBureauChildren(bureau.BureauId);

            foreach (var unit in units)
            {
                unit.Deleted = true;
                removeChildren(unit);
            }
        }
Esempio n. 7
0
        public async Task <IActionResult> AddBureau(Bureau bureau)
        {
            bureau = _organizationService.AddBureau(bureau);

            var identity = (ClaimsIdentity)User.Identity;
            await _auditLog.Append(identity.GetClaimAsInt("EmployeeId"), LogActionType.Create, LogResourceType.Bureau, bureau.BureauId,
                                   $"{identity.GetClaim(ClaimTypes.Name)} created bureau with id {bureau.BureauId}");

            return(RedirectToAction(nameof(ViewBureau), new { id = bureau.BureauId }));
        }
    Amenagement CreationAmenagement()
    {
        Amenagement temp = null;

        if (type == Type.BatimentAdministartif)
        {
            temp = new BatimentAdministratif(nombreHabitantNecessaire, coutMensuel, nom, prix, taille, niveau);
        }
        else if (type == Type.Bureau)
        {
            temp = new Bureau(placesDisponible, prixLocation, coutMensuel, nom, prix, taille, niveau);
        }
        else if (type == Type.Commercant)
        {
            temp = new Commercant(nbrEmployeMaxAise, nbrEmployeMaxMoyenne, nbrEmployeMaxOuvriere, coutMensuel, nom, prix, taille, niveau);
        }
        else if (type == Type.CompagnieEau)
        {
            temp = new CompagnieEau(productionMax, nbrEmployeMaxAise, nbrEmployeMaxMoyenne, nbrEmployeMaxOuvriere, coutMensuel, nom, prix, taille, niveau);
        }
        else if (type == Type.CompagnieElectricite)
        {
            temp = new CompagnieElectricite(productionMax, nbrEmployeMaxAise, nbrEmployeMaxMoyenne, nbrEmployeMaxOuvriere, coutMensuel, nom, prix, taille, niveau);
        }
        else if (type == Type.CompagnieTransport)
        {
            temp = new CompagnieTransport(coutMensuel, nom, prix, taille, niveau);
        }
        else if (type == Type.Culture)
        {
            temp = new Culture(niveauCulture, coutMensuel, nom, prix, taille, niveau);
        }
        else if (type == Type.Tourisme)
        {
            temp = new Tourisme(impactTourisme, coutMensuel, nom, prix, taille, niveau);
        }
        else if (type == Type.Logement)
        {
            temp = new Logement(capaciteMax, classe, nivBonheur, coutMensuel, nom, prix, taille, niveau);
        }
        else if (type == Type.Route)
        {
            temp = new Route(nom, prix, taille, estSortie);
        }
        else if (type == Type.Usine)
        {
            temp = new Usine(nbrEmployeMaxAise, nbrEmployeMaxMoyenne, nbrEmployeMaxOuvriere, coutMensuel, nom, prix, taille, niveau);
        }
        else if (type == Type.Primaire)
        {
            temp = new Primaire(nbrEmployeMaxAise, nbrEmployeMaxMoyenne, nbrEmployeMaxOuvriere, productionMax, coutMensuel, nom, prix, taille, niveau);
        }

        return(temp);
    }
Esempio n. 9
0
        public ActionResult CreateBureaux(Bureau Bur, FormCollection collection)
        {
            try
            {
                db.CreateBureau(Bur);
                db.SaveBureau();

                return(RedirectToAction("GetBureuax"));
            }
            catch (Exception ex)
            {
                LogThread.WriteLine(ex.Message);
                return(RedirectToAction("Index", "Error"));
            }
        }
Esempio n. 10
0
        public async Task <IActionResult> EditBureau(int id, Bureau update)
        {
            var bureau = _organizationService.GetBureau(id);

            var oldValue = JsonConvert.SerializeObject(bureau, Formatting.Indented);

            _mapper.Map(update, bureau);
            _organizationService.SaveChanges();
            var newValue = JsonConvert.SerializeObject(bureau, Formatting.Indented);

            var identity = (ClaimsIdentity)User.Identity;
            await _auditLog.Append(identity.GetClaimAsInt("EmployeeId"), LogActionType.Update, LogResourceType.Bureau, bureau.BureauId,
                                   $"{identity.GetClaim(ClaimTypes.Name)} updated bureau with id {bureau.BureauId}", oldValue, newValue);

            return(RedirectToAction(nameof(ViewBureau), new { id }));
        }
        public ValidationResult <Bureau> CreateBureau(Bureau bureau)
        {
            var validationResult = BureauAlreadyExists(bureau.Name, null);

            if (!validationResult.Succeeded)
            {
                return(validationResult);
            }
            try
            {
                bureau.CreatedDateUtc   = DateTime.UtcNow;
                validationResult.Entity = _payrollBureauDataService.Create(bureau);;
                return(validationResult);
            }
            catch (Exception ex)
            {
                validationResult.Succeeded = false;
                validationResult.Message   = ex.Message;
            }
            return(validationResult);
        }
        public ValidationResult <Bureau> UpdateBureau(Bureau bureau)
        {
            var validationResult = BureauAlreadyExists(bureau.Name, bureau.BureauId);

            if (!validationResult.Succeeded)
            {
                return(validationResult);
            }
            try
            {
                var bureauData = RetrieveBureau(bureau.BureauId);
                bureauData.Name            = bureau.Name;
                validationResult.Entity    = _payrollBureauDataService.UpdateEntityEntry(bureauData);
                validationResult.Succeeded = true;
                return(validationResult);
            }
            catch (Exception ex)
            {
                validationResult.Succeeded = false;
                validationResult.Message   = ex.Message;
            }
            return(validationResult);
        }
Esempio n. 13
0
 public TreeViewNode(Bureau bureau)
 {
     id   = bureau.BureauId;
     type = "Bureau";
     text = bureau.Name;
 }
Esempio n. 14
0
 public void CreateBureau(Bureau bureau)
 {
     utOfWork.BureauRepository.Add(bureau);
 }
Esempio n. 15
0
 public void UpdateBureauDetached(Bureau e)
 {
     utOfWork.BureauRepository.UpdateBureauDetached(e);
 }
Esempio n. 16
0
 public Bureau AddBureau(Bureau bureau)
 {
     _dbContext.Bureaus.Add(bureau);
     _dbContext.SaveChanges();
     return(bureau);
 }
        public static void LoadGame(string saveKey)
        {
            Ville   v;
            JObject vJObject;

            try
            {
                StreamReader stm        = new StreamReader(folder + saveKey + ".txt");
                string       jsonString = stm.ReadToEnd();
                vJObject = JObject.Parse(jsonString);

                v = JsonConvert.DeserializeObject <Ville>(jsonString);
            }
            catch (Exception e)
            {
                UnityEngine.Object.FindObjectOfType <LogBox>().WriteLog(e.Message);
                return;
            }


            v.LoadData();
            List <Amenagement> newAmenagements = new List <Amenagement>();
            JArray             amenagements    = (JArray)vJObject["Amenagements"];

            for (int i = 0; i < amenagements.Count; i++)
            {
                JToken a    = amenagements[i];
                string type = a["Type"].ToString();
                if (type == "Route")
                {
                    Route r = new Route(a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["PosX"].ToString()), Int32.Parse(a["PosY"].ToString()), bool.Parse(a["EstSortie"].ToString()));
                    r.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    newAmenagements.Add(r);
                }

                /* if (type == "Batiment")
                 * {
                 *   Batiment b = new Batiment(a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["PosX"].ToString()), Int32.Parse(a["PosY"].ToString()), bool.Parse(a["EstSortie"].ToString()));
                 *   b.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                 *   newAmenagements.Add(b);
                 * } */
                if (type == "BatimentAdministratif")
                {
                    BatimentAdministratif t = new BatimentAdministratif(Int32.Parse(a["NombreHabitantNecessaire"].ToString()), Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                    t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    t.PosX     = Int32.Parse(a["PosX"].ToString());
                    t.PosY     = Int32.Parse(a["PosY"].ToString());
                    newAmenagements.Add(t);
                }
                if (type == "Bureau")
                {
                    Bureau t = new Bureau(Int32.Parse(a["MaxPlaceDispo"].ToString()), float.Parse(a["PrixLocation"].ToString()), Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                    t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    t.PosX     = Int32.Parse(a["PosX"].ToString());
                    t.PosY     = Int32.Parse(a["PosY"].ToString());
                    newAmenagements.Add(t);
                }
                if (type == "Commercant")
                {
                    Commercant t = new Commercant(Int32.Parse(a["NbrEmployeMaxAise"].ToString()), Int32.Parse(a["NbrEmployeMaxMoyenne"].ToString()), Int32.Parse(a["NbrEmployeMaxOuvriere"].ToString()), Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                    t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    t.PosX     = Int32.Parse(a["PosX"].ToString());
                    t.PosY     = Int32.Parse(a["PosY"].ToString());
                    newAmenagements.Add(t);
                }
                if (type == "CompagnieEau")
                {
                    CompagnieEau t = new CompagnieEau(Int32.Parse(a["ProductionMax"].ToString()), Int32.Parse(a["NbrEmployeMaxAise"].ToString()), Int32.Parse(a["NbrEmployeMaxMoyenne"].ToString()), Int32.Parse(a["NbrEmployeMaxOuvriere"].ToString()), Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                    t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    t.PosX     = Int32.Parse(a["PosX"].ToString());
                    t.PosY     = Int32.Parse(a["PosY"].ToString());
                    newAmenagements.Add(t);
                }
                if (type == "CompagnieElectricite")
                {
                    CompagnieElectricite t = new CompagnieElectricite(Int32.Parse(a["ProductionMax"].ToString()), Int32.Parse(a["NbrEmployeMaxAise"].ToString()), Int32.Parse(a["NbrEmployeMaxMoyenne"].ToString()), Int32.Parse(a["NbrEmployeMaxOuvriere"].ToString()), Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                    t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    t.PosX     = Int32.Parse(a["PosX"].ToString());
                    t.PosY     = Int32.Parse(a["PosY"].ToString());
                    newAmenagements.Add(t);
                }
                if (type == "CompagnieTransport")
                {
                    CompagnieTransport t = new CompagnieTransport(Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                    t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    t.PosX     = Int32.Parse(a["PosX"].ToString());
                    t.PosY     = Int32.Parse(a["PosY"].ToString());
                    newAmenagements.Add(t);
                }
                if (type == "Culture")
                {
                    Culture t = new Culture(Int32.Parse(a["NiveauCulture"].ToString()), Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                    t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    t.PosX     = Int32.Parse(a["PosX"].ToString());
                    t.PosY     = Int32.Parse(a["PosY"].ToString());
                    newAmenagements.Add(t);
                }

                /*if (type == "Entreprise")
                 * {
                 *  Entreprise t = new Entreprise(Int32.Parse(a["NiveauCulture"].ToString()), Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                 *  t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                 *  t.PosX = Int32.Parse(a["PosX"].ToString());
                 *  t.PosY = Int32.Parse(a["PosY"].ToString());
                 *  newAmenagements.Add(t);
                 * }*/
                if (type == "Logement")
                {
                    Logement t = new Logement(Int32.Parse(a["CapaciteMax"].ToString()), (ClasseSocial)Enum.Parse(typeof(ClasseSocial), a["Classe"].ToString()), float.Parse(a["NivBonheur"].ToString()), Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                    t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    t.PosX     = Int32.Parse(a["PosX"].ToString());
                    t.PosY     = Int32.Parse(a["PosY"].ToString());
                    newAmenagements.Add(t);
                }
                if (type == "Tourisme")
                {
                    Tourisme t = new Tourisme(Int32.Parse(a["ImpactTourisme"].ToString()), Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                    t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    t.PosX     = Int32.Parse(a["PosX"].ToString());
                    t.PosY     = Int32.Parse(a["PosY"].ToString());
                    newAmenagements.Add(t);
                }
                if (type == "Usine")
                {
                    Usine t = new Usine(Int32.Parse(a["NbrEmployeMaxAise"].ToString()), Int32.Parse(a["NbrEmployeMaxMoyenne"].ToString()), Int32.Parse(a["NbrEmployeMaxOuvriere"].ToString()), Int32.Parse(a["CoutMensuel"].ToString()), a["Nom"].ToString(), Int32.Parse(a["Prix"].ToString()), Int32.Parse(a["Taille"].ToString()), Int32.Parse(a["Niveau"].ToString()));
                    t.Rotation = new Vector3(float.Parse(a["Rotation"]["x"].ToString()), float.Parse(a["Rotation"]["y"].ToString()), float.Parse(a["Rotation"]["z"].ToString()));
                    t.PosX     = Int32.Parse(a["PosX"].ToString());
                    t.PosY     = Int32.Parse(a["PosY"].ToString());
                    newAmenagements.Add(t);
                }
            }

            v.Amenagements = newAmenagements;
            PopulateMap(v);
            UnityEngine.Object.FindObjectOfType <Manager>().StartGame();
            UnityEngine.Object.FindObjectOfType <GameManager>().LoadGame(v);
        }