示例#1
0
        public ActionResult Create(projetm collection)
        {
            projet c = new projet();


            c.id          = collection.id;
            c.nom         = collection.nom;
            c.description = collection.description;
            c.mailClient  = collection.mailClient;



            sc.Add(c);
            sc.Commit();
            //   return View();
            return(RedirectToAction("Index"));
        }
示例#2
0
        // private ApplicationDbContext db = new ApplicationDbContext();

        // GET: Project

        /*  public ActionResult Index()
         * {
         *
         *    var projets = new List<projetm>();
         *    foreach (projet pdomain in sc.GetMany())
         *    {
         *        projets.Add(new projetm()
         *        {
         *            id = pdomain.id,
         *
         *            nom = pdomain.nom,
         *            description = pdomain.description,
         *            mailClient = pdomain.mailClient,
         *
         *            // Image = pdomain.Image,
         *            NombreHeuresEstimer = pdomain.NombreHeuresEstimer,
         *            //NombreHeuresEstimer = pdomain.NombreHeuresEstimer=acc.nbheureEstimer,
         *
         *            NombreHeuresTravailler = pdomain.NombreHeuresTravailler,
         *            NombreHeuresEnRetard = pdomain.NombreHeuresEnRetard
         *
         *        });
         *       //    ViewBag.nbAct = sc.GetMany(x => x.id == pdomain.id).get );
         *       //    ViewBag.nbAct = ordd1.Count;
         *
         *
         *
         *   //    ViewBag.ClientFidele = query.Max();
         *       ViewBag.nbprojet = projets.Count;
         *    }
         *
         *
         *    return View(projets);
         *
         * }
         *
         *
         *
         */

        /*
         *
         *      public ActionResult showOrderByProject()
         *      {
         *
         *          var projets = new List<projetm>();
         *          foreach (projet pdomain in sc.GetMany())
         *          {
         *              ViewBag.total4 = projets.OrderByDescending(x => +x.NombreHeuresTravailler);
         *
         *              projets = ViewBag.total4;
         *              projets.Add(new projetm()
         *              {
         *                  id = pdomain.id,
         *                  nom = pdomain.nom,
         *                  description = pdomain.description,
         *                  mailClient = pdomain.mailClient,
         *
         *                  // Image = pdomain.Image,
         *                  NombreHeuresEstimer = pdomain.NombreHeuresEstimer,
         *                  //NombreHeuresEstimer = pdomain.NombreHeuresEstimer=acc.nbheureEstimer,
         *
         *                  NombreHeuresTravailler = pdomain.NombreHeuresTravailler,
         *                  NombreHeuresEnRetard = pdomain.NombreHeuresEnRetard
         *              });
         *              // ViewBag.NombreHeuresEstimer = ac.GetMany(x => x.projet_id == pdomain.id).Sum(x => x.NombreHeuresEstimer );
         *
         *          }
         *
         *
         *          return View(projets);
         *
         *      }
         */

        // GET: Project/Details/5
        public ActionResult Details(int id)
        {
            //ViewBag.total2 = ordd1.Sum(x => +x.NombreHeuresTravailler);

            var c = sc.GetById(id);

            projetm d = new projetm();

            d.id                     = c.id;
            d.nom                    = c.nom;
            d.description            = c.description;
            d.mailClient             = c.mailClient;
            d.NombreHeuresTravailler = c.NombreHeuresTravailler;
            d.NombreHeuresEstimer    = c.NombreHeuresEstimer;
            d.NombreHeuresEnRetard   = c.NombreHeuresEnRetard;



            return(View(d));
        }
示例#3
0
        public ActionResult Edit(int id, projetm ord)
        {
            List <activity> ordd1 = ac.GetMany(x => x.projet_id == id).ToList();

            ViewBag.total = ordd1.Sum(x => + x.NombreHeuresEstimer);
            //ord.NombreHeuresEstimer = ordd1.Sum(x => +x.NombreHeuresEstimer);
            // ViewBag.ordd = ordd1;
            ViewBag.total2 = ordd1.Sum(x => + x.NombreHeuresTravailler);

            try
            {
                projet order = sc.GetById(id);
                order.nom                    = ord.nom;
                order.description            = ord.description;
                order.mailClient             = ord.mailClient;
                order.NombreHeuresEstimer    = ViewBag.total;
                order.NombreHeuresTravailler = ViewBag.total2;


                if ((ViewBag.total2 - ViewBag.total) > 0)
                {
                    order.NombreHeuresEnRetard = ViewBag.total2 - ViewBag.total;
                }
                else
                {
                    order.NombreHeuresEnRetard = 0;
                }
                sc.Update(order);
                sc.Commit();


                // TODO: Add update logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#4
0
        public ActionResult Index(string searchString)
        {
            List <projetm> lc = new List <projetm>();

            if (searchString == null)
            {
                List <projetm> lo = new List <projetm>();
                foreach (var cm in sc.GetAll())
                {
                    projetm c = new projetm();

                    c.nom = cm.nom;
                    c.id  = cm.id;
                    //  c.description = cm. ;
                    c.description            = cm.description;
                    c.NombreHeuresEstimer    = cm.NombreHeuresEstimer;
                    c.NombreHeuresTravailler = cm.NombreHeuresTravailler;
                    c.NombreHeuresEnRetard   = cm.NombreHeuresEnRetard;
                    c.mailClient             = cm.mailClient;
                    lc.Add(c);
                    ViewBag.nbprojet = lc.Count;


                    ViewBag.nbhTr     = lc.Count(x => x.NombreHeuresTravailler > 1);
                    ViewBag.nbhEst    = lc.Count(x => x.NombreHeuresEstimer > 1);
                    ViewBag.nbpretard = lc.Count(x => x.NombreHeuresEnRetard == 0);
                    //  ViewBag.nbpr = lc.Count(x =>+x.NombreHeuresEstimer);


                    if (ViewBag.nbhTr == ViewBag.nbhEst && ViewBag.nbpretard == 0)
                    {
                        ViewBag.nbprojetComplet = +1;
                    }

                    //   ViewBag.nbProjetTerminé = lc.Count(ViewBag.nbpr && ViewBag.nbpretard);

                    //ord.NombreHeuresEstimer = ordd1.Sum(x => +x.NombreHeuresEstimer);
                }
                return(View(lc));
            }
            else
            {
                foreach (var item in sc.GetAll())
                {
                    if (item.nom.Contains(searchString))
                    {
                        projetm pvm = new projetm();
                        pvm.id          = item.id;
                        pvm.description = item.description;
                        pvm.nom         = item.nom;
                        pvm.mailClient  = item.mailClient;
                        //    pvm.prix = item.prix;

                        lc.Add(pvm);

                        return(View(lc));
                    }
                }
            }


            return(View(lc));
        }