コード例 #1
0
        //methodes de manupulation de l'interface

        private void actualiser_click(object sender, RoutedEventArgs e)
        {
            liste_employés.ItemsSource = null;
            List <employe> source = new List <employe>();

            source.Clear();
            foreach (Employé liste in responsable.liste_employes.Values)
            {
                employe emp = new employe();
                emp.Id               = liste.Cle.ToString();
                emp.Matricule        = liste.Matricule;
                emp.Nom              = liste.Nom;
                emp.Prenom           = liste.Prenom;
                emp.Num_sec_soc      = liste.sec_soc;
                emp.Date_naissance   = liste.Date_naissance.ToShortDateString();
                emp.Date_recrutement = liste.Date_prem.ToShortDateString();
                emp.Grade            = liste.Grade;
                emp.Etat             = liste.etats;
                emp.CCP              = liste.compte_ccp;
                emp.Cle_ccp          = liste.Cle_ccp;
                emp.Tel              = liste.tel;
                emp.Service          = liste.Service;
                emp.Email            = liste.Email;
                emp.Etat_service     = liste.Etat_service;
                source.Add(emp);
            }
            liste_employés.ItemsSource = source;
        }
コード例 #2
0
        public ActionResult Delete()
        {

            int uid = int.Parse(Session["idE"].ToString());
            employe e = db.employe.Find(uid);
            DateTime dc = DateTime.Now;


            string button = Request["button"];
            switch (button)
            {
                case "Annuler":
                    e.DateFin = dc;
                    e.password = "******";
                    db.Entry(e).State = EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index");

                case "Sup":

                    return RedirectToAction("Index");

                default:
                    return View();

            }

        }
コード例 #3
0
        public ActionResult Create(employe data)
        {

            data.NomComplet = Request["NomComplet"];
            data.matricule= Request["matricule"];
            data.nbjours =Convert.ToInt32( Request["nbjours"]);
            data.nbjoursA = Request["nbjoursA"];
            data.nbHeureR = Request["nbHeureR"];
            data.affectation = Request["affectation"];
            data.role = Request["role"];
            data.password = Request["password"];
            data.sexe = Request["sexe"];
            data.Status = Request["Status"];
            data.nbEnfants = Convert.ToInt32(Request["nbEnfants"]);
            data.Classe = Request["Classe"];
            data.DateDebut =Convert.ToDateTime( Request["DateDebut"]);
            
          //  data.DateFin = Convert.ToDateTime(Request["DateFin"]);

            db.employe.Add(data);
             db.SaveChanges();
            return RedirectToAction("Index", "Employe");


        }
コード例 #4
0
        public ActionResult changePassword(ChangePasswordModel obj)
        {
            if (ModelState.IsValid)
            {
                int uid = int.Parse(Session["idEmploye"].ToString());

                employe e = db.employe.Find(uid);


                if (e.password == obj.OldPassword)
                {
                    e.password        = obj.NewPassword;
                    db.Entry(e).State = EntityState.Modified;
                    db.SaveChanges();
                    Session["Messag"] = "Your Password is updated successfully";
                    return(RedirectToAction("Index", "Default"));
                }
                else
                {
                    Session["Messag"] = "Invalid currrent  Password";
                    return(RedirectToAction("Index", "Default"));
                }
            }

            return(View(obj));
        }
コード例 #5
0
        public ActionResult Login(employe account)
        {
            employe employe = new employe();

            try
            {
                employe = operations.FindEmployeLogIn(account);
            }
            catch (Exception)
            {
                string message = "Det går inte att hämta användarna, vänligen försök igen.";
                return(RedirectToAction("Error", "Home", new { message = message }));
            }
            if (employe.employe_id != 0)
            {
                Session["employe_id"]   = employe.employe_id.ToString();
                Session["name"]         = employe.name.ToString();
                Session["employe_type"] = employe.employe_type.ToString();
                Session["group_id"]     = employe.group_id.ToString();
                Session["location_id"]  = employe.location_id.ToString();
                return(RedirectToAction("Index", "Home"));
            }
            ModelState.AddModelError("", "Användarnamnet eller lösenordet är fel");
            return(View());
        }
コード例 #6
0
        // GET: Commentaire/IndexByEmp/idemploye
        public ActionResult IndexByEmp(int idemploye)
        {
            IUnitOfWork            Uok            = new UnitOfWork(Factory);
            IService <commentaire> jbService      = new Service <commentaire>(Uok);
            IService <employe>     serviceemploye = new Service <employe>(Uok);

            employe emp   = serviceemploye.GetById(idemploye);
            String  idemp = (string)System.Web.HttpContext.Current.Session["id"].ToString();

            int x = int.Parse(idemp);

            //  ViewBag.idemploye = 2;
            if (x != 0)
            {
                List <commentaire> appo = new List <commentaire>();
                List <commentaire> j    = new List <commentaire>();
                appo = jbService.GetAll().ToList();
                for (int i = appo.Count - 1; i >= 0; i--)
                {
                    if (appo[i].employecommentaire_id == x)
                    {
                        j.Add(appo[i]);
                    }
                }

                return(View(j));
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
コード例 #7
0
        public ActionResult login(string mail, string pass)
        {
            string exist = string.Empty;

            FormUrlEncodedContent dataForm = new FormUrlEncodedContent(new[] {
                new KeyValuePair <string, string>("mail", mail),
                new KeyValuePair <string, string>("pass", pass)
            });



            HttpClient Client = new HttpClient();

            Client.BaseAddress = new Uri("http://localhost:9080");
            HttpResponseMessage response = Client.PostAsync("pidev-web/api/login", dataForm).Result;
            var tokne = response.Content.ReadAsStringAsync().Result;

            Console.WriteLine(response);
            JavaScriptSerializer oJS = new JavaScriptSerializer();
            employe em = new employe();

            em = oJS.Deserialize <employe>(tokne);

            // Console.WriteLine(em.nom);
            if (em == null)
            {
                TempData["Message"] = "Verifier Vos parametre";
                return(RedirectToAction("Create"));
            }
            Session["emnom"] = em.nom;
            return(RedirectToAction("Index", "Admin"));
        }
コード例 #8
0
 public int Update(employe updatedEmploye)
 {
     //prend les ancien data remplace par nv
     db.employe.Attach(updatedEmploye);
     db.Entry(updatedEmploye).State = System.Data.Entity.EntityState.Modified;
     return(db.SaveChanges());
 }
コード例 #9
0
        /*  public ActionResult Delete(int? Id)
         * {
         *    if(Id != null)
         *    {
         *        var employe = employeService.ReadById(Id.Value);
         *        var employeInfo = new EmployeModel
         *        {
         *            Id = employe.idEmploye,
         *            Classe = employe.Classe,
         *            DateD = (DateTime)employe.DateDebut,
         *            DateF = (DateTime)employe.DateFin,
         *            Nom = employe.NomComplet
         *        };
         *        return View(employeInfo);
         *    }
         *    return RedirectToAction("Index");
         * }
         */

        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var currentEmploye = employeService.ReadById(id.Value);

            if (currentEmploye == null)
            {
                return(HttpNotFound($"this demande ({id}) is not found"));
            }


            employe e = db.employe.Find(id);

            Session["idE"] = currentEmploye.idEmploye;

            if (e == null)
            {
                return(HttpNotFound());
            }

            return(View(e));
        }
コード例 #10
0
        public ActionResult Edit(EmployeModel data)
        {
            if (ModelState.IsValid)
            {
                var updatedEmploye = new employe
                {
                    idEmploye  = data.Id,
                    NomComplet = data.Nom,
                    Classe     = data.Classe,
                    DateDebut  = (DateTime)data.DateD,
                    DateFin    = (DateTime)data.DateF
                };
                var result = employeService.Update(updatedEmploye);

                if (result > 0)
                {
                    ViewBag.Success = true;
                    ViewBag.Message = $"employe ({data.Id}) updated succefully";
                }
                else
                {
                    ViewBag.Message = $"an error occurred while updation employe !";
                }
            }

            return(View(data));
        }
コード例 #11
0
        public ActionResult changePassword(ChangePasswordModel obj)
        {
            if (ModelState.IsValid)
            {
                //int uid = int.Parse(Session["matricule"].ToString());
                int uid = int.Parse(Session["idEmploye"].ToString());

                employe e = db.employe.Find(uid);

                if (e.password == obj.OldPassword)
                {
                    e.password        = obj.NewPassword;
                    db.Entry(e).State = EntityState.Modified;
                    db.SaveChanges();
                    obj.Message = "Your Password is updated successfully";
                    //ViewBag.Success = true;
                    // ViewBag.Message = $"password updated succefully";
                    // return RedirectToAction("Index", "Default");
                }
                else
                {
                    // ViewBag.Message = $"an error occurred while updation password !";
                    obj.Message = "Invalid currrent  Password";
                    // return RedirectToAction("Index", "Default");
                }
            }

            return(View(obj));
        }
コード例 #12
0
        public ActionResult Create([Bind(Include = "IdEmploye,IdEntite,date")] employehasentite employehasentite)
        {
            if (ModelState.IsValid)
            {
                int     id  = employehasentite.IdEmploye;
                var     id1 = employehasentite.IdEntite;
                entite  e1  = db.entite.Find(id1);
                employe e   = db.employe.Find(id);
                // Session["des"] = e1.Designation;
                e.affectation = e1.Designation;
                db.employehasentite.Add(employehasentite);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IdEmploye = new SelectList(db.employe, "idEmploye", "matricule", employehasentite.IdEmploye);
            ViewBag.IdEntite  = new SelectList(db.entite, "idEntite", "Designation", employehasentite.IdEntite);
            return(View(employehasentite));

            /*
             * employehasentite.date = Convert.ToDateTime(Request["date"]);
             * employehasentite.IdEmploye = 1;
             * employehasentite.IdEntite = 3;
             * db.employehasentite.Add(employehasentite);
             * db.SaveChanges();
             * return RedirectToAction("Index");
             */
        }
コード例 #13
0
        public ActionResult DeleteConfirmed(int id)
        {
            employe employe = db.employe.Find(id);

            db.employe.Remove(employe);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #14
0
        public ActionResult DemandeConge(conge conge)
        {
            IUnitOfWork        Uok              = new UnitOfWork(Factory);
            IService <conge>   iser             = new Service <conge>(Uok);
            IService <employe> jbServiceEmploye = new Service <employe>(Uok);
            employe            e    = jbServiceEmploye.GetById(conge.employe_id.Value);
            DateTime           fin  = DateTime.Parse(conge.date_fin.ToString());
            DateTime           deb  = DateTime.Parse(conge.date_deb.ToString());
            TimeSpan           Diff = fin - deb;
            int nb = int.Parse(Diff.Days.ToString()) + 1;

            if (ModelState.IsValid)
            {
                if (conge.date_deb <= conge.date_fin)
                {
                    if (conge.paye == true)
                    {
                        if (e.nb_conge_restants - nb >= 0)
                        {
                            DateTime localDate = DateTime.Now;
                            conge.date_demande = localDate;
                            conge.etat         = "non Traitee";
                            iser.Add(conge);
                            iser.Commit();
                            System.Windows.Forms.MessageBox.Show("demande de congé payé envoyée!");

                            return(RedirectToAction("consulterMesConges"));
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("Vous n'avez que " + e.nb_conge_restants + " jours de cingé restants cette année ! DEMANDE NON ENVOYEE !");
                        }
                    }
                    else
                    {
                        DateTime localDate = DateTime.Now;
                        conge.date_demande = localDate;
                        conge.etat         = "non Traitee";
                        iser.Add(conge);
                        iser.Commit();
                        System.Windows.Forms.MessageBox.Show("demande congé non payé envoyée!");

                        return(RedirectToAction("consulterMesConges"));
                    }
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Selectionnez date de début et date fin valide !");
                }
            }

            ViewBag.employe_id = new SelectList(db.employe, "id", "email", conge.employe_id);
            return(View(conge));
        }
コード例 #15
0
 public ActionResult Edit([Bind(Include = "idEmploye,idDepartement,nom")] employe employe)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employe).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idDepartement = new SelectList(db.departement, "idDepartement", "nomDepartement", employe.idDepartement);
     return(View(employe));
 }
コード例 #16
0
 static void afficheStruct(employe profil)
 {
     Console.WriteLine("*************************\n");
     Console.WriteLine("Prénom : {0}", profil.Prenom_employe);
     Console.WriteLine("Nom : {0}", profil.Nom_employe);
     Console.WriteLine("Type d'employé : {0}", profil.Type_employe);
     Console.WriteLine(String.Format("Salaire : {0:C}", profil.Salaire));
     Console.WriteLine("Courriel : {0}", profil.Courriel);
     Console.WriteLine("Date de naissance : {0} {1} {2}", profil.Date_naissance.jour, profil.Date_naissance.mois, profil.Date_naissance.annee);
     Console.WriteLine("\n");
 }
コード例 #17
0
        static void Main(string[] args)
        {
            employe[] travailleur = new employe[4];

            travailleur[0].Prenom_employe       = "Marco";
            travailleur[0].Nom_employe          = "Polo";
            travailleur[0].Type_employe         = 2;
            travailleur[0].Salaire              = 20000;
            travailleur[0].Courriel             = "*****@*****.**";
            travailleur[0].Date_naissance.jour  = 09;
            travailleur[0].Date_naissance.mois  = "Juin";
            travailleur[0].Date_naissance.annee = 1970;

            travailleur[1].Prenom_employe       = "Marie";
            travailleur[1].Nom_employe          = "Curie";
            travailleur[1].Type_employe         = 1;
            travailleur[1].Salaire              = 45000;
            travailleur[1].Courriel             = "*****@*****.**";
            travailleur[1].Date_naissance.jour  = 30;
            travailleur[1].Date_naissance.mois  = "Octobre";
            travailleur[1].Date_naissance.annee = 1965;

            travailleur[2].Prenom_employe       = "René";
            travailleur[2].Nom_employe          = "Descartes";
            travailleur[2].Type_employe         = 3;
            travailleur[2].Salaire              = 35000;
            travailleur[2].Courriel             = "*****@*****.**";
            travailleur[2].Date_naissance.jour  = 20;
            travailleur[2].Date_naissance.mois  = "Mars";
            travailleur[2].Date_naissance.annee = 1960;

            travailleur[3].Prenom_employe       = "Anne";
            travailleur[3].Nom_employe          = "Conway";
            travailleur[3].Type_employe         = 4;
            travailleur[3].Salaire              = 32000;
            travailleur[3].Courriel             = "*****@*****.**";
            travailleur[3].Date_naissance.jour  = 20;
            travailleur[3].Date_naissance.mois  = "Mars";
            travailleur[3].Date_naissance.annee = 1980;

            for (int compt = 0; compt < travailleur.Length; compt++)
            {
                afficheStruct(travailleur[compt]);
            }

            Console.WriteLine("***********************\n");
            TrierParAge(travailleur);
            Console.WriteLine("***********************\n");
            SeparerSalaire(travailleur);
            Console.WriteLine("***********************\n");
            TrierCourriel(travailleur);
            Console.ReadLine();
        }
コード例 #18
0
        public ActionResult Create([Bind(Include = "idEmploye,idDepartement,nom")] employe employe)
        {
            if (ModelState.IsValid)
            {
                db.employe.Add(employe);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.idDepartement = new SelectList(db.departement, "idDepartement", "nomDepartement", employe.idDepartement);
            return(View(employe));
        }
コード例 #19
0
        public ActionResult Index(employe log)
        {
            var user = db.employe.Where(x => x.matricule == log.matricule && x.password == log.password).ToList().FirstOrDefault();

            if (user != null)
            {
                var heure  = Convert.ToDouble(user.nbHeureR);
                var heur1  = (heure / 24);
                int heure1 = (int)heur1;

                Session["userName"]    = user.NomComplet;
                Session["matricule"]   = user.matricule;
                Session["idEmploye"]   = user.idEmploye;
                Session["affectation"] = user.affectation;
                Session["nbjours"]     = user.nbjours.ToString();
                Session["nbjoursR"]    = heure1;
                Session["Classe"]      = user.Classe;
                Session["DateFin"]     = user.DateFin;
                Session["DateDebut"]   = user.DateDebut;



                string role = user.role;
                if (role == "adminN1")
                {
                    return(RedirectToAction("historique", "Historique", new { area = "Admin" }));
                }
                else if (role == "adminN2")
                {
                    return(RedirectToAction("historique", "Historique", new { area = "AdminN2" }));
                }
                else if (role == "Rh")
                {
                    return(RedirectToAction("historique", "Historique", new { area = "RH" }));
                }
                else if (user.password == "supprime")
                {
                    ViewBag.message = "Compte introuvable";
                    return(RedirectToAction("Index", "Login"));
                }
                else
                {
                    return(RedirectToAction("historiqueMois", "employe"));
                }
            }
            else
            {
                ViewBag.message = "verifiez vos informations";
                return(View());
            }
        }
コード例 #20
0
        public int Create(employe newEmploye)
        {
            var employeName       = newEmploye.NomComplet.ToLower();
            var employeNameExists = db.employe.Where(c => c.NomComplet.ToLower() == employeName).Any();

            if (employeNameExists)
            {
                return(-2);
            }


            db.employe.Add(newEmploye);
            return(db.SaveChanges());
        }
コード例 #21
0
        // GET: employes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            employe employe = db.employe.Find(id);

            if (employe == null)
            {
                return(HttpNotFound());
            }
            return(View(employe));
        }
コード例 #22
0
ファイル: SocieteListe.cs プロジェクト: Manu1506/miniProjet
            static void Main(string[] args)
            {
                var employe1 = new employe("lebon", "james", 37, 12000);
                var employe2 = new employe("west", "russel", 30, 2500);
                var employe3 = new employe("harden", "james", 30, 600);
                var employe4 = new employe("kwahi", "leonard", 27, 9000);
                var employe5 = new employe("batum", "nicolas", 22, 2000);



                var chef1 = new chef("man", "marie", 20, 3000, "commercial");
                var chef2 = new chef("Atalia", "bernadette", 25, 5000, "comptable");

                var directeur = new directeur("george", "paul", 30, 15000, "budget", "orange");

                //Declaration de la liste
                var Liste = new Liste();

                Liste.InsererDebut(employe1);
                Liste.InsererDebut(employe2);
                Liste.InsererDebut(employe3);
                Liste.InsererDebut(employe4);
                Liste.InsererDebut(employe5);
                Liste.InsererDebut(chef1);
                Liste.InsererDebut(chef2);
                Liste.InsererDebut(directeur);

                Console.WriteLine(" -- [Affichage de la liste] --");// affichage de la liste
                Liste.Lister();

                Console.WriteLine("-- Vider Liste --");// vider la liste
                Liste.Vider();

                Liste.InsererFin(employe1);
                Liste.InsererFin(employe2);
                Liste.InsererFin(employe3);
                Liste.InsererFin(employe4);
                Liste.InsererFin(employe5);
                Liste.InsererFin(chef1);
                Liste.InsererFin(chef2);
                Liste.InsererFin(directeur);

                Console.WriteLine("-- Insertion en fin de liste --");
                Liste.Lister();
                Liste.Lister();

                Console.WriteLine(" -- [Affiche avec l'indexeur] --");
                Console.WriteLine(Liste.getIndex(5).ToString());
            }
コード例 #23
0
        // GET: employes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            employe employe = db.employe.Find(id);

            if (employe == null)
            {
                return(HttpNotFound());
            }
            ViewBag.idDepartement = new SelectList(db.departement, "idDepartement", "nomDepartement", employe.idDepartement);
            return(View(employe));
        }
コード例 #24
0
        public ActionResult EditEmploye(int?id)
        {
            if (Convert.ToInt32(Session["employe_type"]) == 1 && id != null)
            {
                employe employe = new employe();
                List <EmployeGroupLocationVM> employe_locations = new List <EmployeGroupLocationVM>();
                try
                {
                    employe_locations = operations.GetLocationsBothWeeks();
                    employe           = operations.FindEmploye(id);

                    employe_locations.Add(new EmployeGroupLocationVM {
                        name            = employe.name,
                        employe_type    = employe.employe_type,
                        employe_id      = employe.employe_id,
                        number          = employe.number,
                        adress          = employe.address,
                        password        = employe.password,
                        group_id        = employe.group_id,
                        location_id     = employe.location_id,
                        post_number     = employe.post_number,
                        tax             = employe.tax,
                        bank            = employe.bank,
                        clearing        = employe.clearing,
                        account_number  = employe.account_number,
                        shirt_size      = employe.shirt_size,
                        social_security = employe.social_security,
                        email           = employe.email
                    });
                }
                catch (Exception)
                {
                    string message = "Det går inte att hitta den anställda, vänligen försök igen.";
                    return(RedirectToAction("Error", "Home", new { message = message }));
                }
                if (employe == null)
                {
                    return(HttpNotFound());
                }
                return(View(employe_locations));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
コード例 #25
0
ファイル: EmployeController.cs プロジェクト: shmhiri/ADVYTEAM
        public ActionResult Edit(int id)
        {
            employe employe = null;

            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:9080");

            HttpResponseMessage response = client.GetAsync("http://localhost:9080/PI-GL-web/rest/employe/" + id.ToString()).Result;

            if (response.IsSuccessStatusCode)
            {
                employe = response.Content.ReadAsAsync <employe>().Result;
            }

            return(View("List"));
        }
コード例 #26
0
        public ActionResult Create(evaluation360 e)
        {
            IUnitOfWork Uok = new UnitOfWork(Factory);
            IService <evaluation360> jbService = new Service <evaluation360>(Uok);
            IService <employe>       x         = new Service <employe>(Uok);

            employe emp = x.GetById((long)e.evaluationEmploye360_id);

            // TODO: Add insert logic here
            jbService.Add(e);
            jbService.Commit();

            var verifyurl = "/Signup/VerifiyAccount/";
            var link      = Request.Url.AbsolutePath.Replace(Request.Url.PathAndQuery, verifyurl);

            var fromEmail = new MailAddress("*****@*****.**", "nesria guinouvi");
            var toEmail   = new MailAddress(emp.email);

            // var toEmail = new MailAddress("*****@*****.**");
            var FromEmailPassword = "******";

            string subject = "Information sur le lancement d'une évaluation";

            string body = "votre manager a lancer une évaluation le " + e.datedebut + "pour vous évaluer .Monsieur/madame ." + emp.nom + " " + emp.prenom;

            var smtp = new SmtpClient
            {
                Host                  = "smtp.gmail.com",
                Port                  = 587,
                EnableSsl             = true,
                DeliveryMethod        = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials           = new NetworkCredential(fromEmail.Address, FromEmailPassword),
                Timeout               = 20000
            };

            using (var message = new MailMessage(fromEmail, toEmail)
            {
                Subject = subject,
                Body = body,
                IsBodyHtml = true
            }) smtp.Send(message);

            return(RedirectToAction("Index"));
        }
コード例 #27
0
        public ActionResult Createe(employe c)
        {
            HttpClient Client = new HttpClient();

            Client.BaseAddress = new Uri("http://localhost:9080");

            string json = JsonConvert.SerializeObject(c);
            var    myCleanJsonObject = JObject.Parse(json);
            string test = myCleanJsonObject.ToString().Substring(1, myCleanJsonObject.ToString().Length - 1);

            Console.WriteLine("Substring: {0}", test);
            System.Diagnostics.Debug.WriteLine(json);

            Client.PostAsync("pidev-web/api/employe", new StringContent(json, Encoding.UTF8, "application/json")).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode()).GetAwaiter().GetResult();


            return(RedirectToAction("Index"));
        }
コード例 #28
0
ファイル: EmployeController.cs プロジェクト: shmhiri/ADVYTEAM
        public async Task <ActionResult> Create(employe t)
        {
            if (ModelState.IsValid)
            {
                HttpClient client = new HttpClient();

                var json = JsonConvert.SerializeObject(t, Formatting.Indented, new JsonSerializerSettings()
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                });
                using (var stringContent = new StringContent(json, Encoding.UTF8, "application/json"))
                {
                    var result = await client.PostAsync(new Uri("http://localhost:9080/PI-GL-web/rest/employe/"), stringContent);
                }
            }

            return(RedirectToAction("List"));
        }
コード例 #29
0
        static void Main(string[] args)
        {
            var employe1 = new employe("lebon", "james", 37, 12000);
            var employe2 = new employe("west", "russel", 30, 2500);
            var employe3 = new employe("harden", "james", 30, 600);
            var employe4 = new employe("kwahi", "leonard", 27, 9000);
            var employe5 = new employe("batum", "nicolas", 22, 2000);



            var chef1 = new chef("man", "marie", 20, 3000, "commercial");
            var chef2 = new chef("Atalia", "bernadette", 25, 5000, "comptable");

            var directeur = new directeur("george", "paul", 30, 15000, "budget", "orange");

            //Declaration de la liste
            var Liste = new Liste();

            Liste.InsererDebut(employe1);
            Liste.InsererDebut(employe2);
            Liste.InsererDebut(employe3);
            Liste.InsererDebut(employe4);
            Liste.InsererDebut(employe5);
            Liste.InsererDebut(chef1);
            Liste.InsererDebut(chef2);
            Liste.InsererDebut(directeur);


            Console.WriteLine(" -- [Affichage de la liste] --");// affichage de la liste
            Liste.Lister();

            var ListeEnumeration = new ListeEnumeration(Liste);



            while (ListeEnumeration.MoveNext())
            {
                Console.WriteLine(ListeEnumeration.Current().ToString());
                Console.WriteLine(Environment.NewLine);
            }
        }
コード例 #30
0
ファイル: EmployeController.cs プロジェクト: shmhiri/ADVYTEAM
        public ActionResult Edit(employe e)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:9080");

            EmployeViewModels res = new EmployeViewModels();

            res.userId = e.Id_emp;
            res.nom    = e.nom;
            res.prenom = e.prenom;
            res.email  = e.email;

            res.poste = e.poste;



            client.PutAsJsonAsync <EmployeViewModels>("http://localhost:9080/PI-GL-web/rest/employe/" + res.userId.ToString(), res).Result.EnsureSuccessStatusCode();


            return(RedirectToAction("List"));
        }